Technology and Security

Tag: Hyper-V

Installing Ubuntu on Hyper-V

Installing Ubuntu on Hyper-V

This article will look at the steps required for installing Ubuntu on Hyper-V. We will focus on a vanilla build using Ubuntu LTS 20.04. This virtual machine could be used for a variety of purposes as-is. In later articles we will build on this simple foundation to create an open source intelligence (osint) platform for performing research on the internet with privacy. If you are interested in cybersecurity, you could follow this article to build a Kali Linux attack machine and use Ubuntu as the target.

Installation Overview

Installing Ubuntu on a Windows 10 workstation using Hyper-V involves the following steps:

  • Download the Ubuntu ISO image
  • Configure a new Hyper-V Virtual Machine
  • Install and Configure Ubuntu Operating System
  • Login to the Ubuntu Linux VM

Next we will download the operating system.

Downloading Ubuntu 20.04 LTS

Ubuntu can be downloaded from here. For this article we will be using the most recent long-term support (LTS) version available. After installation we will update and upgrade to apply the most recent security patches.

Ubuntu 20.04 LTS Requirements
Ubuntu 20.04 LTS Requirements

Configure a new Hyper-V Virtual Machine

If you have not done so already, please follow the Microsoft documentation for enabling Hyper-V. Run the Hyper-V application, then right-click your workstation and select “New | Virtual Machine.”

create new hyper-v vm
Creating a new Hyper-V VM

You must complete several screens of options in order to configure the VM. Several steps worth noting include:

  • Specify Name and Location
  • Specify Generation: 2
  • Assign Memory: 4096MB
  • Configure Networking: Default Switch
  • Connect Virtual Hard Disk: 25GB
  • Installation Options: configure to use the downloaded ISO image

Finally press “Finish” on the summary page to create the virtual machine.

Disable Secure Boot Option

Since we selected a second generation vm in the last section, there is one more step to complete. Open the vm settings, and uncheck the “Enable Secure Boot” option under Security. Without completing this step, the Linux OS will not boot from the ISO.

Virtual Machine Settings
Virtual Machine Settings
Virtual Machine Disable Secure Boot
Virtual Machine Disable Secure Boot

Secure Boot is a feature available with generation 2 virtual machines that helps prevent unauthorized firmware, operating systems, or Unified Extensible Firmware Interface (UEFI) drivers (also known as option ROMs) from running at boot time. Secure Boot is enabled by default. 

microsoft

Install and Configure Ubuntu on Hyper-V

Right-click on the newly created VM and select Connect followed by Start. Select the option for “Install Ubuntu“.

Install Ubuntu
Install Ubuntu

There are several configuration screens that follow. Fortunately most steps can use default values on your own preferences. We will show the non-default values below.

For updates and other software, choose either a normal or minimal installation. Either will work, but a minimum will allow you to install only the features you need. Also be sure to check the box for installing third-party software.

Updates and Other Software
Updates and Other Software

For the “Who are you” page, be sure to select a username and strong password. We entered “osint” across the board because our vm was disposable. This simple scheme is not recommended for a long-living virtual machine.

Who are you
Who are you

After completing the setup pages, you will be prompted to restart the machine.

Reboot to Complete Installation
Reboot to Complete Installation

Configure Personal Settings

Previously you rebooted the vm and are back at a login screen. Finish out your personal settings to complete your installation of ubuntu on Hyper-V. Your settings will depend entirely on how you intend to use the vm. If you are using this as a personal workstation, feel free to configure the settings for your accounts. Since we will be updating this virtual machine in future blog articles, we will not be including any personal information.

Connect Online Accounts
Connect Online Accounts
Skip Live Patch Setup
Skip Live Patch Setup
Help Improve Ubuntu
Help Improve Ubuntu
Privacy
Privacy
Ready To Go
Ready To Go
building a windows 10 vm in hyper-v

Building a Windows 10 VM on Hyper-V

This article will look at the steps required for building a Windows 10 VM on Hyper-V. Love it or hate it, at some point you will find yourself needing a Windows 10 workstation. Maybe to use as a cybersecurity target, testing a new software install, or for installing business software that will not run on your favorite Linux distro. If this VM will used as a target, see our instructions on building a Kali Linux attack machine in this article on our blog.

Downloading a Windows ISO

Microsoft publishes free Windows virtual machines for testing browser compatibility. Where the intent is to offer browsers for testing, the reality is that they can be repurposed to any need. The caveat is that they are 90 day OS licenses, so don’t plan on maintaining a long-term project on these ISOs. The variants can be downloaded directly from Microsoft here.

