← all posts

red team · 06 December 2026

Lab: rebuilding the PoC for crbug 576097084 (HTML-in-Canvas) with Chromium ASan

How I set up a two-build Chromium ASan lab to reconstruct the PoC for a fixed bug, prove the harness works, and then hunt for variants on the latest build.

#chromium#asan#browser-security#lab#html-in-canvas

Before hunting for new bugs in a feature, I first prove that my lab can find a bug of the same class. The method: take an old bug that is already fixed and publicly described, rebuild its PoC, then confirm it crashes on a build from before the fix and does not crash on a build from after it. Until both are true, a “no crashes” result from fuzzing means nothing.

This post is my lab notebook for crbug 576097084, a bug in Chromium’s experimental HTML-in-Canvas feature.

The feature

HTML-in-Canvas (behind the CanvasDrawElement flag) lets a <canvas> with the content="drawable" attribute draw HTML elements. The page calls canvas.requestPaint(), then the browser fires a paint event and runs the onpaint handler.

The interesting part from a security point of view: according to the fix notes, this paint event runs inside cc::LayerTreeHost::WillCommit, while the compositor is preparing a layer commit. That means page JavaScript can change the DOM (and trigger GC) in the middle of a process that assumes its layers are still alive. That is a classic recipe for a use-after-free.

The lab

Two Chromium ASan builds for macOS arm64 from the public chromium-browser-asan bucket:

Build Revision Role
Chromium 158 ASan r1727378 before the fix, must crash
Chromium 161 ASan r1763795 latest, target for variants

ASan build archives are huge (the dSYM alone is 3.5 GB) and I had about 12 GB of free disk. So I used a small script that reads the zip’s central directory over HTTP Range requests and extracts only the files I need: Chromium.app, llvm-symbolizer and icudtl.dat. Chromium Framework.dSYM only gets pulled when a crash needs full symbolization.

The runner is simple. A Python script serves the PoC pages on 127.0.0.1, launches Chromium ASan with a fresh profile, and watches stderr for patterns such as ERROR: AddressSanitizer, Check failed and DCHECK failed. The PoC page reports progress with navigator.sendBeacon to the same server, so the runner knows when a scenario has finished instead of waiting for a timeout.

ASAN_OPTIONS=detect_leaks=0:symbolize=1:handle_abort=1 \
  Chromium --headless=new --user-data-dir=/tmp/prof \
  --js-flags=--expose-gc \
  --enable-blink-features=CanvasDrawElement \
  "http://127.0.0.1:8750/repro-576097084.html?v=c2d&gc=gc"

Rebuilding the PoC

The public description of the bug is clear enough to reconstruct:

  1. Put 8 small canvases (2D context) inside a div.
  2. Add one content="drawable" canvas to act as the painter.
  3. Inside onpaint: empty the div, read offsetTop to force layout, then trigger GC.

The core of the handler:

painter.onpaint = () => {
  if (++fired > 1) return;
  holder.textContent = '';   // detach the 8 canvases from the DOM
  document.body.offsetTop;   // force layout
  gc(); gc();                // the detached canvases get collected
};
painter.requestPaint();

Each detached canvas owns its own cc::TextureLayer. When GC throws those canvases away in the middle of WillCommit, the compositor is still holding a pointer to the layer.

Result on the pre-fix build

On r1727378 the PoC crashes immediately, both headless and with a visible window:

ERROR: AddressSanitizer: use-after-poison
READ of size 8 thread T0
  #0 cc::TextureLayer::UpdateAfterPaintEvent()
  #1 cc::LayerTreeHost::WillCommit(...)
  #2 cc::ProxyMain::BeginMainFrame(...)
  #3 base::TaskAnnotator::RunTaskImpl(...)

use-after-poison means code read memory that the allocator had marked as off-limits (poisoned), in this case memory belonging to an object that had already been cleaned up. The stack matches the bug description: the read happens in TextureLayer::UpdateAfterPaintEvent, called from WillCommit, after the paint handler has run.

This is the most important point of the whole lab: the harness is proven to trigger this bug class.

Result on the latest build

The same PoC does not crash on r1763795. According to its notes, the fix covers the HTMLCanvasElement::DiscardResources path, that is, 2D canvases being garbage-collected.

The next question: what about other objects that also own their own cc::Layer? I wrote a variants page that removes, changes or garbage-collects other objects from inside onpaint:

  • Object types: WebGL and WebGL2 canvases, OffscreenCanvas (via transferControlToOffscreen), bitmaprenderer, WebGPU, <video> fed by captureStream, and iframe.
  • Actions: remove + GC, resize, display: none, WEBGL_lose_context, and all of them at once.

The result: none of the variants crash on r1763795. No new bug yet, and that is an honest result. Either the fix is broader than its notes suggest, or the remaining paths need a trigger I have not tried.

Triage notes

If one of these variants ever does crash, this is what I check before reporting to the Chrome VRP:

  • Not a security bug: small-offset null dereferences, stack overflows, OOM, bare CHECK/DCHECK failures, and UAFs reported as MiraclePtr protected.
  • Worth reporting: heap-use-after-free, heap-buffer-overflow and out-of-bounds writes.
  • Before reporting: reproduce on the latest ASan build, search issues.chromium.org for duplicates, minimize the PoC, and make sure it still reproduces without --expose-gc.

Lessons

  • Rebuild an old PoC first. Without a positive control, “0 crashes” may mean the harness is broken, not that the browser is safe.
  • Keep two builds, before and after the fix. Comparing them gives certainty faster than reading the diff.
  • Read the fix notes to find variants. A fix that names one specific path points at neighbouring paths that may not be covered.

From the blue team side the message is boring but important: experimental features behind flags can carry real memory bugs. Do not enable experimental flags on production browsers, and let Chrome update itself.