Heartbleed‑like Out‑of‑Bound Read in libslirp (CVE‑2026‑9539) Exposes VM Network Buffers
What It Is — libslirp, the user‑mode networking library shipped with QEMU, contains an integer underflow in its TCP urgent‑pointer handling. The flaw lets an attacker trigger an out‑of‑bound read inside libslirp’s internal 128 KiB ring buffers, leaking the full contents of the receive buffer (including residual data from prior allocations) over the network. Because the bug occurs inside a custom allocator, it does not crash the process and evades detection by AddressSanitizer; only UndefinedBehaviorSanitizer or custom memory‑poisoning can reliably surface it. The issue was disclosed as CVE‑2026‑9539 by STAR Labs SG in May 2026 and affects any QEMU deployment that relies on libslirp’s default networking stack.
On 27 October 2026, security researcher Jérémy Marchand published a blog entry describing a new LibAFL‑Qemu fuzzer built to explore complex state machines through incremental snapshots. The post, filed under the “Fuzzing” category and tagged with “libslirp”, “CVE‑2026‑9539”, “TCP/IP” and “tool”, explains how the fuzzer was applied to libslirp’s TCP implementation during development and why the vulnerability CVE‑2026‑9539 escaped detection at the time.
CVE‑2026‑9539 affects libslirp, the user‑mode networking library that QEMU ships as its default network stack and that is also used by containers and other virtualization tools. The flaw, characterized as a “heartbleed‑like” out‑of‑bounds read, was discovered by Bruce Chen and Shi Weiming of STAR Labs SG Pte. Ltd and reported to the libslirp maintainers in May 2026. libslirp allocates two 128 KiB buffers for socket send and receive queues and walks them with ring‑buffer pointers. The code mistakenly validates the TCP urgent pointer against the size of an intermediate buffer rather than against the amount of valid data, causing an integer underflow in the sosendoob function. The underflow leads the library to read beyond the available data, repeatedly leaking the entire 128 KiB receive buffer—including remnants of previously freed memory—over multiple packets. Because the overflow stays within the ring‑buffer region, AddressSanitizer (ASAN) does not flag it as a classic out‑of‑bounds access.
The bug remained hidden for years because it does not crash the program and ASAN “is blind even if a fuzzer is able to reach it,” according to the author. Existing libslirp fuzzers, which are libFuzzer‑based and rely on a custom PCAP mutator, cannot open or connect sockets, and they bypass the socket layer by modifying source code, making the issue hard to surface. Detection can be achieved by compiling libslirp with UndefinedBehaviorSanitizer (UBSAN) enabled for integer‑overflow checks; recompiling with ‑fsanitize=unsigned-integer-overflow,signed-integer-overflow triggers a runtime error such as “unsigned integer overflow: 8 - 2048 cannot be represented in type ‘uint32_t’”. An alternative is to augment ASAN with manual poisoning of the entire ring‑buffer and unpoisoning only the regions the internal allocator marks as allocated, a technique supported by LibAFL‑Qemu’s ASAN API.
Marchand’s fuzzer leverages LibAFL‑Qemu’s snapshot capability to maintain state across multiple inputs, a necessity for exercising TCP’s multi‑step handshake. The implementation, released on Quarkslab’s GitHub, isolates target‑specific components to ease adaptation to other software. While the tool succeeded in reproducing CVE‑2026‑9539 once the appropriate detection mechanisms were added, the initial run missed the bug because the necessary sanitizers were not in place.
Multipart inputs, a refinement of the earlier technique, are now implemented directly in LibAFL, eliminating the need for a hand‑crafted mutator. This change also removes the remote chance that the fuzzer would accidentally emit the special delimiter separating the parts, although the broader “havoc” effect of random mutations remains a concern.
The newer workflow abandons the classic “start‑from‑scratch” model. Instead, a security analyst manually drives the target into a promising state, captures a snapshot, and then fuzzes that snapshot one input at a time. This isolates the fuzzing process and sidesteps many of the earlier pitfalls, though the ability to reach a complex state still hinges on how the analyst initially arrived there. A related tool, FitM (Fuzzer in the Middle), was designed for client‑server scenarios: it pretends to be one side of the protocol until the opposite side’s reply changes, at which point it snapshots the system and swaps roles. FitM relies on Qemu for emulation and CRIU for checkpointing, and its setup can be somewhat labor‑intensive.
The team’s own fuzzer draws inspiration from FitM, NyxNet and FTZ, but uses a different backend. Built on LibAFL‑Qemu’s user‑mode mode, it leverages the SnapshotModule and a custom SnapshotManager. By registering LibAFL‑Qemu hooks that watch for state‑machine transitions, the SnapshotManager records the internal structures of the SnapshotModule and can restore them on demand, enabling systematic exploration of the target’s state graph. LibAFL’s metadata framework ties each generated input to the snapshot it produced and preserves the full chain of snapshots, making reproducibility straightforward.
For the libslirp target the researchers employ a Rust‑based mutator called “lain” that restricts generation to TCP packets, preventing the fuzzer from wandering into unrelated code paths. Lain works by annotating Rust structs and mutating fields while respecting their types; the authors note that the newer Autarkie tool could replace lain, offering a grammar‑aware approach rather than a purely structure‑aware one. This “incremental snapshot fuzzer” therefore focuses on the TCP state machine without extraneous noise.
The snapshot routine itself records the current heap limit (brk) and the start of the mmap region, then iterates over Qemu’s entire memory map, capturing each region’s bounds, permissions and page contents into a SnapshotPageInfo structure. Write‑hooks flag dirty pages, while pre‑ and post‑syscall hooks monitor memory‑affecting calls such as mmap, munmap, mprotect, brk and read. During a reset, the module reverses any heap size changes, restores dirty pages, re‑creates or removes mappings as needed, and reapplies original permissions via mprotect. The SnapshotManager, which replaces the default NopSnapshotManager, implements the IsSnapshotManager trait with save, restore and a no‑op do_check function. Its save routine triggers on TCP‑state changes, hashes the state together with answer‑packet flags to avoid duplicate snapshots, and stores a diff against the parent snapshot in a HashMap that tracks the restoration chain. The restore path walks this chain, copies the saved SnapshotModule state back, and invokes the reset logic. To monitor libslirp’s connection state, the harness hooks the memory region holding the tcpcb structure’s t_state field, uses write‑hooks to flag changes, and employs pre‑syscall hooks on socket and fcntl calls as well as instruction hooks to bypass checksum verification, feeding this information to an ObserverModule that annotates each testcase with snapshot metadata.
The harness is written so that LibAFL‑Qemu passes the fuzzer’s current state as a parameter, allowing the harness to pull the active testcase and any attached metadata. This metadata feeds the SnapshotManager, which writes everything needed to recreate a particular testcase to disk. When a snapshot is created, its identifier (SnapshotId) is stored in the new testcase’s metadata; later, when the testcase is selected for mutation, the harness reads that metadata and restores the snapshot linked to the stored SnapshotId. The raw bytes transmitted are also saved under the key gen_bytes together with the SnapshotId, making it possible to reconstruct the full input chain that led to any given testcase.
Several design and tooling constraints limit the approach. QASAN cannot operate with multiple snapshots, and the fuzzer—built on LibAFL 0.15.4—often aborts if the target or Qemu crashes, taking the fuzzer down with it. LibAFL‑Qemu lacks a complete restore capability, preventing parallel snapshot trees, and each new snapshot is tied to the testcase that produced it, which reduces input diversity. The snapshots consume substantial memory, so deduplication is critical, and testcases cannot be shared between fuzzer instances because metadata (including SnapshotId) does not travel with them. The only way to keep a single initial corpus entry is to snapshot before the fuzzing loop starts, forcing all later snapshots to descend from that root. Optimising snapshot storage would require changes to the SnapshotModule, which have not yet been implemented. Although the EventManager could theoretically propagate metadata across instances, the effort was deemed unlikely to outweigh the benefit.
To work around the incompatibility of some instrumentation with the snapshot mechanism, the team added an external monitor called Notify that watches for new testcases written to disk. When a fresh testcase appears, Notify parses its metadata to locate the associated snapshot, its parent snapshot, the gen_bytes payload, and other relevant fields. By maintaining a hash map of these relationships, the tool can rebuild the entire input lineage, then launch a fresh process that runs a full fuzzer equipped with both the AsanHostModule and the DrCovModule. This process evaluates the input chain under ASAN, gathers coverage in DrCov format, and makes the results ready for import into bncov. Because the pre‑execution and post‑execution hooks are only triggered by a full fuzzer run, the design deliberately calls fuzzer.evaluate_input instead of a direct qemu.run.
The fuzzer targeting the libslirp library is publicly available on Quarkslab’s GitHub, where the README details how to check out the exact libslirp commit, apply a patch that builds the target binary and suppresses false‑positive integer‑overflow warnings for sequence and acknowledgment numbers, and then start the fuzzing campaign. The repository’s source tree is organised into clearly named modules such as libslirp::utils::setup_target_arguments, network_targets_utils::mutator.rs, and snapshot_manager.rs. A demonstration video shows the fuzzer exercising an unpatched libslirp compiled with UBSAN configured to trap on signed and unsigned integer overflows while ignoring the seq/ack wrap‑around cases. When UBSAN detects an overflow, it triggers an illegal‑instruction (UD) exception, causing Qemu to crash within seconds; the crash is compounded by known signal‑handling quirks in the LibAFL‑Qemu version used. Because the crash aborts both Qemu and the fuzzer, the exact state at the moment of failure is not captured, so the authors advise reproducing the scenario in a minimal‑runtime mode and manually confirming the illegal instruction corresponds to CVE‑2026‑9539.
The project was completed without the aid of artificial‑intelligence tools. The author thanked colleagues Laurent Laubin, Chris, and Célian for their assistance and feedback throughout the development.
The author expressed gratitude to Addison Crump, noting that Crump’s “parking game” fuzzer served as an engaging entry point for implementing custom feedback mechanisms and metadata within the LibAFL framework.
Thanks were also extended to Toka for contributions to LibAFL‑Qemu, and to Romain Malmain, whose work on the same project and willingness to answer early‑stage questions helped the author get started with LibAFL‑Qemu experimentation.
Finally, Samuel Thibault, a maintainer of libslirp, was acknowledged for supervising the author’s first attempt at fuzzing a real target back in 2020. The author invites anyone interested in learning more about their security audits or seeking assistance to get in touch.
Affected Products — libslirp (used by QEMU, containers, and various VM tools) versions prior to the May 2026 patch.
Why It Matters for Trust & Control Assurance — The vulnerability highlights the need for robust secure‑development testing and continuous evidence of memory‑safety controls, a core control objective that maps to multiple frameworks (e.g., NIST CSF 2.0).
Recommended Actions —
- Upgrade libslirp to the patched version released after CVE‑2026‑9539.
- Re‑compile libslirp with UBSAN ( ‑fsanitize=unsigned-integer-overflow,signed-integer-overflow ) to detect similar underflows during development.
- Integrate snapshot‑based fuzzing (e.g., LibAFL‑Qemu) into your CI pipeline to exercise state‑machine transitions that traditional fuzzers miss.
- Where source recompilation is not possible, apply ASAN memory‑poisoning around the ring‑buffer region to catch out‑of‑bound reads at runtime.
Source: Quarkslab Blog – Snapshotting our way to CVE‑2026‑9539