Skip to content
Info disclosure Disclosed report Advanced CVE-2026-84130

WebGPU array-layer discard corrupts initialization tracking and discloses stale texture data

A bug in Firefox's vendored wgpu-core initialization tracker lets a discard operation on one layer of a 2D array texture leave the tracker's range list unsorted, so a later write to another layer wrongly marks a never-written layer as initialized. Reading that layer then skips WebGPU's required zeroing and returns stale bytes left in the GPU allocation by a previously destroyed texture.

hajim Follow

Originally disclosed on Mozilla

  • Fixed in 16 days
  • Paid in 59 days
  • Disclosed after 16 days

Created attachment 9616083 poc.html

Summary

Firefox's current vendored wgpu-core can violate the ordering invariant of its generic resource initialization tracker when processing storeOp: "discard" for a layer of a two-dimensional array texture.

After the invariant is broken, a valid complete write to another layer can incorrectly remove the initialization record for an adjacent, never-written layer. A subsequent read skips WebGPU's mandatory first-use zeroing and returns contents retained by the underlying allocation from a destroyed GPUTexture.

The attached ordinary web-page testcase recovered 39 complete stale layers out of 64 new textures, totaling 638,976 exactly matched stale bytes. A control run without the discard operation returned zero for all 64 layers. Replacing the incorrect append with an ordered insertion and rebuilding Firefox also made all 64 layers return zero.

Tested versions

The unmodified testcase reproduced on a Mozilla Windows x64 ASAN build:

Text
Firefox: 154.0a1
BuildID: 20260718090721
SourceStamp: 1d0f3519e52671ddced90bd213a8fb6867473d61
wgpu revision: f680a2c242ce109d632b1154d72e0e7836e31c67
Backend: WARP fallback adapter

It also reproduced on this local source build:

Text
Firefox source: cea5f8cacbe1ba3c8c95a7b17a309ce6704a4c7d
Firefox: 154.0a1
Application BuildID: 20260724234852
Platform BuildID: 20260724235112
wgpu revision: 43981de526bffe6773403029c2e26f18d9c0a976
Build: Windows x64 ASAN, clang-cl
Backend: WARP fallback adapter

No Firefox source modification is required for the vulnerable run.

Violated invariant

third_party/rust/wgpu-core/src/init_tracker/mod.rs documents both the security requirement and the data-structure invariant:

Rust
// The WebGPU specification requires all texture & buffer memory to be
// zero initialized on first read. To avoid unnecessary inits, we track
// the initialization status of every resource and perform inits lazily.

pub(crate) struct InitTracker<Idx: Ord + Copy + Default> {
    /// Non-overlapping list of all uninitialized ranges, sorted by
    /// range end.
    uninitialized_ranges: UninitializedRangeVec<Idx>,
}

check(), uninitialized(), and drain() use partition_point() and therefore require uninitialized_ranges to remain sorted.

Root cause

InitTracker::discard() finds the first range whose end is not below pos. If pos belongs before that range but is not adjacent to it, the code appends the new range to the end of the vector instead of inserting it at r_idx:

Rust
pub(crate) fn discard(&mut self, pos: u32) {
    let r_idx = self.uninitialized_ranges.partition_point(|r| r.end < pos);
    if let Some(r) = self.uninitialized_ranges.get(r_idx) {
        if r.end == pos {
            // ...
        } else if r.start > pos {
            if r.start == pos + 1 {
                self.uninitialized_ranges[r_idx] = pos..r.end;
            } else {
                // previous range end must be smaller than idx,
                // therefore no merge possible
                self.uninitialized_ranges.push(pos..(pos + 1));
            }
        }
    } else {
        self.uninitialized_ranges.push(pos..(pos + 1));
    }
}

The correct operation in the non-adjacent branch is:

Rust
self.uninitialized_ranges.insert(r_idx, pos..(pos + 1));

Deterministic state transition

The testcase uses a ten-layer D2 array texture.

After fully writing layers 2 through 7, the uninitialized ranges are:

Text
[0,2), [8,10)

Discarding initialized layer 5 computes r_idx = 1. The vulnerable append produces:

Text
[0,2), [8,10), [5,6)

The vector is no longer sorted by range end. A subsequent complete write to layer 8 runs drain(8..9). The drain logic assumes ordering and incorrectly removes both [8,10) and the misplaced [5,6) entry, leaving:

Text
[0,2)

Layer 9 has never been written, but it is now treated as initialized. Reading layer 9 therefore omits the required zero clear and copies the underlying texture allocation directly to the page.

Testcase

Attachment: poc/poc.html

