SecPod

Learn Search

Search across all Learn content

← Back to Expressions & POVs
QEMU, bringing the guest closer to the host

QEMU, bringing the guest closer to the host

Aug 27, 2019By Vidita V Koushik4 min read

Quick Emulator (or QEMU) is a cross-platform open-source emulator that performs hardware virtualization. QEMU is a free alternative to VMware. Xen, VirtualBox, KVM uses it and is available for most Linux distributions. Vishnu Dev, a security researcher, discovered that an attacker can break out of a guest operating system and attack the host operating system. QEMU Exploit vulnerability leads to a heap-based buffer overflow or arbitrary code execution and identifies with CVE-2019-14378. The researcher explains that this flaw is due to pointer miscalculation in-network backend of QEMU. Moreover, using a vulnerability management tool stops this vulnerability.

QEMU creates a SLiRP user network backend by default. Triggers the bug when large ipv4 packets reassembles for processing in SLiRP. However, patching this vulnerability with a patch management software can be very helpful.

Firtstly, there are two buffers allocated for IP fragments : m_dat and m_ext in mbuf . m_ext is used when m_dat is insufficient to hold the incoming packets. m_ext is allocated on the heap. Secondly, when a large fragmented packet arrives and space inside m_dat is not sufficient, then the m_ext is allocated.

  fig1. Allocation of buffers

But, the code does not handle the case when the very first fragmented packet is large and is allocated the m_ext buffer. The code assumes that the packets are present in m_dat . However, this leads to a miscalculation in the value of the pointer.

Uses the newly obtained value of the pointer in further calculations and modified, which now points to a wrong location. Moreover, attackers can use the values of ip_src and ip_dst  to write controlled data onto the calculated location. If the calculated values point to an unmapped location, QEMU crashes.

fig2. Calculation of delta with the assumption that packets are present in m_dat

QEMU Exploit:

The researcher explains that certain conditions met is to achieve arbitrary code execution,

  • Requires precise control over the heap to write controlled data relative to m->m_ext
  • Bypassing of ASLR and PIE requires leaks
  • The available function pointers do not support code execution. Hence uses arbitrary write.

When a new packet arrives, mbuf the object is allocated to store the packets until all the fragments have arrived. When all the packets have arrived, they are concatenated to one mbuf object. However, the attacker tries to spray the heap to increase chances of exploitation by using this mechanism.

Now an attacker tries arbitrary write in 4 steps:

  • Send a packet with id 0xdead and MF bit set (1)
  • Send a packet with id 0xcafe and MF bit set (1)
  • The m_len(amount of data in the buffer) of 0xcafe is overwritten to point to 0xdead‘s m_data
  • Trigger the reassembly by sending packet with id 0xcafe and MF bit set (0). This overwrites 0xdead‘s m_data with target address.
  • Send packet with id 0xdead and MF bit unset(0) to trigger the reassembly. This writes the required content to m_data.

Exploitation:

Before code execution, we have to bypass security implementations such as ASLR(Address Space Layout Randomization) and PIE(Proportional Integral controller Enhanced). SLiRP gateway responds to ICMP echo requests which bring back the data(payload) to the guest. Fake ICMP requests are sent to the host to receive the leaks from the host. Moreover, the ICMP header creates an arbitrary write, and the request sends it with the MF bit set (1). m_data overwrites to point to a fake title on heap. And, a packet with MF bit set(0)sent to end the ICMP request. However, we can achieve code execution using a fake QEMUTimer.

A QEMU developer has confirmed that this is not a host ring-0 exploit. However, as most production VM environments use tap networking and not SLiRP, this CVE would not be applicable to them. He also added that getting the root would require further attack to elevate privileges and escape SELinux confinement.

Affected Product in QEMU Exploit

QEMU with libslirp library version 4.0.0 on all platforms.

Impact

Successful exploitation of this vulnerability leads to denial of service or arbitrary code execution.

Solution

QEMU has released updates for all platforms. Please refer to this KB Article to patch using SecPod SanerNow.

Featured Posts

Open What Is a Kubernetes Network Policy?
What Is a Kubernetes Network Policy?

Point of View

What Is a Kubernetes Network Policy?

A Kubernetes network policy controls incoming and outgoing connections between Pods and other network destinations. The article explains how ingress and egress rules work, why default network access can create security risks, and how to configure and verify traffic restrictions. It also covers common policy mistakes and how Saner COSP's COAE and COPM modules support Kubernetes exposure visibility and configuration assessment.

Oct 16, 2026

Open Hybrid Cloud Security for Kubernetes Across Standalone, On-Prem, and Managed Clusters
Hybrid Cloud Security for Kubernetes Across Standalone, On-Prem, and Managed Clusters

Point of View

Hybrid Cloud Security for Kubernetes Across Standalone, On-Prem, and Managed Clusters

Hybrid cloud security for Kubernetes involves managing security risks across standalone, on-premises, and managed clusters. The blog explains the differences between Amazon EKS, Microsoft AKS, and Google GKE, common security challenges, and practical steps for maintaining consistent security controls. It also covers how Saner COSP helps teams assess configurations, manage access, prioritize risks, and track remediation across Kubernetes environments.

Oct 16, 2026

Open Excellence Is a Choice
Excellence Is a Choice

Point of View

Excellence Is a Choice

Oct 14, 2026

Open AWS Security Best Practices for Financial Services: Beyond Configuration Management
AWS_Security_Best_Practices_For_Financial_Services

Point of View

AWS Security Best Practices for Financial Services: Beyond Configuration Management

Oct 13, 2026