Skip to content
Memory corruption Disclosed report Advanced CVE-2026-74947

Cairo path type-confused as PathSkia in WebGL filter path

A WebGL filter path in the GPU process casts a Cairo-backed path to a Skia path without checking the backend, causing a type confusion. An attacker with a compromised content process could reliably crash the GPU process, though the text does not establish code execution.

navapon Follow

Originally disclosed on Mozilla

  • Fixed in 39 hours
  • Paid in 38 days
  • Disclosed after 39 hours

Created attachment 9620851 bug2-submission.zip

Steps to reproduce

  1. Build mozilla-central fdd583cd5a10d051053acda8b760c3bd5d800034 on macOS after applying patches/filternode-poc-instrumentation.patch, which makes the content process behave like a compromised one (see Environment for why that is the right model).
  2. Run ./run-pathconf.sh. The script creates a fresh profile per run.
  3. The patched content process stores a Path while a Cairo draw target is current, so the GPU process builds a PathCairo. It then references that same path from DEFERFILTERINPUT on a WebGL target, and draws a GAUSSIAN_BLUR filter node that has the deferred node as its input. Everything after the path's creation happens on the WebGL target and is otherwise legitimate.

Without a browser, the regression test in patches/gtest-cross-backend-resources.patch fails on current main:

./mach gtest 'GfxCrossBackendResources.WebglDeferFilterInputRejectsCairoPath'

Actual results

The GPU process dies:

exception: EXC_BAD_ACCESS (SIGSEGV),
           KERN_INVALID_ADDRESS at 0xe5e5e5e5e5e5e530
faulting thread: CanvasRenderer
  SkPath::isRect(SkRect*, bool*, SkPathDirection*) const
  SharedContextWebgl::ResolveFilterInputAccel(...)
  DrawTargetWebgl::ResolveFilterInputAccel(...)
  FilterNodeDeferInputWebgl::ResolveInputs(...)
  FilterNodeDeferInputWebgl::DrawChild(...)
  FilterNodeGaussianBlurWebgl::Draw(...)
  RecordedDrawFilter::PlayEvent(...)

The blur's Draw() reaches SharedContextWebgl::ResolveFilterInputAccel(), which does static_cast<const PathSkia*>(aPath)->GetPath() with no backend check, so Skia operates on a PathCairo. Instrumentation confirms the backend arriving at the cast:

ResolveFilterInputAccel: path=0x14269de50 pathBackend=1 (SKIA=2)
                         reaching unchecked static_cast<PathSkia*>

The gtest reports:

FAIL - Value of: node
  Actual: true
Expected: false
DeferFilterInput accepted a Cairo path; SharedContextWebgl::ResolveFilterInputAccel
will static_cast it to PathSkia

Expected results

DeferFilterInput refuses a path from another backend, exactly as DrawTargetWebgl::Fill(), Stroke() and DrawShadow() in the same file already do, leaving the GPU process alive.

Reproducibility

Every run, on a plain -O2 build with jemalloc and the sandbox enabled.

Each run uses a new profile — required, because after a GPU-process crash Firefox disables accelerated canvas in the profile, which silently neutralizes a rerun.

Earliest affected version

dom/canvas/FilterNodeWebgl.cpp and DeferFilterInput landed on mozilla-central on 2025-07-05 in bug 1912897, "Support blurring and shadows for Accelerated Canvas2D", i.e. the Firefox 142 nightly cycle. I verified the defect on current main (155.0a1) and did not bisect the intervening releases, so treat 142 as the likely first affected release rather than a confirmed one.

Description

In dom/canvas/DrawTargetWebgl.cpp, SharedContextWebgl::ResolveFilterInputAccel():

C++
const SkPath& skiaPath = static_cast<const PathSkia*>(aPath)->GetPath();

There is no backend check, and DrawTargetWebgl::DeferFilterInput() stores the caller's Path* into a FilterNodeDeferInputWebgl without validating it either. The sibling call sites in the same file — DrawTargetWebgl::Fill(), Stroke(), DrawShadow() — all check aPath->GetBackendType() != BackendType::SKIA before their PathSkia casts.

Reachability from a compromised content process: RecordedPathCreation::PlayEvent() builds the path with GetCurrentDrawTarget()->CreatePathBuilder(), so a path's backend follows whichever draw target was current when the path was first stored. Storing a path while a Cairo target is current therefore yields a PathCairo; referencing it from DEFERFILTERINPUT on a WebGL target puts it inside a FilterNodeDeferInputWebgl.

A standalone DRAWFILTER on that node is safe, because FilterNodeDeferInputWebgl::Draw() routes to DrawTargetWebgl::Fill(), which does check. The unchecked cast sits behind ResolveInputs(), which is reached when the deferred node is an input of another filter:

