Compromised content process can use PWebGPU even when WebGPU is disabled
A compromised Firefox content process can reuse a retired WebGPU device ID to make the browser process call a stale Vulkan device handle, giving a child-controlled indirect branch and an 8-byte write in the parent. The proof stops at that primitive and does not claim a full sandbox escape.
Originally disclosed on Mozilla
- Fixed in 19 days
- Paid in 2 months
- Disclosed after 19 days
Created attachment 9620901 poc.html
Overview
This defect has credible sandbox-escape potential: attacker-controlled content-process IPC crosses into the browser process and establishes native control-flow and write primitives that could form an exploitation stage toward arbitrary parent-process code execution. The attached proof deliberately stops at the demonstrated primitive and does not claim a completed sandbox escape; its current constraints and the evidence still needed for such a chain are stated below.
A compromised Firefox content process can use its existing PWebGPUChild actor to make a browser-owned Linux DMA-BUF wrapper outlive the WebGPU device that created its native Vulkan handles. The child then registers a different device under the exact same raw (index, epoch) DeviceId. Delayed wrapper destruction checks only whether that number is active, resolves the replacement device's dispatch table, and passes it the original device's expired VkDevice, VkImage, and VkDeviceMemory.
On the tested official stock Linux Nightly binary with an empty profile and shipped Firefox defaults, PWebGPU is managed by PCanvasManager, the GPU process is disabled by default, and the server-side operation runs in the browser process on CanvasRenderer. The canonical headless run selected Lavapipe.
The attached reproducer demonstrates more than a stale-handle crash:
- A parent Rust
Stringmade from child-supplied serialized bytes reclaims the address of the destroyed LavapipeVkDeviceallocation. - Bytes at stale-device offsets
+0x40and+0x58become, respectively, a selected writable parent address and a selected executable parent address. - Lavapipe loads those qwords into
RDIandRAXand performs its indirect transfer throughRAX. - The selected target is an existing instruction-boundary
mov qword ptr [rdi], rax; retsequence. GDB allows only themovto execute, verifies that the selected destination changes from zero to the exactRAXvalue, and stops at the followingret.
This establishes a child-controlled parent-process indirect branch and an exact 8-byte write at a location authored in child IPC (debugger-selected in this proof). The written value is constrained to the selected branch target itself. GDB supplies the ASLR-dependent addresses, so this report does not claim an address disclosure, arbitrary-value write, general read/write, a reusable or multi-write primitive, or arbitrary browser-process code execution.
The threat model is a compromised content process with direct control of messages on its permitted actor. poc.html is a deterministic object/message/allocation generator; poc.gdb models the compromised child at the generated IPC send boundary. This is not an ordinary-web-page-only trigger.
Build / Environment
- Ubuntu 24.04 x86-64; Linux
6.8.0-136-generic. - Official optimized Firefox Nightly
155.0a1, BuildID20260802092052, SourceStamp [dbcce8eaeb9eb5d18aaea855283b74a04a354bdf] - Mesa package:
mesa-vulkan-drivers 25.2.8-0ubuntu0.24.04.2. - Lavapipe ELF Build ID:
b3153515a43f939343703de2a1c99c5f9c55f3db. - GDB
15.1.
The canonical validation used --headless and a newly created empty profile: no user.js, about:config, WebGPU, external-texture, GPU-process, sandbox, or process-model override. The log records the browser command line/profile checks and observes the sending content process with Seccomp: 2 and NoNewPrivs: 1.
Relevant shipped Linux desktop defaults are:
layers.gpu-process.enabled = falseanddom.webgpu.allow-in-parent = true, placing this compositor endpoint in the browser process in the tested Linux binary compiled with X11 support.dom.webgpu.external-texture.enabled = false, with the runtime gfx feature also disabled. The parent receiver does not repeat that authorization check. The harness bypasses only the content process's local binding/native gate, restores its gfx byte at the return boundary, and recordsparent_allow_default=0in the separate browser mapping.
The harness directly writes only child-process state and outgoing child IPC bytes to model a compromised content process. It does not directly write a browser WebGPU registry, native handle, lifecycle state, reclaimed control allocation, or tested destination. Browser breakpoints observe or stop execution; ordinary software-breakpoint instrumentation still transiently patches executable bytes. The one tested parent data write is performed by the native mov instruction itself.
The controlled sink is version-specific to the listed Lavapipe build. The Firefox lifetime/identity defect is above the driver, but another Vulkan implementation will have different consequences and requires different native breakpoints.
Steps To Reproduce
Use the exact Firefox and Mesa builds above because poc.gdb contains optimized-binary and Lavapipe offsets for them.
-
Put
poc.htmlandpoc.gdbin one directory. From that directory, serve the page over localhost in a separate terminal:Shell python3 -m http.server 8000 --bind 127.0.0.1 -
Ensure Lavapipe is the selected Vulkan ICD. It was selected normally on the validation host. On a multi-ICD host, the following optional environment prefix pins the tested driver without changing Firefox preferences:
Shell export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.json -
Run the reproducer from the attachment directory. Each attempt uses a fresh empty profile:
Shell FIREFOX_DIR=/path/to/extracted/firefox verified=0 for attempt in $(seq 1 64); do REPRO_PROFILE=$(mktemp -d /tmp/firefox-webgpu-repro.XXXXXX) rm -f reproduction.log timeout --signal=INT --kill-after=15s 10m \ gdb -q -batch -x ./poc.gdb \ --args "$FIREFOX_DIR/firefox" \ --headless --no-remote --profile "$REPRO_PROFILE" \ http://127.0.0.1:8000/poc.html || true if grep -q '^VALIDATION_SUCCESS controlled_parent_write=1 exact_pc=1 exact_rdi=1 exact_value=1 stop_before_ret=1$' \ reproduction.log 2>/dev/null && \ grep -q '^AUDIT_RESULT retry=0 failed=0 verified=1$' reproduction.log 2>/dev/null; then echo "Verified on attempt $attempt" verified=1 break fi if grep -q '^WRITE_SELECTION_RETRY' reproduction.log 2>/dev/null && \ ! grep -q '^AUDIT_RESULT .*failed=1' reproduction.log 2>/dev/null; then echo "Retrying after an unsuitable ASLR layout (attempt $attempt)" continue fi if grep -Eq '^STAGE[12]_CONTROL_NOT_RECLAIMED$' reproduction.log 2>/dev/null && \ grep -q '^AUDIT_RESULT retry=1 failed=0 verified=0$' reproduction.log 2>/dev/null; then echo "Retrying after an unsuitable ASLR or allocator layout (attempt $attempt)" continue fi echo 'Unexpected failure; inspect reproduction.log.' break done test "$verified" -eq 1The carrier is a Rust UTF-8 string, so both chosen pointers must have valid little-endian UTF-8 bytes. An unsuitable normal-ASLR layout exits immediately with
WRITE_SELECTION_RETRY. A valid address layout can still miss the allocator placement and emitSTAGE1_CONTROL_NOT_RECLAIMEDorSTAGE2_CONTROL_NOT_RECLAIMED. The loop retries only those recognized layout misses; any other incomplete run stops for inspection. Two independently verified loader zero-fill tails are considered to reduce ASLR retries. -
Do not continue after the final stop. The harness executes exactly the selected
movand stops at its followingret. Success requires all of these markers inreproduction.log:Text BROWSER_BASELINE ... verified=1 ... ATTACHMENT_HASHES poc_gdb_sha256=... poc_html_sha256=... CHILD_SANDBOX_STATE ... separate_pid=1 pwebgpu_child_send_site=1 seccomp=2 no_new_privs=1 observed=1 PARENT_SOURCE_RECEIVER ... exact_ids=1 parent_allow_default=0 parent_observational=1 PARENT_READONLY_CONTROL_RECEIPT labels=24 slots=120 slots_per_label=5 ... exact=1 ... VK_DEVICE_DESTROY #1 ... exact_stage=1 REQUEST_REUSED rawD=... rawQ=... exact=1 STAGE1_CONTROL_CONFIRMED ... VK_DEVICE_CREATE_RETURN ... distinct=1 DEVICE_REGISTRATION #3 rawD=... vkDeviceDestroys=1 REPLACEMENT_REGISTRATION_CONFIRMED ... native_distinct=1 STAGE2_CONTROL_CONFIRMED ... VKIMAGE_DESTROY_PROVENANCE exact=1 DESTROY_IMAGE_INDIRECT ... exact_lvp_target=1 ... equals_old=1 ... replacement_distinct=1 LVP_LOAD_PROVENANCE pc_exact=1 r13_exact=1 r12_null=1 ... exact_tail=1 prefix_exact=1 ... LVP_FREE2_CONTROL ... rdi_matches=1 rax_matches=1 exact_rdi=1 exact_gadget=1 LVP_FREE2_PROVENANCE pc_exact=1 control_exact=1 ... load_verified=1 exact_jump=1 prefix_exact=1 mode=1 SAFE_WRITE_ENTRY ... exact_pc=1 rdi_exact=1 value_exact=1 pre=0000000000000000 SAFE_WRITE_POST ... opcode=c3 ... exact_write=1 rax_exact=1 ... stop_before_ret=1 VALIDATION_SUCCESS ... AUDIT_RESULT retry=0 failed=0 verified=1 -
Compare the result with
validation.log, the canonical empty-profile run made from the included inputs.
Actual Results
The canonical validation.log records:
- The logged command line/profile checks show no
user.js, preference CLI override, or content-sandbox-disable environment variable; the sending content PID is observed in seccomp filter mode withNoNewPrivs: 1. - A content PID sends
D/Q/E/T/V = 0x100000000; the separate browser PID receives those exact values whileparent_allow_default=0. - The browser validates all 24 labels and all 120 candidate slots containing the selected
pUserDataandpfnFreeqwords in child-originated serialized bytes before processing them. vkDestroyDevicedestroys the original native device. Before replacement device creation, the exact old device address begins with the known string marker and contains the selected qwords at+0x40and+0x58(STAGE1_CONTROL_CONFIRMED).- The parent accepts the exact old raw
DeviceIdagain, but the replacementVkDeviceis distinct. - The retained string and selected qwords remain at the old allocation through wrapper removal (
STAGE2_CONTROL_CONFIRMED). wgpu_vkimage_destroyresolves the replacement dispatch but supplies the oldVkDevice;DESTROY_IMAGE_INDIRECTreportsequals_old=1.- Lavapipe loads stale
+0x40intoRDIand stale+0x58intoRAX; every slot/register equality check is1. - At the selected executable address, GDB verifies bytes
48 89 07 c3(mov [rdi], rax; ret). The selected writable destination is initially zero. After one instruction it equals the exact little-endianRAX/target pointer, and execution is stopped at opcodec3beforeret.
No warning, signal, assertion, *_MISMATCH, *_NOT_RECLAIMED, or unexpected-error marker appears in the canonical log. It ends with AUDIT_RESULT retry=0 failed=0 verified=1.
Expected Results
- A retired device incarnation must not become live merely because an untrusted child reuses its numeric
(index, epoch)ID. - External-source teardown must not drop a newer Rust texture incarnation while leaving a C++ wrapper for an older incarnation under the same raw texture ID.
- A delayed native wrapper must destroy handles through their original owning device/dispatch object, or be invalidated and removed before that owner expires.
- The parent must enforce external-texture and shared-swap-chain authorization/capability instead of relying on child-side gates and child-supplied booleans.
Security Impact
Starting from a compromised content process, this crosses the content-to-parent IPC boundary and reaches browser-process native teardown on the tested official stock Linux Nightly with shipped Firefox defaults. It demonstrates both a child-authored parent indirect branch and an exact 8-byte write at a child-authored writable parent address; the concrete ASLR-dependent addresses are debugger-selected in this proof.
The current proof is deliberately bounded. The value written is constrained to the selected branch target (RAX == pfnFree == gadget address); pointer bytes must survive the UTF-8 carrier; and GDB supplies the parent mappings. The proof stops after the first write and before ret. It does not establish a standalone ASLR bypass, arbitrary-value write, memory disclosure, general read/write, safe continuation into the later vkFreeMemory, a reusable or multi-write primitive, or arbitrary parent code execution.
This is therefore a strong browser-process memory-corruption/control primitive that can contribute to a sandbox-escape chain, not a claimed complete sandbox escape.
Attachments
poc.htmldeterministic WebGPU object/message/allocation generator.poc.gdbexact-build compromised-child mutation plus browser-side observation and one-instruction validation.validation.logcanonical stock-Nightly, empty-profile transcript.root_cause.mdline-referenced source analysis and fix/test directions.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the parent identifies WebGPU devices only by a reusable numeric (index, epoch) ID and does not tie delayed native wrapper teardown to the original owning device or enforce external-texture authorization on the parent side.
Impact
On the tested stock Linux Nightly with default settings, a compromised content process could reach browser-process native teardown and obtain a child-controlled indirect branch and an exact 8-byte write, but the proof does not establish arbitrary code execution or a complete sandbox escape.
What the attacker needed
Compromised content process; control of PWebGPUChild IPC messages; tested Firefox Nightly build; tested Lavapipe driver build
The fix
The parent should reject reuse of a retired device ID, tie delayed native teardown to the original owning device, and enforce external-texture and shared-swap-chain authorization itself rather than trusting child-side gates.
How it was found
- Serve the proof-of-concept page over localhost from the directory containing the page and debugger script.
- Ensure the Lavapipe Vulkan driver is selected, optionally by setting the driver environment variable.
- Run Firefox headless with a fresh empty profile under the debugger script, retrying only on recognised address-layout misses.
- Stop after the selected write instruction and check the success markers in the log.
- Compare the run with the included canonical validation log.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Firefox splits its work into processes, and a compromised web-content process is not supposed to be able to control the more privileged browser process. Here the content process could reuse an old numeric ID for a graphics device, so the browser later used a destroyed device handle and ran code chosen by the content process. The proof shows a small controlled write in the browser process, which is a step toward escaping the sandbox but not a complete escape.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.