-
Notifications
You must be signed in to change notification settings - Fork 9
Improve VirtualBox descriptor parsing #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
e28c0e6 to
831abd4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
==========================================
+ Coverage 78.01% 78.64% +0.62%
==========================================
Files 26 26
Lines 2202 2332 +130
==========================================
+ Hits 1718 1834 +116
- Misses 484 498 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
831abd4 to
e1bb7ee
Compare
8901abe to
de2c7f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there already a PR in dissect.target that incorporates these changes? seeing as vbox.disks isn't a thing anymore
| @@ -1,63 +1,64 @@ | |||
| from __future__ import annotations | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand most of these tests have been changed due to the changes for the vbox. Once this gets squashed and merged I wouldn't expect a commit called "Improve VirtualBox descriptor parsing" to also touch and change all the different tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split them up so we can merge without squashing.
| return None | ||
|
|
||
|
|
||
| class HardDisk: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it not be useful to also have the format of the disk available? Not for target-query, but for the package as its own entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also noticed that a HardDisk can have an additional <Property name="CRYPT/KeyID"> and <Property name="CRYPT/KeyStore">. These exist when you tell virtualbox that it should encrypt a vm. It creates it for every associated disk in that case.
I think it might be useful to note down if the hard disk is encrypted. I can give you an example file if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have an example, sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
**
** Written by VirtualBox 7.2.4 (r170995)
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.19-linux">
<Machine uuid="{366f53dd-1710-434e-8021-1f91b0405b65}" name="encrypted test" OSType="Windows11_64" currentSnapshot="{cfbdc706-6561-44e8-8f3a-236df446b808}" snapshotFolder="Snapshots" lastStateChange="2026-01-20T13:01:05Z">
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{24cdb8e9-35d6-42f2-aa17-c2d78bf1e1de}" location="encrypted test.vdi" format="VDI" type="Normal">
<Property name="CRYPT/KeyId" value="encrypted test"/>
<Property name="CRYPT/KeyStore" value="U0NORQABQUVTLVhUUzI1Ni1QTEFJTjY0AAAAAAAAAAAAAAAAAABQQktERjItU0hB MjU2AAAAAAAAAAAAAAAAAAAAAAAAAEAAAACOEfHKuPU9MHJktr3UZAxmuL+epJsk SRfK3vhbPnb4USAAAABCoUSl+kb0+6OzG8N3wo16bru7UNsjHzIsB+OPBfZUPiBO AACa0Cbl1wJz09E5i8U10V3xElnY8iAIwEqSwVWpwFPiYsAJDgBAAAAAgcb2cMho wWkDpje3pQHrn62sH8oTyr4+wXaJoFUEreymEuIXYlnB+jeLjQDWEEIs9DUIXfiP PWw3Fph9h0a3lA=="/>
<HardDisk uuid="{742e6d0f-8896-4aa6-97f4-e05d70e73029}" location="Snapshots/{742e6d0f-8896-4aa6-97f4-e05d70e73029}.vdi" format="VDI"/>
</HardDisk>
<HardDisk uuid="{1db0b9fe-36c2-44e8-9b7c-61fa5b6d1462}" location="encrypted test_1.vdi" format="VDI" type="Normal"/>
</HardDisks>
</MediaRegistry>
<Snapshot uuid="{cfbdc706-6561-44e8-8f3a-236df446b808}" name="Encryption" timeStamp="2026-01-20T13:01:05Z">
<Hardware>
<Memory RAMSize="4096"/>
<HID Pointing="USBTablet"/>
<Display controller="VBoxSVGA" VRAMSize="128"/>
<Firmware type="EFI"/>
<BIOS>
<IOAPIC enabled="true"/>
<NVRAM path="Snapshots/2026-01-20T13-01-05-717390000Z.nvram"/>
<SmbiosUuidLittleEndian enabled="true"/>
<AutoSerialNumGen enabled="true"/>
</BIOS>
<TrustedPlatformModule type="v2_0" location=""/>
<USB>
<Controllers>
<Controller name="XHCI" type="XHCI"/>
</Controllers>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="0800274C9CFB" type="82540EM">
<NAT localhost-reachable="true"/>
</Adapter>
</Network>
<AudioAdapter controller="HDA" useDefault="true" driver="ALSA" enabled="true" enabledOut="true"/>
<Clipboard/>
<StorageControllers>
<StorageController name="SATA" type="AHCI" PortCount="2" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{24cdb8e9-35d6-42f2-aa17-c2d78bf1e1de}"/>
</AttachedDevice>
<AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
</StorageController>
</StorageControllers>
<CPU count="2">
<HardwareVirtExLargePages enabled="false"/>
<PAE enabled="false"/>
<LongMode enabled="true"/>
</CPU>
</Hardware>
</Snapshot>
<Hardware>
<Memory RAMSize="4096"/>
<HID Pointing="USBTablet"/>
<Display controller="VBoxSVGA" VRAMSize="128"/>
<Firmware type="EFI"/>
<BIOS>
<IOAPIC enabled="true"/>
<SmbiosUuidLittleEndian enabled="true"/>
<AutoSerialNumGen enabled="true"/>
</BIOS>
<TrustedPlatformModule type="v2_0" location=""/>
<USB>
<Controllers>
<Controller name="XHCI" type="XHCI"/>
</Controllers>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="0800274C9CFB" type="82540EM">
<NAT localhost-reachable="true"/>
</Adapter>
</Network>
<AudioAdapter controller="HDA" useDefault="true" driver="ALSA" enabled="true" enabledOut="true"/>
<Clipboard/>
<StorageControllers>
<StorageController name="SATA" type="AHCI" PortCount="3" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{742e6d0f-8896-4aa6-97f4-e05d70e73029}"/>
</AttachedDevice>
<AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
<AttachedDevice type="HardDisk" hotpluggable="false" port="2" device="0">
<Image uuid="{1db0b9fe-36c2-44e8-9b7c-61fa5b6d1462}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
<CPU count="2">
<HardwareVirtExLargePages enabled="false"/>
<PAE enabled="false"/>
<LongMode enabled="true"/>
</CPU>
</Hardware>
</Machine>
</VirtualBox>From how I interpreted it, the encryption holds for all parent disks and their children.
In the case above I added another disk after enabling the "Encrypt all disks" tho it seems it doesn't add a key for that one. Whereas it does add the properties if you enable encryption with multiple disks attached to the vm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case above I added another disk after enabling the "Encrypt all disks" tho it seems it doesn't add a key for that one. Whereas it does add the properties if you enable encryption with multiple disks attached to the vm.
But the second disk is encrypted? Presumably using the same key as the other one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the second disk is encrypted? Presumably using the same key as the other one?
The second disk is not encrypted. Had to verify it to be sure. Tho the wording "encrypt all disks" made me assume otherwise at first.
de2c7f5 to
a75b55f
Compare
Not yet. |
a75b55f to
aa365d6
Compare
The parsing looks good to me, I will approve the PR once there is a PR in target for the virtualbox changes |
Fixes #70.