Skip to content
DoS Disclosed report Advanced CVE-2026-16376

WebGPU validation shader reads past bind group view, propagates attacker-influenced values to AGX firmware, kernel watchdog panic on Apple Silicon

The WebGPU indirect draw validation shader in wgpu reads past the bind group's view of a buffer due to a math gap in offset calculation, and with runtime checks disabled the out-of-bounds read returns non-zero values that are accepted as draw arguments. On Apple Silicon these values reach AGX firmware unclamped, causing a WindowServer watchdog kernel panic and requiring a force restart.

Mihalis Haatainen Follow

Originally disclosed on Mozilla

  • Fixed in 42 days
  • Paid in 3 months
  • Disclosed after 42 days
Text
Created attachment 9574926
oob-pixel-count.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:150.0) Gecko/20100101 Firefox/150.0

Steps to reproduce:

Reproduction
 
Hardware and software:
    Mac15,12 (MacBook Air, M3, 16GB)
    macOS 26.5 build 25F5068a
    Firefox 150
 
Steps:
    1. Open the attached oob-pixel-count.html in Firefox.
    2. Click "1. Init" - confirms maxBufferSize=256MiB > maxStorageBufferBindingSize=128MiB regime is reachable.
    3. Click "2. Sanity check (direct draw)" - direct pass.draw renders a fullscreen triangle. Counter validation that the rendering pipeline works. No crash.
    4. Click "3. drawIndirect with valid args" - drawIndirect with [3, 1, 0, 0] at offset 0. Validation pass executes with in-bounds reads. Triangle renders. No crash.
    5. Click "4. OOB diagnostic" - drawIndirect at offset (maxBufferSize - 16). Validation shader OOB-reads. Within seconds, system becomes unresponsive. WindowServer watchdog fires after 40 seconds. Force restart required.
 
Steps 3 and 4 prove the validation pipeline propagates correctly with normal args. Step 5 specifically panics, isolating the trigger to the OOB code path.
 



Actual results:

Reporter: Mihalis Haatainen, Bountyy Oy
Component: Core :: Graphics: WebGPU
Type: defect
Severity proposal: S2 (kernel watchdog panic, force restart required)
Keywords: csectype-dos, reporter-external
See Also: bug 2033723, bug 2035464
 
Summary
 
wgpu's indirect draw validation shader (wgpu-core/src/indirect_validation/validate_draw.wgsl) is compiled with ShaderRuntimeChecks::unchecked() at wgpu-core/src/indirect_validation/draw.rs:556. When the indirect buffer is larger than max_storage_buffer_binding_size, the shader reads past the bind group's view of the buffer due to a math gap in calculate_src_offsets at wgpu-core/src/indirect_validation/draw.rs:676-712. On Apple Silicon Metal, the unchecked shader read returns non-zero values that propagate through the validation pipeline as draw arguments, reaching AGX firmware unclamped. Result: WindowServer watchdog kernel panic, machine reboots.
 
This is structurally distinct from bug 2033723 and bug 2035464. Different code path, different validation bypass, different fix shape. Same kernel-level outcome.
 
Reproduced on Firefox 150, Mac15,12 (M3 MacBook Air, 16GB), macOS 26.5 build 25F5068a.
 
Source-level root cause
 
The validation shader's source binding is created at draw.rs:144-180 with size calculate_src_buffer_binding_size(buffer_size, limits). This caps the binding at max_storage_buffer_binding_size. For buffers larger than that limit, the binding covers only a prefix of the buffer.
 
The shader reads at runtime offsets calculated by calculate_src_offsets at draw.rs:676-712. The math is documented to "split the offset into a dynamic offset and a within-binding offset that together address any 16-byte position in the buffer." But the integer-division at line 704:
 
    let max_dynamic_offset_index = max_dynamic_offset / dynamic_offset_stride;
 
floors to 0 in some configurations. Specifically, when buffer_size - binding_size < dynamic_offset_stride (which is approximately binding_size - alignment), the dynamic offset cannot advance. The within-binding src_offset then equals the user-supplied byte offset, which can exceed binding_size.
 
