My Pentesting Space
LinkedIn
  • Welcome to Hackjiji
  • 🕸️web pentesting
    • Basics
    • Web pentest cheatsheet
    • Burpsuite and browser tricks
    • cUrl cheatsheet
    • CVE exploitation
    • JavaScript Obfuscation/Deobfuscation
  • Network pentesting
    • Basics
    • Nmap favorites
    • Host discovery
    • Port scanning
    • Network Services
      • RPC-NFC
      • WINRM - 5895-5896
      • FTP - 21
      • SMB - 445
      • RDP - 3389
      • SSH - 22
      • SMTP - 25
    • Firewall evasion
    • Pivoting and double pivoting
  • Physical pentesting
    • Bad USB - Rubber Duckies
  • Linux pentesting
    • Usefull command's
    • Privilege escalation
  • windows pentesting
    • Windows useful commands
    • Windows Reverse shell codes
    • Privilege escalation
  • Active Directory pentesting
    • Basics
    • AD
    • AAD
  • General
    • Hash cracking
    • Wordlist
    • Encoding/decoding
    • Environment setup
      • Install a new OS on seperated boot sector
      • Hyper-V
      • Virtualbox
    • Reverse-shell-cheatsheet
    • Metasploit cheatsheet
    • Vulnerability research
    • My scanning methodology
  • Events
    • HackTheBox Meetup - LFI2RCE
    • Radio Equans - QR Code Awareness campaign
    • Cybersecurity job campaign
Powered by GitBook
On this page
  • 1. Create a VHDX
  • 2. Apply the ISO image to your VHDX
  • 3. Create Boot Sector
  • Optional: Delete a boot entry in BCD
  • You have already an VHDX file - NOT TESTED YET!!
  1. General
  2. Environment setup

Install a new OS on seperated boot sector

PreviousEnvironment setupNextHyper-V

1. Create a VHDX

Go to Disk management and create a new VHDX disk with Dynamicallly expanding and 80 GB of size:

1.1 Attach the VHDX

To make a VHD available for use (either one you've created or another existing VHD), follow these steps:

  1. Open Disk management. In the search box on the taskbar, enter Computer Management, and select Disk Management.

  2. On the Action menu, select Attach VHD.

  3. After the Attach Virtual Hard Disk dialog box opens, select the Browse button, and find your .vhd file.

  4. Now that you've selected the .vhd file, you return to the Attach Virtual Hard Disk dialog box. Select OK.

1.2 Initialize the VHDX

  1. In Disk Management, select and hold (or right-click) the disk you want to initialize, and then select Initialize Disk. If the disk is listed as Offline, first select and hold (or right-click) the disk, and then select Online.

    Some USB drives can't be initialized. These disks are only formatted and then assigned a drive letter.

  2. In the Initialize Disk dialog box, make sure the correct disk is selected, and then choose OK to accept the default partition style. If you need to change the partition style (GPT or MBR), see Compare partition styles - GPT and MBR.

    The disk status briefly changes to Initializing and then to the Online status. If initializing fails for some reason, see A disk's status is Not Initialized or the disk is missing entirely.

1.3 Format

1.1 Create a Volume

2. Apply the ISO image to your VHDX

  1. Download an ISO image from the microsoft site and extract info about the install.wim

dism /get-wiminfo /wimfile:i:\sources\install.wim

  1. Apply the image to your VHDX file where j:\ corresponds to your VHDX drive letter

dism /Apply-Image /ImageFile:install.wim /Index:5 /ApplyDir:j:\

3. Create Boot Sector

  1. Create your Bcdboot on the VHDX drive , assuming that your VHDX drive letter is j:

bcdboot j:/Windows

  1. Detach/unmount the disk

  2. Create or verify if the bcdboot entry is created and if not, add the following lines in command prompt and not powershell!!!!

You have to first identify the ID of the new bootloader using bcdedit /v and then replace it with the right value.

Bcdedit set {ID} description "something that makes sence for you".

bcdedit /set {b49af847-d3ee-11ea-a124-00d861e6520f} osdevice vhd=[e:]\Win_1909_03_2020.vhdx
bcdedit /set {b49af847-d3ee-11ea-a124-00d861e6520f} device vhd=[e:]\Win_1909_03_2020.vhdx
bcdedit /set {b49af847-d3ee-11ea-a124-00d861e6520f} description “TEST”
  1. Restart the server and choose the new boot sector to complete the windows installation

You are done.

Optional: Delete a boot entry in BCD

bcdedit /delete {b49af847-d3ee-11ea-a124-00d861e6520f}

You have already an VHDX file - NOT TESTED YET!!

  1. copy the vhdx file to your c drive from example

  2. bcdedit /v to check the boot loader section

bcdedit /v
bcdedit /copy {current} /d "Pentester-01.vhdx Boot"
bcdedit /set  {63a5720b-5bdd-11ef-b541-891552f0c234} device vhd=[C:]\VHDX\PENTESTER-01.VHDX
bcdedit /set  {63a5720b-5bdd-11ef-b541-891552f0c234} osdevice vhd=[C:]\VHDX\PENTESTER-01.VHDX

now we have a windows boot loader configured to boot from the vhdx

verify that we have another boot sector available sector