https://www.vulnhub.com/entry/kb-vuln-1,540/
本机安装有:
VMware® Workstation 16 Pro
16.2.1 build-18811642VirtualBox 图形用户界面
版本 5.2.30 r130521 (Qt5.6.2)
vm16.2支持wsl2,所以我得让vm16.2跑靶机,VirtualBox5.2可以导入靶机,但是无法开机(不支持wsl2),得升级
因为安装有ensp,以及wsl2,所以没有对VirtualBox5.2进行升级,
解压ova:
wls2的kali里:cd /mnt/h/hackmyvm
mkdir ./KB-VULN-exported/
tar -xvf KB-VULN.ova -C KB-VULN-exported/
磁盘格式转化:
cd /d "C:\Program Files (x86)\VMware\VMware Workstation"
vmware-vdiskmanager.exe -r "H:\hackmyvm\KB-VULN-exported\KB-VULN-disk001.vmdk" -t 0 "H:\hackmyvm\KB-VULN-exported\KB3-VULN-disk001.vmdk"
从KB-VULN.ovf文件里删除磁盘信息,这样导入的时候就不会报错:
原始KB-VULN.ovf如下:
<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine"><References><File ovf:id="file1" ovf:href="KB-VULN-disk001.vmdk"/></References><DiskSection><Info>List of the virtual disks used in the package</Info><Disk ovf:capacity="21818433536" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="935b12f8-e927-40a7-9fee-e00da57e8f42"/></DiskSection><NetworkSection><Info>Logical networks used in the package</Info><Network ovf:name="NAT"><Description>Logical network used by this appliance.</Description></Network></NetworkSection><VirtualSystem ovf:id="KB-VULN"><Info>A virtual machine</Info><ProductSection><Info>Meta-information about the installed software</Info><Product>Kernelblog</Product><Vendor>Ömer Hasan Durmuş</Vendor><Version>1.0</Version><ProductUrl>https://kernellbog.org</ProductUrl><VendorUrl>https://kernelblog.org/author/ruger/</VendorUrl></ProductSection><AnnotationSection><Info>A human-readable annotation</Info><Annotation>Vulnerable VM</Annotation></AnnotationSection><OperatingSystemSection ovf:id="94"><Info>The kind of installed guest operating system</Info><Description>Ubuntu_64</Description><vbox:OSType ovf:required="false">Ubuntu_64</vbox:OSType></OperatingSystemSection><VirtualHardwareSection><Info>Virtual hardware requirements for a virtual machine</Info><System><vssd:ElementName>Virtual Hardware Family</vssd:ElementName><vssd:InstanceID>0</vssd:InstanceID><vssd:VirtualSystemIdentifier>KB-VULN</vssd:VirtualSystemIdentifier><vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType></System><Item><rasd:Caption>2 virtual CPU</rasd:Caption><rasd:Description>Number of virtual CPUs</rasd:Description><rasd:ElementName>2 virtual CPU</rasd:ElementName><rasd:InstanceID>1</rasd:InstanceID><rasd:ResourceType>3</rasd:ResourceType><rasd:VirtualQuantity>2</rasd:VirtualQuantity></Item><Item><rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits><rasd:Caption>1024 MB of memory</rasd:Caption><rasd:Description>Memory Size</rasd:Description><rasd:ElementName>1024 MB of memory</rasd:ElementName><rasd:InstanceID>2</rasd:InstanceID><rasd:ResourceType>4</rasd:ResourceType><rasd:VirtualQuantity>1024</rasd:VirtualQuantity></Item><Item><rasd:Address>0</rasd:Address><rasd:Caption>ideController0</rasd:Caption><rasd:Description>IDE Controller</rasd:Description><rasd:ElementName>ideController0</rasd:ElementName><rasd:InstanceID>3</rasd:InstanceID><rasd:ResourceSubType>PIIX4</rasd:ResourceSubType><rasd:ResourceType>5</rasd:ResourceType></Item><Item><rasd:Address>1</rasd:Address><rasd:Caption>ideController1</rasd:Caption><rasd:Description>IDE Controller</rasd:Description><rasd:ElementName>ideController1</rasd:ElementName><rasd:InstanceID>4</rasd:InstanceID><rasd:ResourceSubType>PIIX4</rasd:ResourceSubType><rasd:ResourceType>5</rasd:ResourceType></Item><Item><rasd:Address>0</rasd:Address><rasd:Caption>sataController0</rasd:Caption><rasd:Description>SATA Controller</rasd:Description><rasd:ElementName>sataController0</rasd:ElementName><rasd:InstanceID>5</rasd:InstanceID><rasd:ResourceSubType>AHCI</rasd:ResourceSubType><rasd:ResourceType>20</rasd:ResourceType></Item><Item><rasd:Address>0</rasd:Address><rasd:Caption>usb</rasd:Caption><rasd:Description>USB Controller</rasd:Description><rasd:ElementName>usb</rasd:ElementName><rasd:InstanceID>6</rasd:InstanceID><rasd:ResourceType>23</rasd:ResourceType></Item><Item><rasd:AddressOnParent>0</rasd:AddressOnParent><rasd:Caption>disk1</rasd:Caption><rasd:Description>Disk Image</rasd:Description><rasd:ElementName>disk1</rasd:ElementName><rasd:HostResource>/disk/vmdisk1</rasd:HostResource><rasd:InstanceID>7</rasd:InstanceID><rasd:Parent>5</rasd:Parent><rasd:ResourceType>17</rasd:ResourceType></Item><Item><rasd:AutomaticAllocation>true</rasd:AutomaticAllocation><rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption><rasd:Connection>NAT</rasd:Connection><rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName><rasd:InstanceID>8</rasd:InstanceID><rasd:ResourceSubType>E1000</rasd:ResourceSubType><rasd:ResourceType>10</rasd:ResourceType></Item></VirtualHardwareSection><vbox:Machine ovf:required="false" version="1.16-linux" uuid="{df956da8-aa9d-426a-b33e-84917c66311d}" name="KB-VULN" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2020-08-22T18:00:58Z"><ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info><ExtraData><ExtraDataItem name="GUI/LastCloseAction" value="PowerOff"/><ExtraDataItem name="GUI/LastNormalWindowPosition" value="737,104,800,648"/></ExtraData><Hardware><CPU count="2"><PAE enabled="false"/><LongMode enabled="true"/><X2APIC enabled="true"/><HardwareVirtExLargePages enabled="false"/></CPU><Memory RAMSize="1024"/><HID Pointing="USBTablet"/><Boot><Order position="1" device="Floppy"/><Order position="2" device="DVD"/><Order position="3" device="HardDisk"/><Order position="4" device="Network"/></Boot><Display controller="VMSVGA" VRAMSize="16"/><VideoCapture screens="1" file="." fps="25"/><BIOS><IOAPIC enabled="true"/><SmbiosUuidLittleEndian enabled="true"/></BIOS><USB><Controllers><Controller name="OHCI" type="OHCI"/><Controller name="EHCI" type="EHCI"/></Controllers></USB><Network><Adapter slot="0" enabled="true" MACAddress="080027096BFC" promiscuousModePolicy="AllowAll" type="82540EM"><DisabledModes><BridgedInterface name="usb0"/><InternalNetwork name="intnet"/><NATNetwork name="NatNetwork"/></DisabledModes><NAT/></Adapter></Network><AudioAdapter codec="AD1980" driver="Pulse" enabledIn="false"/><RTC localOrUTC="UTC"/><Clipboard/><GuestProperties><GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1598119258376317000" flags=""/></GuestProperties></Hardware><StorageControllers><StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true"><AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/></StorageController><StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3"><AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0"><Image uuid="{935b12f8-e927-40a7-9fee-e00da57e8f42}"/></AttachedDevice></StorageController></StorageControllers></vbox:Machine></VirtualSystem>
</Envelope>
需要删除的地方是:
最末尾:
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0"><Image uuid="{935b12f8-e927-40a7-9fee-e00da57e8f42}"/></AttachedDevice>
把<Image uuid="{935b12f8-e927-40a7-9fee-e00da57e8f42}"/>这行删除.
开头的:
<DiskSection><Info>List of the virtual disks used in the package</Info><Disk ovf:capacity="21818433536" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="935b12f8-e927-40a7-9fee-e00da57e8f42"/></DiskSection>
把<Disk ovf:capacity="21818433536" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="935b12f8-e927-40a7-9fee-e00da57e8f42"/>这行删除.
最后是中间的,如下全删除(可以搜索/disk/vmdisk1):
<Item><rasd:AddressOnParent>0</rasd:AddressOnParent><rasd:Caption>disk1</rasd:Caption><rasd:Description>Disk Image</rasd:Description><rasd:ElementName>disk1</rasd:ElementName><rasd:HostResource>/disk/vmdisk1</rasd:HostResource><rasd:InstanceID>7</rasd:InstanceID><rasd:Parent>5</rasd:Parent><rasd:ResourceType>17</rasd:ResourceType></Item>
然后修改KB-VULN.mf里KB-VULN.ovf的hash值,需要你自己计算并填充:
SHA1 (KB-VULN-disk001.vmdk) = 3a33599cc0ef7f8f5d07623277c68b97d1ee1f17
SHA1 (KB-VULN.ovf) = 5843c3015832da8f9db2226e00921499a9b1d645
SHA1 (KB-VULN-disk001.vmdk)在这里貌似没啥意义,可以删除.
然后导入ovf(双击或拖拽)
接着添加IDE(建议)或SATA硬盘,然后开机就好了.
如果提示:
将现有虚拟磁盘转换为更新的格式?所选虚拟磁盘可以转换为 Workstation 16.2.x 虚拟机支持的最新格式。但是,转换后,虚拟磁盘将无法用于旧版虚拟机。
选择保持就好
参考资料:
VMware capacity mismatch for disk错误解决办法-CSDN博客