Windows VM Downloads
Windows VM Downloads

Installing a Windows 10 VM on Hyper-V

After downloading your preferred distro in the last section, you are now ready to build the virtual machine. First start by opening the Hyper-V Manager and choosing the option to import a virtual machine.

Import a VM in Hyper-V
Import a VM in Hyper-V

Use the following settings to start the wizard:

  • Locate Folder: this will usually be your downloads folder
  • Select Virtual Machine: this will only have one option

The next few steps are important to making a functional vm. For the “Import Type” you should select the “Copy” option.

Copy the Virtual Machine
Copy the Virtual Machine

The next two pages of options deal with the vm destination. Mileage may vary based on your host, but most users tend to install their virtual machines on a larger secondary drive.

Windows VM Destination
Windows VM Destination
Virtual Hard Disk Location
Virtual Hard Disk Location

Finally click “Finish” on the Summary tab to kick-off the installation.

Logging In

After the virtual machine has completed installation, you can select the “Connect To” and “Start” options from the Hyper-V Manager to launch Windows. This will bring you to the login screen which requires a password.

Windows 10 Login
Windows 10 Login

The password is predefined in the ISO and displayed on the original download page from Microsoft. At this time of writing this blog article, the default password to your new virtual machine is “Passw0rd!”

As a final step, is always good to make sure networking is functioning properly. After a quick ping test, you are good to go…

Windows 10 Ping Test
Windows 10 Ping Test
installing metasploitable on hyper-v

Installing Metasploitable on Hyper-V

Metasploitable is an intentionally vulnerable Linux virtual machine that can be used to conduct security training, test security tools, and practice penetration testing. This article will look at the steps required for installing Metasploitable on Hyper-V.

Downloading Metasploitable

There are a number of versions available for download. We will be using the download available directly from Rapid7 found here. Note that you will need to register an email address before receiving the free download link.

Converting the Image

Metasploitable is packaged in a VMware format. We must first convert it to be Hyper-V compatible. As of 2022, there are a lot of online links to documentation using Microsoft Virtual Machine Converter for this task. Unfortunately, Microsoft abandoned that utility and it is no longer available. We will instead use the free StarWind Converter found here. First unzip the Metasploitable download; Then use the following options for the wizard and finally press “Convert”:

  • Local File
  • Provide Source Image
  • Local File
  • Microsoft Virtual Hard Disk (VHD/VHDX)
  • VHD Growable Image
  • Destination File
StarWind Converter
StarWind Converter

This conversion will generate an image which can be directly imported into Hyper-V in the next step.

Installing Metasploitable on Hyper-V

Following the previous section should result in an image ready to be installed.

Converted VHD Image
Converted VHD Image

In the Hyper-V application, right click and choose “Import Virtual Machines”. Use the following settings in the wizard:

  • Specify Name and Location
  • Specify Generation 1
  • Assign Memory 2048MB
  • Configure Networking: Default Switch
  • Connect Virtual Hard Disk: Choose Existing
Choose Existing VHD
Choose Existing VHD

For the last step in the wizard, select the VHD that you previously converted. Finally press “Finish” on the summary page to create the virtual machine.

Changing the VM Network Adapter

The virtual machine will start but will not connect to a network as configured by default. The setup process creates a network adapter which is not compatible with Metasploitable. To resolve this problem, open the virtual machine settings. First remove the default network adapter and then create a “Legacy Network Adapter” as seen in the images below.

Remove VM Network Adapter
Remove VM Network Adapter
Create Legacy Network Adapter
Create Legacy Network Adapter

Verifying the Metasploitable Hyper-V VM

Now that your VM is fully configured, start it from Hyper-V. Once the Linux instance has launched, the username and password are both msfadmin.

Starting MetaSploitable
Starting MetaSploitable

After login you can issue a ping to google to ensure that networking is working correctly.

Ping Google from MetaSploitable
Ping Google from MetaSploitable

Your VM is now complete and ready to hack. Rapid7 maintains an exploitation guide found here. Finally, read our guide on installing Kali Linux to build a VM for attacking Metasploitable.

updating kali linux vm 2022.1

How to Upgrade Kali Linux to 2022.1

