Pangram verdict · v3.3
We believe this text is mainly AI, with some human-written content.
AI likelihood · overall
AIArticle text · 1,275 words · 16 segments analyzed
Firecracker is supposed to keep untrusted code inside a microVM. We escaped it and achieved code execution as root on the host. We found how it saved registers, changed where it would resume, and made it execute a call of our choosing when it returned from KVM.
The guest then restored the temporary stack changes. Firecracker kept running, and the VM remained accessible over SSH.
PwnEscape Part 1 introduced the host memory primitive behind this work. Here we follow the next part of the chain: using that access to find Firecracker in memory and take over a live thread from inside the guest.
This is a continuation to show CVE-2026-99999 on a Firecracker setup.
00 / Choosing where to take control A Firecracker microVM has a process on the host that manages it.
Each virtual CPU, or vCPU, has a thread in that process. The thread enters KVM to run the guest and returns to Firecracker when an event needs handling in userspace. Firecracker documents this arrangement in its architecture overview. firecracker-host-integration-dbdde36ef234 The call that runs the virtual CPU looks like this: While the thread is in that system call, the host kernel holds its saved userspace registers in a structure called pt_regs. These registers describe the Firecracker thread: its instruction pointer says where execution should resume, and its stack pointer says which userspace stack it should use. That made the return from KVM_RUN an attractive target. If we could locate and modify the saved frame, we could choose the code Firecracker executed when the thread returned to userspace. A guest operation that caused such a return would provide the trigger. We already had access to selected host physical memory through a guest mapping. To use it, we needed to identify the Firecracker process, find code we could call in that process, and locate the register frame belonging to its active vCPU thread.
The starting point was a page of memory we controlled inside the guest.
01-guest-to-vmm-chain-5c0fbee0cb07 Figure 1.
The guest identifies its Firecracker process, finds the saved registers for a vCPU thread, and redirects the thread when it returns from KVM.
01 / Finding our guest page on the host The guest and host use different physical address spaces.
A page has a guest physical address, or GPA, inside the VM and a host physical address, or HPA, in the machine backing it. On the target, Extended Page Tables (EPT) provide the translation between them. We placed a recognizable byte pattern, a nonce, in a guest page. The first resolver took that page's known GPA and its contents as inputs. Together, they gave us an address to translate and a way to check whether the translation reached our page. The resolver searched the host physical ranges covered by the memory primitive for candidate EPT roots. An EPT root is the starting point of the translation tables. For each candidate, the resolver followed the entries selected by the guest address until it reached a physical page, then checked that page for the nonce. The snippets below are explanatory pseudocode with descriptive helper names. They show the data passed between stages and the checks used to connect them. The nonce check connected a proposed translation to memory we controlled. The broader search produced two candidates; validation of the nested page tables reduced them to one EPT root. Walking that root gave us the host physical address of our guest page. We called this result guest_page_hpa and passed it to the next resolver. We now had a recognizable object in host memory. The next task was finding the host process that mapped it. 02 / Finding the Firecracker process Firecracker maps memory used by the guest into its own address space. That mapping gave us a way to work backward from the guest page to the process. Host processes use page tables to translate their virtual addresses into physical memory. The top level is called the page global directory, or PGD. Recovering the appropriate PGD would let us translate addresses inside Firecracker and read its code and stack through the memory primitive. Our reverse mapper searched the native host page tables for a mapping of guest_page_hpa. A normal page table walk starts with a virtual address and produces a physical address. Here, we looked for a mapping to a physical page we already knew, then recovered the virtual address and page table root associated with it. The check runs in both directions: This connected the host process's virtual mapping to the physical page found through EPT. The reverse mapper returned one validated address space. We retained its root as host_pgd and used it to inspect the process. The next resolver looked for the Firecracker executable in those mappings. It identified an ELF image and checked a known byte sequence in Firecracker's write(2) wrapper. That connected the recovered address space to the binary we were targeting. ASLR changes where an executable is loaded. The difference between an address in the ELF image and its corresponding runtime address is the load bias. Once the mapper had identified the image, it could recover that bias and use it to locate the code required by the exploit: The mapper returned the load bias as firecracker_base. With that value and host_pgd, we could locate code in the running process, translate its virtual address to host physical memory, and compare the bytes there with the expected binary. We checked three locations: the write(2) wrapper that would produce our proof, the continuation after the KVM ioctl, and a short xor eax,eax; ret sequence needed to return cleanly. Their purposes become relevant when we construct the return path below. At this point, the guest could inspect the Firecracker image and its private mappings.
We still needed the saved registers of the thread currently running our VM.
02-address-resolution-0e47fd8bf102 Figure 2. The nonce identifies the guest page in host memory.
Its mapping leads to a host page table root, which lets the next resolver locate and validate the Firecracker image.
03 / Locating the live vCPU frame The frame finder took host_pgd and firecracker_base from the preceding stages. It used them to recognize the host thread's saved state. The most useful clue was the return address. A vCPU thread in KVM_RUN should have a saved instruction pointer at the corresponding ioctl continuation in Firecracker. We could calculate that address from the validated binary and its load bias. We then searched host memory for a pt_regs frame consistent with that call. An address match alone would also pick up stale stack contents, so the candidate had to satisfy several related checks: Saved stateWhat we checkedSystem callThe syscall identity and in-progress state matched an active ioctl.Request argumentThe ioctl request was KVM_RUN.File descriptorThe descriptor fell within the helper's expected range.Instruction pointerIt matched the validated Firecracker ioctl continuation.Stack pointerIt translated through the recovered host PGD.Segment selectors and flagsThey described a valid return to userspace.Caller return addressIt fell inside the validated Firecracker text mapping. The stack check tied the frame to the same address space we had recovered from the guest page. The instruction and caller addresses tied it to the Firecracker image. The syscall fields tied it to the operation running the vCPU. The search left one candidate. Its location was stored as frame_hpa, the host physical address of the saved register frame. We passed it, the PGD, and the load bias to the final helper. Before changing memory, the helper repeated the code signature, frame, and stack checks. This ensured that the active stage used the same process state the resolvers had identified. The subsequent execution and recovery checks would establish that the selected frame was live.
03-live-kvm-run-frame-ddb3ad26cf50 Figure 3.