DRAWFILTER(blurNode) on the WebGL target        <- otherwise legitimate
  FilterNodeGaussianBlurWebgl::Draw
    FilterNodeDeferInputWebgl::DrawChild
      FilterNodeDeferInputWebgl::ResolveInputs
        DrawTargetWebgl::ResolveFilterInputAccel
          SharedContextWebgl::ResolveFilterInputAccel
            static_cast<const PathSkia*>(pathCairo)->GetPath()

Note this does not depend on my other report: every step here happens on the WebGL target, and only the path's origin is illegitimate.

Impact

Established: reachable type confusion in the GPU process on a heap object, and a reliable crash in a normal, non-sanitized, sandboxed build.

Degree of attacker control, measured directly rather than assumed: PathSkia::mPath begins at path+24, where PathCairo holds mFillRule plus padding, so the pointer Skia dereferences as SkPathRef* is synthesised from those bytes:

fill rule FILL_WINDING  -> SkPathRef* = 0xe5e5e5e5e5e5e500
fill rule FILL_EVEN_ODD -> SkPathRef* = 0xe5e5e5e5e5e5e501

Exactly one byte of the eight is attacker-controlled, and only to the values 0 or 1, since FillRule has two members. The remaining seven bytes are mozjemalloc's free-poison pattern, written by the allocator, so heap grooming does not reach them. The attacker-supplied path coordinates in PathCairo::mPathData sit further along the object and are not consulted before the faulting dereference.

Not established: code execution or parent-process escape. On these measurements the primitive is not steerable, and I make no exploitation claim beyond a reliable GPU-process crash.

No forward-edge CFI or pointer authentication applies on macOS; I verified this on the official Nightly binary (Version=155.0a1, BuildID=20260801211258): the arm64 slice is ARM64 ALL, not arm64e, and neither slice contains CFI symbols, ptrauth load commands or CFI sections.

Precondition: a compromised content process, needed to obtain a Cairo draw target on macOS (normal content initializes the recorder with BackendType::SKIA). Sandbox-escape building block, not reachable from script alone.

Suggested fix

Add the guard the sibling call sites in the same file already use, in DrawTargetWebgl::DeferFilterInput() and/or SharedContextWebgl::ResolveFilterInputAccel():

C++
if (!aPath || aPath->GetBackendType() != BackendType::SKIA) {
  return nullptr;
}

Root cause worth addressing generally: CanvasTranslator keeps every resource kind in translator-wide maps and binds none of them to the backend of the draw target that created them, so replay sinks must re-validate. Most do; this one and the DrawTargetCairo::DrawFilter sink in my other report do not.

Proof of concept as an in-tree test

patches/gtest-cross-backend-resources.patch adds gfx/tests/gtest/TestCrossBackendResources.cpp with GfxCrossBackendResources.WebglDeferFilterInputRejectsCairoPath, a regression test for exactly this issue: it brings up a real DrawTargetWebgl, hands DeferFilterInput a Cairo path, and asserts the call is refused.

It fails cleanly on current main rather than crashing, so it can go into the suite as-is and will pass once DeferFilterInput validates the path backend. The same file carries the crash-based test for my other report, marked DISABLED_ so it does not take the suite down with it.

Related

Filed separately: unchecked FilterNodeSoftware cast in DrawTargetCairo::DrawFilter, same root cause. Please link them.

Environment

mozilla-central fdd583cd5a10d051053acda8b760c3bd5d800034 (155.0a1), macOS 26.5.2 (25F84), Apple M4 Pro (arm64), plain -O2 build with jemalloc and the sandbox enabled (MOZ_SANDBOX=1, no MOZ_DISABLE_*_SANDBOX in the environment). No Breakpad ID, as this build has the crash reporter disabled; the macOS crash report is attached instead.

The content-process side is patched to emit the event sequence through Firefox's own CanvasDrawEventRecorder. That is not a shortcut around the threat model: the premise is a compromised content process, which by definition runs attacker code inside that process and can call these same code paths.

The attachment contains a README.txt describing every file, the patches, all logs, and the repro scripts.

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

Impact

A compromised content process can reliably crash the GPU process through a type confusion, but the text does not establish code execution or parent-process escape.

What the attacker needed

Compromised content process; macOS build; fresh profile per run

The fix

The fix should add a backend check rejecting non-Skia paths in DeferFilterInput and/or ResolveFilterInputAccel, as sibling call sites already do.

How it was found

  1. Build mozilla-central with the instrumentation patch that simulates a compromised content process.
  2. Run the provided script, which creates a fresh profile per run.
  3. Store a path while a Cairo draw target is current, then reference it from a deferred filter input on a WebGL target.
  4. Draw a Gaussian blur filter node with the deferred node as its input.
  5. Observe the GPU process crash in the Skia path code.

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 draws graphics in a separate GPU process. A path (a shape to draw) can be stored in one drawing backend and later used by another, and the code assumed it was always the same kind. Because it never checked, it treated one kind of object as a different kind, which crashed the GPU process.

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.

More by navapon

View all

1 more disclosed report, 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.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.