In this brief article we will upgrade Kali Linux to release 2022.1. This upgrade demonstration is on a Hyper-V virtual machine. The steps, however, are not specific to Hyper-V VMs and will work on other platforms. Kali 2022.1 was released on Feburary 14th 2022 with the full release notes located here. If you would like to create a Kali VM on Hyper-V please follow the process documented here.

Verifying the Virtual Machine

Start by opening a terminal window. Then issue the following command:

grep VERSION /etc/os-release

As you can see below, we are running the previous release from 2021 and need to upgrade.

kali linux old version
kali linux old version

Upgrading Kali Linux to 2022.1

Start by opening a terminal window. Then issue the following commands:

$ echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list
$ sudo apt update && sudo apt -y full-upgrade
$ cp -rbi /etc/skel/. ~
$ [ -f /var/run/reboot-required ] && sudo reboot -f

If prompted, accept and details and make sure the vm reboots at the end.

Verifying the Upgrade

Start by opening a terminal window. Then issue the following command:

grep VERSION /etc/os-release

The virtual machine’s version is now up-to-date.

kali linux upgraded version
kali linux upgraded version
Kali Hyper-V

How to Install Kali Linux on Hyper-V

This article documents the process of installing Kali Linux as a virtual machine running on a Windows 10 workstation using Hyper-V. The installation has numerous steps but most of them involve accepting default values. Rather than include all of the screenshots inline (which will become unwieldy), this article will be broken into several pages. An overview will be discussed and the full series of screenshots will be included as appendix pages.

What is Kali Linux

Kali Linux (formerly known as BackTrack Linux) is an open-source, Debian-based Linux distribution aimed at advanced Penetration Testing and Security Auditing.

Kali linux documentation

What is Hyper-V

Hyper-V is Microsoft’s hardware virtualization product. It lets you create and run a software version of a computer, called a virtual machine. Each virtual machine acts like a complete computer, running an operating system and programs. When you need computing resources, virtual machines give you more flexibility, help save time and money, and are a more efficient way to use hardware than just running one operating system on physical hardware.

microsoft hyper-v overview

Installation Overview

Installing Kali Linux on a Windows 10 workstation using Hyper-V involves the following steps:

  • Download the Kali Linux ISO image
  • Configure a new Hyper-V Virtual Machine
  • Install and Configure Kali Linux Operating System
  • Login to the Kali Linux VM

Downloading Kali Linux

Kali Linux is an open-source Linux distribution that has several installation options. For our purposes, we will be pulling the ISO image of the most recent stable build from the Kali Linux Download page.

There are several preconfigured virtual machines provided by Kali, but unfortunately Hyper-V is not one of them. We will instead select the recommended option for the “Bare Metal” installer.

download kali linux bare metal option
Download Kali Linux Bare Metal Option

Configure a new Hyper-V Virtual Machine

We assume you already have Hyper-V installed and running on your workstation. If not, please follow the Microsoft documentation for enabling the software.

Run the Hyper-V application, then right-click your workstation and select “New | Virtual Machine.”

create new hyper-v vm
Creating a new Hyper-V VM

You must complete several screens of options in order to configure the VM. Several steps worth noting include:

  • Assign Memory: change the default from 1024 to 2048
  • Connect Virtual Hard Disk: default is too large, 20GB is more than adequate for a starter Linux VM
  • Installation Options: configure to use the downloaded ISO image

There is a full listing of screenshots included in the Hyper-V Screenshot Appendix. After creating the VM by pressing Finish, you can begin the Kali Linux installation.

Install and Configure Kali Linux

Right-click on the newly created VM and select Connect:

connecting to a kali linux vm using hyper-v
Connecting to a Kali Linux VM using Hyper-V

There are almost two dozen configuration screens for the OS installation. Fortunately most of the steps can use default values. There is a full listing of screenshots included in the Kali Linux Screenshot Appendix. Fill out each configuration page and make sure to remember your username and password.

Login to the Kali Linux VM

After the last battery of questions, the VM will reboot itself and be ready for use with the login credentials you provided during setup.

Kali Linux Login Screen
Kali Linux Login Screen

Enter the username and password to login to the desktop:

Kali Linux Desktop
Kali Linux Desktop

Note that the initial user is an account with root user privileges. To verify this, open a terminal window and sudo up:

Kali Linux Root User
Kali Linux Root User

At this point your Kali Linux VM is complete. See the following pages for a complete listing of screenshots from the installation process. Note that you must be in the full-page mode for this article to see the additional pages.

Powered by WordPress & Theme by Anders Norén