IntelLabs / kafl.targets

Target components for kAFL/Nyx Fuzzer
Other
26 stars 25 forks source link

Running the example windows_x64_x86 example error #44

Open 0xDivyanshu-new opened 3 weeks ago

0xDivyanshu-new commented 3 weeks ago

Hi team,

I am currently trying to get the snapshot by importing the vm into libvrt as defined in the docs mentioned here.

vagrant up --no-provision
Bringing machine 'vagrant-kafl-windows' up with 'libvirt' provider...
==> vagrant-kafl-windows: No version detected for kafl_windows, using timestamp to watch for modifications. Consider
==> vagrant-kafl-windows: generating a local metadata for the box with a version to allow better handling.
==> vagrant-kafl-windows: See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.
==> vagrant-kafl-windows: Creating image (snapshot of base box volume).
==> vagrant-kafl-windows: Creating domain with the following settings...
==> vagrant-kafl-windows:  -- Name:              windows_x86_64_vagrant-kafl-windows
==> vagrant-kafl-windows:  -- Description:       Source: /home/XXX/Research/Windows/Fuzzing/kafl.targets/windows_x86_64/Vagrantfile
==> vagrant-kafl-windows:  -- Domain type:       kvm
==> vagrant-kafl-windows:  -- Cpus:              4
==> vagrant-kafl-windows:  -- CPU topology:      sockets=1, cores=4, threads=1
==> vagrant-kafl-windows:  -- Feature:           acpi
==> vagrant-kafl-windows:  -- Feature:           apic
==> vagrant-kafl-windows:  -- Feature:           pae
==> vagrant-kafl-windows:  -- Clock offset:      utc
==> vagrant-kafl-windows:  -- Memory:            4096M
==> vagrant-kafl-windows:  -- Base box:          kafl_windows
==> vagrant-kafl-windows:  -- Storage pool:      default
==> vagrant-kafl-windows:  -- Image(vda):        /home/XXX/.local/share/libvirt/images/windows_x86_64_vagrant-kafl-windows.img, ide, 64G
==> vagrant-kafl-windows:  -- Disk driver opts:  cache='default'
==> vagrant-kafl-windows:  -- Graphics Type:     spice
==> vagrant-kafl-windows:  -- Graphics Websocket: 
==> vagrant-kafl-windows:  -- Graphics Port:     
==> vagrant-kafl-windows:  -- Graphics IP:       
==> vagrant-kafl-windows:  -- Graphics Password: Not defined
==> vagrant-kafl-windows:  -- Video Type:        cirrus
==> vagrant-kafl-windows:  -- Video VRAM:        16384
==> vagrant-kafl-windows:  -- Video 3D accel:    false
==> vagrant-kafl-windows:  -- Keymap:            en-us
==> vagrant-kafl-windows:  -- TPM Backend:       passthrough
==> vagrant-kafl-windows:  -- INPUT:             type=mouse, bus=ps2
==> vagrant-kafl-windows:  -- CHANNEL:             type=spicevmc, mode=
==> vagrant-kafl-windows:  -- CHANNEL:             target_type=virtio, target_name=com.redhat.spice.0
Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: internal error: Failed to start QEMU binary /usr/local/bin/qemu-system-x86_64 for probing: 
make: *** [Makefile:13: init] Error 1
❯ vim Vagrantfile

I am not really quite sure on what is the exact issue here. Before that i was getting permission denied issues but those got fixed by fixing the apparmor.

I was able to create the box and it was added to vagrant

❯ vagrant box list
kafl_windows (libvirt, 0)

I also ran the vagrant up command with debug flag but there is literally no message that says what exactly went wrong that failed virDomainDefineXML. This is the error snippet when running with debug flag

ERROR warden: Error occurred: Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: internal error: Failed to start QEMU binary /usr/local/bin/qemu-system-x86_64 for probing: 
 INFO warden: Beginning recovery process...
 INFO warden: Calling recover: #<VagrantPlugins::ProviderLibvirt::Action::CleanupOnFailure:0x00007f390df7a510>
Wenzel commented 3 weeks ago

Hi !

I've never seen this error before. Also you altready toggled the debug output (which is great), but doesn't give us much information. _"Failed to start QEMU binary /usr/local/bin/qemu-system-x8664 for probing"

Can you try posting it on the https://github.com/vagrant-libvirt/vagrant-libvirt project ?

Side note: what was the last time you successfuly built the Windows template ? I tried it on Monday, and it breaks when reaching the VSIX extension setup.

I didn't manage to fix it yet, so I can't test vagrant provisioning again for the moment.

0xDivyanshu-new commented 3 weeks ago

Hi @Wenzel ,

Thanks for the response. So i tried 2 things basically.

After removing the VSIX extension line, i was facing the main error that i just shared here in the issue.

After doing that, I started facing issues with the OS installation part itself which is way before the execution of playbook commands inside VM.

I think the 2nd approach is the right once since we are supposed to use the qemu that was build with kafl support rather than using the hashicorp's default qemu plugin.

Would love to know your inputs on this!

Thanks