Post

QEMU Runtime SMBIOS Patching

QEMU Runtime SMBIOS Patching

I have created a custom QEMU fork that supports runtime SMBIOS patching using command-line arguments. This allows you to modify the SMBIOS information of a your virtual machine before it boots up. This was based on my previous SMBIOS patcher tool, but now integrated directly into QEMU for easier use.

Why Runtime SMBIOS Patching?

SMBIOS patching is useful for scenarios where you need to change the system information of a virtual machine while using SMBIOS blobs, such as for testing software that relies on specific hardware identifiers or for evading anti-VM detection mechanisms.

Features

  • Modify SMBIOS fields such as Manufacturer, Product Name, Serial Number, UUID, etc.
  • Compatible with existing QEMU command-line options and libvirt XML configurations

How to Use

  1. Clone the custom QEMU repository:
    1
    2
    
    git clone --recursive https://github.com/t4bby/qemu
    cd qemu
    
  2. Apply any necessary patches and build QEMU:
    1
    2
    3
    
    ./configure --enable-kvm --target-list=x86_64-softmmu
    cd build
    ninja qemu-system-x86_64
    
  3. Start your VM with the custom QEMU binary and the desired SMBIOS file.

If using Libvirt, add the following to your domain XML:

1
2
3
4
5
6
<qemu:commandline>
    <qemu:arg value="-smbios"/>
    <qemu:arg value="file=/path/to/your/smbios.bin"/>
    <qemu:arg value="-smbios"/>
    <qemu:arg value="type=1,manufacturer=CustomManufacturer,product=CustomProduct,version=1.0,serial=1234567890,uuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx "/>
</qemu:commandline>

This will load the specified SMBIOS file and apply the runtime patches in the binary.

Supported Tables

The following SMBIOS tables can be modified live:

  • Type 0: BIOS Information
  • Type 1: System Information
  • Type 2: Baseboard Information
  • Type 3: Chassis Information
  • Type 17: Memory Device Information

Notes

This feature is experimental and may not cover all SMBIOS types or fields. Always test thoroughly to ensure compatibility with your specific use case. This only does binary patching, so make sure your SMBIOS file is valid before using it.

This post is licensed under CC BY 4.0 by the author.

Trending Tags