The testcase uses only ordinary WebGPU APIs:

  1. Create 64 64 x 64 x 10 rgba8unorm D2 array textures.
  2. Fill layer 9 of every old texture with [97, 183, 45, 243].
  3. Wait for GPU completion and destroy all old textures.
  4. Create 64 new textures with the same descriptor.
  5. Fully write layers 2 through 7 of each new texture.
  6. Execute loadOp: "load", storeOp: "discard" on layer 5.
  7. Fully write layer 8, triggering the incorrect drain.
  8. Copy the never-written layer 9 of every new texture to mapped buffers.

Add ?control=1 to the URL for the negative control. It performs the same allocation, destruction, writing, and readback sequence but omits step 6.

Results

Vulnerable run:

JSON
{
  "mode": "unsorted-discard",
  "resourceCount": 64,
  "pixelsPerLayer": 4096,
  "markerPixels": 159744,
  "zeroPixels": 102400,
  "otherPixels": 0,
  "fullyRecoveredLayers": 39,
  "fullyZeroLayers": 25,
  "exactRecoveredBytes": 638976,
  "uncaptured": []
}

Control run:

JSON
{
  "mode": "sorted-control",
  "resourceCount": 64,
  "markerPixels": 0,
  "zeroPixels": 262144,
  "otherPixels": 0,
  "fullyRecoveredLayers": 0,
  "fullyZeroLayers": 64,
  "exactRecoveredBytes": 0,
  "uncaptured": []
}

After replacing the append with insert(r_idx, ...) and rebuilding Firefox, the vulnerable testcase also returned 64 completely zero layers and no marker pixels.

The complete ASAN/Geckodriver/browser output and verbatim result JSON are in poc/asan-run.log.

Security impact and boundary

This is a mandatory WebGPU zero-initialization bypass. The recovered bytes belong to destroyed GPUTexture objects and were never written into the new textures. No invalid WebGPU parameter, failed submission, shader out-of-bounds access, privileged script, or IPC forgery is required.

The demonstrated disclosure crosses GPUTexture lifetimes within a GPUDevice: complete layer contents written to destroyed textures are returned through never-written layers of newly created textures.

This is distinct from Bug 2041911. That bug involved dynamic-offset buffer binding lazy initialization. This issue affects D2 array textures, StoreOp::Discard, and the generic interval tracker's ordered-range invariant.

Suggested fix

Insert the new singleton range at r_idx:

Rust
self.uninitialized_ranges.insert(r_idx, pos..(pos + 1));

Add a unit test for the exact transition:

Rust
let mut tracker = InitTracker::new(10);
tracker.drain(2..8).for_each(drop);
tracker.discard(5);
assert_eq!(
    tracker.uninitialized_ranges,
    smallvec![0..2, 5..6, 8..10]
);
tracker.drain(8..9).for_each(drop);
assert_eq!(tracker.check(9..10), Some(9..10));

Debug builds should additionally assert that all ranges remain non-overlapping and monotonically ordered after every mutation.

The original report as published on Mozilla's Bugzilla, by hajim. 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

InitTracker::discard() appends the new uninitialised range to the end of a vector that must stay sorted by range end, instead of inserting it at the computed index, breaking the ordering that check(), uninitialized() and drain() rely on.

Impact

A web page using only ordinary WebGPU calls could read back complete layer contents of destroyed textures through never-written layers of new textures, crossing GPUTexture lifetimes within one GPUDevice; the report demonstrates this on Windows ASAN builds with the WARP fallback adapter.

What the attacker needed

Victim visits a crafted web page; WebGPU available in the browser; no special privileges needed

The fix

The new singleton range should be inserted at the computed index rather than appended, and the report notes that rebuilding Firefox with that change made all 64 layers return zero.

How it was found

  1. Create 64 64x64x10 rgba8unorm 2D array textures.
  2. Fill layer 9 of every old texture with a marker value.
  3. Wait for GPU completion and destroy all old textures.
  4. Create 64 new textures with the same descriptor and fully write layers 2 through 7.
  5. Run a load/discard store operation on layer 5, then fully write layer 8.
  6. Copy the never-written layer 9 of every new texture to mapped buffers and inspect the bytes.

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.

WebGPU is a browser API for drawing with the graphics card. The spec says any texture memory you read must be zeroed first, so you never see leftover data from someone else's work. Here a bookkeeping list that tracks which parts of a texture are still uninitialised got out of order, so the browser thought a layer had been written when it had not, and handed back old bytes from a destroyed texture instead of zeros.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by hajim

View all

7 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.