Concrete example with WebGPU spec defaults:
 
    max_storage_buffer_binding_size = 128 MiB = 134_217_728
    max_buffer_size                  = 256 MiB = 268_435_456
    min_storage_buffer_offset_alignment = 256
    
    binding_size              = 134_217_728
    chunks                    = 524_288
    dynamic_offset_stride     = 524_287 * 256 = 134_217_472
    max_dynamic_offset        = 268_435_456 - 134_217_728 = 134_217_728
    max_dynamic_offset_index  = floor(134_217_728 / 134_217_472) = 1
    
    User offset = 268_435_440 (max valid for 16-byte Draw stride)
    src_dynamic_offset_index = floor(268_435_440 / 134_217_472) = 1
    src_dynamic_offset       = 1 * 134_217_472 = 134_217_472
    src_offset_within_binding = 268_435_440 - 134_217_472 = 134_217_968
    
    134_217_968 > 134_217_728 = binding_size
    
    Shader reads src[134_217_968 / 4 + 0..3] = src[33_554_492..33_554_495]
    Binding length = 134_217_728 / 4 = 33_554_432 u32s
    Read indices 33_554_492 onward = 60 u32s past binding extent
 
The validation shader is compiled with runtime checks disabled at draw.rs:556. The out-of-bounds read produces undefined values per WGSL spec. On Apple Silicon Metal, observation: the read returns non-zero values, possibly the buffer's contents past the binding view (which Metal does not bound at the hardware level for unchecked storage reads).
 
The validation logic at validate_draw.wgsl:58-64:
 
    let first_instance = src[src_base_offset + 3 + u32(is_indexed)];
    let instance_count = src[src_base_offset + 1];
    let can_overflow = is_bit_set(metadata.dst_offset, 31);
    let sub_overflows = metadata.instance_limit < first_instance;
    failed |= sub_overflows && !can_overflow;
    let instance_limit = metadata.instance_limit - first_instance;
    failed |= instance_limit < instance_count;
 
For pipelines with no per-instance vertex buffers, metadata.instance_limit truncates to UINT32_MAX (analyzed in bug 2033723 amendment). Any instance_count value less than UINT32_MAX passes the check. Same for vertex_or_index_count when no vertex buffers are bound.
 
Result: the OOB-read values reach dst as validated draw args. Metal consumes dst as MTLDrawPrimitivesIndirectArguments. UINT32_MAX-class values produce the same AGX firmware wedge documented in bug 2033723 Comment 5 (.ips bug_type 409, all AGX/IOGPU workloops TH_WAIT|TH_UNINT, WindowServer watchdog 40-second timeout).
 



Expected results:

Kernel evidence
 
Attached: WindowServer-2026-04-29-094855.ips (or your filename)
 
Header:
    bug_type: 409
    os_version: macOS 26.5 (25F5068a)
    modelCode: Mac15,12
    procName: WindowServer
    namespace: WATCHDOG, code 1
    indicator: monitoring timed out for service
    40 seconds since last successful checkin
 
Stackshot signature matches bug 2033723 Comment 5 .ips:
    All 10 AGX/IOGPU workloops in TH_WAIT|TH_UNINT
    546 of 3477 threads in TH_WAIT|TH_UNINT
    WindowServer all 19 threads TH_WAIT
    Firefox GPU Helper all 28 threads TH_WAIT
 
The kernel-level outcome is identical to bug 2033723. The trigger path differs:
    bug 2033723: UINT32_MAX written directly to indirect buffer; validation accepts due to instance_limit u64::MAX default
    this filing: OOB shader read returns non-zero values from past the binding view; validation accepts those values and propagates them
 
Why this is not a duplicate of bug 2033723
 
