Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2020-25637-libvirt-double-free — Double Free | Kitploit
Tools/GitHubGitHub/brahmiboudjema/cve-2020-25637-libvirt-double-free
Vulnerability AnalysisExploitationDebuggersLearning & EducationBinary ExploitationLabs & Practice
GitHubbrahmiboudjema/cve-2020-25637-libvirt-double-free

CVE-2020-25637-libvirt-double-free

Double Free

View Repository
55 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

root@kitploit:~
 CVE-2020-25637 
                                    

root@kitploit:~
*** Description ***

A double-free issue occurred in the libvirt API, in versions prior to version 6.8.0, responsible for requesting information about the network interfaces of a running QEMU domain. This flaw affects the polkit access control driver. Specifically, clients connecting to the read-write socket with limited ACL permissions could use this flaw to crash the libvirt daemon, resulting in a denial of service, or potentially escalate their privileges on the system. The greatest threat of this vulnerability is to data confidentiality and integrity as well as system availability.

The most significant threat of this vulnerability concerns:

  • Confidentiality
  • Data integrity
  • System availability

The scores of the flaw:

  • A moderate flaw by RedHat with an average score of 6.4

    • Vector = Local
    • Complexity = Low
    • Authentication = None
  • A moderate flaw by NVD with an average score of 6.7

    • Vector = Local
    • Complexity = High
    • Authentication = None

root@kitploit:~
*** Different tools and important prerequisites to exploit this vulnerability ***
    

  1. Installation of qemu-kvm and libvirt :

First of all, it is necessary to check the compatibility of our operating system, simply run this command:

root@kitploit:~
 grep -E -c "vmx|svm" /proc/cpuinfo

If the command returns ok you can proceed with the installation:

root@kitploit:~
sudo apt-get -y install qemu-kvm libvirt-bin virt-top libguestfs-tools virtinst bridge-utils

2) Installation of vagrant :

To install vagrant simply run this command:

root@kitploit:~
sudo apt -y install vagrant

Once you have installed Vagrant and KVM, you should be ready to install a libvirt plugin to start managing KVM virtual machines using Vagrant.

root@kitploit:~
vagrant plugin install vagrant-libvirt

You can confirm that the plugin was installed

root@kitploit:~
vagrant plugin list

3) Vagrant box :

It is possible to use a ready-made template directly from Vagrant; in our case we will use an Ubuntu 20.04 image.

To add our image to the vagrant box simply run this command:

root@kitploit:~
vagrant box add generic/ubuntu1804 --provider libvirt

To list the boxes present locally:

root@kitploit:~
vagrant box list

4) Debugging

Two debugging options:

  • GDB, If the tool is not available on your operating system run this command:

    root@kitploit:~
    sudo apt-get install gdb
    
  • Valgrind, If the tool is not available on your operating system run this command:

    root@kitploit:~
    sudo apt-get install valgrind
    

root@kitploit:~
*** Code execution ***

Launch a vm via vagrant:

root@kitploit:~
vagrant up

First install the library:

root@kitploit:~
sudo apt-get install -y libvirt-dev

Compilation:

root@kitploit:~
gcc -g -Wall info1.c -o info1 -lvirt

Code execution:

root@kitploit:~
./info1 qemu:///system vagrant-vms_ubuntu-01

Execution with debugging:

root@kitploit:~
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./info1 qemu:///system vagrant-vms_ubuntu-01

root@kitploit:~
*** Activate the vulnerability ***

Before activating the vulnerability, understanding how the problematic function in libvirt works is essential.

Assume that an attacker can cause the use of a freed memory area via qemuAgentGetInterfaces() in libvirt, precisely in the memory area of the ifname variable, in order to cause a denial of service, and possibly execute code.

  • This function processes a list of interfaces of a running domain with their IP and MAC addresses.
  • Then it returns the number of interfaces on success, otherwise -1 on error.

The expected moment has arrived.

Once the vagrant file is launched, the code info1.c must be run in a virtual machine itself launched by Qemu/KVM. So, create VMs inside a VM, i.e., execute the code in the VM created by vagrant.


root@kitploit:~
*** Fix for this vulnerability ***

Simply set the ifname variable to null in the qemuAgentGetInterfaces() function of libvirt; that is, ifname should be freed for each interface.


root@kitploit:~
*** Demonstration ***

You will find a simple demonstration of the problem (double free) in the PowerPoint file.


root@kitploit:~
*** Important ***

The project is not completed to the end due to reasons of the vulnerability's complexity and hardware, as well as lack of time.

Download Tool