Skip to content
Info disclosure Advisory Advanced CVE-2026-7977

Inappropriate implementation in Canvas (CVE-2026-7977)

Resizing an OffscreenCanvas with a bitmaprenderer context incorrectly resets its origin_clean_ flag to true without clearing the underlying image data. An attacker could exploit this to bypass the Same-Origin Policy and read cross-origin image data by transferring a tainted ImageBitmap, resizing the canvas, and then extracting the protected pixels.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 37 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: Resizing an OffscreenCanvas with a bitmaprenderer context incorrectly resets its origin_clean_ flag to true without actually clearing the underlying image data. This state desynchronization potentially allows an attacker to bypass the Same-Origin Policy and read cross-origin image data. An attacker could exploit this by transferring a tainted ImageBitmap to the canvas, resizing it, and then extracting the protected pixels.

Affected files:

  • third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
  • third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.cc

Estimated timestamp from git blame: 2025-07-08

Description

A potential Same-Origin Policy (SOP) bypass exists in Blink's OffscreenCanvas implementation when using the bitmaprenderer (ImageBitmap) rendering context. When an OffscreenCanvas is resized, its internal origin_clean_ flag is unconditionally reset to true if it uses a bitmaprenderer context. However, the actual image data stored in the rendering context is not cleared during this resize operation. This allows scripts to read back cross-origin pixel data that should be protected by the taint flag.

Note: The following steps and analysis are based on static code analysis; our tooling currently does not have the capability to run a live proof-of-concept.

Root Cause Analysis

The issue resides in OffscreenCanvas::SetSize within third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc. During a resize, the following logic executes:

C++
    } else if (context_->IsRenderingContext2D() ||
               context_->IsImageBitmapRenderingContext()) {
      context_->Reset();
      origin_clean_ = true;
    }

While context_->Reset() is called, the implementation for ImageBitmapRenderingContext (third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.cc) fails to clear the image stored in its ImageLayerBridge:

C++
void ImageBitmapRenderingContext::Reset() {
  CHECK(Host());
  CHECK(Host()->IsOffscreenCanvas());
  resource_provider_for_offscreen_canvas_.reset();
  Host()->DiscardResources();
}

Because the image_layer_bridge_ is not cleared or disposed of, the OffscreenCanvas incorrectly reports its state as clean (OriginClean() == true) while the context still retains the tainted, cross-origin image pixels in memory.

Potential Attack Steps

An attacker could potentially trigger this vulnerability by following these steps:

  1. Load a cross-origin image (without CORS) from a victim site using an HTMLImageElement (e.g., an authenticated avatar or private data).
  2. Convert the cross-origin image into an ImageBitmap using createImageBitmap(img). This bitmap is correctly marked as not origin-clean (tainted).
  3. Create an OffscreenCanvas and obtain a bitmaprenderer context: const oc = new OffscreenCanvas(100, 100); const ctx = oc.getContext('bitmaprenderer');
  4. Transfer the tainted bitmap to the canvas via ctx.transferFromImageBitmap(taintedBitmap). The canvas's origin_clean_ flag is correctly set to false.
  5. Resize the canvas to trigger the bug: oc.width = 101;. This invokes SetSize, which incorrectly resets origin_clean_ to true but leaves the tainted pixels intact in the context.
  6. Exfiltrate the pixel data by calling await oc.convertToBlob(). Since OriginClean() now incorrectly returns true, the security check passes, and the Blob is populated with the protected cross-origin pixels.

Suggested Fix

Modify ImageBitmapRenderingContext::Reset() to ensure the underlying image data is actually cleared. This can be done by replacing the image with a transparent black bitmap or dropping the reference in the layer bridge entirely. For example:

C++
void ImageBitmapRenderingContext::Reset() {
  CHECK(Host());
  CHECK(Host()->IsOffscreenCanvas());
  resource_provider_for_offscreen_canvas_.reset();
  ResetInternalBitmapToBlackTransparent(Host()->width(), Host()->height()); // Clear the image
  Host()->DiscardResources();
}

Alternatively, call image_layer_bridge_->Dispose() or image_layer_bridge_->SetImage(nullptr) if appropriate for the bridge's lifecycle.

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


Results from so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 ImageBitmapRenderingContext::Reset() method does not clear the stored image data, so the origin_clean_ flag is set to true while tainted pixels remain in memory.

Impact

An attacker could potentially bypass the Same-Origin Policy and read cross-origin image data, but the report is based on static analysis and no live proof-of-concept was run.

What the attacker needed

Victim site serves cross-origin image; no CORS headers on image; attacker can run JavaScript

The fix

The ImageBitmapRenderingContext::Reset() method should be modified to actually clear the underlying image data, for example by replacing the image with a transparent black bitmap or disposing the layer bridge.

How it was found

  1. Load a cross-origin image without CORS using an HTMLImageElement.
  2. Convert the image to an ImageBitmap with createImageBitmap, which marks it as tainted.
  3. Create an OffscreenCanvas and get a bitmaprenderer context.
  4. Transfer the tainted bitmap to the canvas, setting origin_clean_ to false.
  5. Resize the canvas, which resets origin_clean_ to true but leaves the pixels intact.
  6. Call convertToBlob to exfiltrate the protected pixel data.

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.

Web pages can normally only read images from their own site, not from other sites, to protect private data. This bug lets a malicious page trick the browser into thinking an image is safe to read after resizing a special canvas, so it can steal pixels from another site's image. The report is based on reading the browser's code, not on actually running an attack.

What is Info disclosure?

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

More from Google Chrome

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.