Aspect                          bug 2033723                     this filing
---------------------------------------------------------------------------
Trigger condition               args at any offset              buffer_size > max_storage_buffer_binding_size, args at OOB offset
Validation bypass               instance_limit = u64::MAX       calculate_src_offsets math; ShaderRuntimeChecks::unchecked
Attacker-controlled value       written directly to args range  written elsewhere in buffer or adjacent memory
Sentinel test                   not applicable                  attacker writes pattern X to OOB offset; Metal returns X (or adjacent values) for shader OOB read
Fix location                    extend validation clamp logic   one of three options below
Code path                       wgpu-core/src/indirect_validation/draw.rs MetadataEntry::new + validate_draw.wgsl    wgpu-core/src/indirect_validation/draw.rs calculate_src_offsets + ShaderRuntimeChecks
 
Both findings produce the same kernel signature but require different fixes and exercise different code.
 
Proposed fix
 
Three viable shapes:
 
Option A: enable runtime checks on the validation shader
    Change ShaderRuntimeChecks::unchecked() at draw.rs:556 to ShaderRuntimeChecks::checked(). 
    The shader's src reads will then return zero for OOB instead of undefined values.
    Trade-off: minor performance cost on the validation pass.
 
Option B: fix calculate_src_offsets math
    The function intends "binding combined with dynamic offsets covers the whole buffer" but the integer-division at line 704 leaves gaps. Either reduce dynamic_offset_stride to fit max_dynamic_offset cleanly, or increase binding_size to ensure max_dynamic_offset_index >= 1 covers all positions, or use ceiling division.
 
Option C: clamp src_offset in shader
    Add a check in validate_draw.wgsl: if src_base_offset + 4 >= arrayLength(&src) { failed = true; }
    Equivalent to runtime checks but only on the indices used by the validation pass.
 
Cross-engine context
 
This finding is wgpu-specific. WebKit's WebGPU implementation uses a different validation pipeline (clampIndirectBufferToValidValues at Source/WebGPU/WebGPU/Device.mm). Chromium's Dawn uses a different validation pipeline as well. Neither has the same calculate_src_offsets math gap because they don't use the same binding strategy.
 
Severity
 
bug_type 409 WATCHDOG kernel panic on Apple Silicon, requires force restart. Same Mozilla bounty policy tier as 2033723 / 2035464: "DOS requiring reboot of user's computer."
 
This is a reproducible kernel panic on current-generation Apple Silicon Firefox 150. Trigger requires a 256MiB buffer (default WebGPU max_buffer_size) and a single drawIndirect call. No special features required.
 
Attachments
    oob-pixel-count.html (reproducer)
    firefox-new.ips (panic diagnostic)

The original report as published on Mozilla's Bugzilla, by Mihalis Haatainen. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 offset-splitting integer division in calculate_src_offsets can floor to zero, so the within-binding offset can exceed the binding size, and because the validation shader runs with runtime checks disabled the out-of-bounds read returns undefined non-zero values that are accepted as draw arguments.

Impact

A web page could cause a kernel watchdog panic on Apple Silicon, making the machine unresponsive and requiring a force restart; the text states this is reproducible on current-generation hardware with default WebGPU limits.

What the attacker needed

Apple Silicon Mac; Firefox 150; WebGPU enabled; 256MiB buffer allocation

The fix

The text proposes three options: enable runtime checks on the validation shader, fix the calculate_src_offsets math, or clamp the source offset in the shader; it does not say a fix was applied.

How it was found

  1. Open the attached HTML file in Firefox.
  2. Click Init to confirm the buffer-size regime is reachable.
  3. Click the direct-draw sanity check to confirm rendering works without a crash.
  4. Click drawIndirect with valid arguments to confirm in-bounds validation works.
  5. Click the out-of-bounds diagnostic, which uses drawIndirect at an offset near the end of the buffer.
  6. Observe the system becoming unresponsive and the WindowServer watchdog firing after 40 seconds, requiring a force restart.

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.

A graphics API lets a web page ask the GPU to draw things. Before drawing, a validation step checks that the requested draw arguments are safe. Here that check read data from outside the allowed area, got garbage values, and passed them on to the GPU. On this Mac the GPU firmware then hung, and the whole machine had to be restarted.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by Mihalis Haatainen

View all

3 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.