OOB read in FilterNodeDisplacementMapSoftware via unchecked ColorChannel cast reachable from GPU process through PCanvas
The displacement map filter's SetAttribute stored an arbitrary integer as a colour channel index without a bounds check, and Render then used it to index a four-element stack array. A compromised content process could send crafted canvas drawing events over the PCanvas channel to the GPU process and cause an out-of-bounds read there.
- Fixed in 21 days
- Paid in 26 days
- Disclosed after 21 days
Created attachment 9543171 attachments.txt
FilterNodeDisplacementMapSoftware::SetAttribute (gfx/2d/FilterNodeSoftware.cpp
line 2606) accepts an arbitrary uint32_t for the X/Y channel index and stores
it via static_cast<ColorChannel>(aValue) without any bounds check. When
Render() runs (line 2654), it indexes a 4-element stack array with the
unchecked value:
static const ptrdiff_t channelMap[4] = { ... };
uint16_t xChannel = channelMap[mChannelX]; // OOB when mChannelX >= 4
A compromised content process can trigger this in the GPU process by crafting recorded canvas drawing events and sending them through the PCanvas IPDL channel via SendInitTranslator. No validation exists at any layer: not in RecordedFilterNodeSetAttribute deserialization, not in the CanvasTranslator replay, and not in SetAttribute itself.
The issue was discovered through static analysis and manual source review of the PCanvas IPC surface.
Tested on firefox at commit 27f4694604d9b56a237fe533d36ea385384e0e32 (Fri Feb 6 07:32:49 2026 +0200).
Attack scenario
- Compromised content process creates a PCanvas actor via CanvasManagerChild.
- Serializes recorded drawing events into shared memory buffer:
- CANVAS_DRAW_TARGET_CREATION
- SETCURRENTDRAWTARGET
- SOURCESURFACECREATION x2 (small input and map surfaces)
- FILTERNODECREATION (FilterType::DISPLACEMENT_MAP)
- FILTERNODESETINPUT x2 (wires surfaces to filter inputs)
- FILTERNODESETATTRIBUTE (ATT_DISPLACEMENT_MAP_X_CHANNEL = 0x7fffffff)
- DRAWFILTER (triggers Render path)
- Calls SendInitTranslator to start GPU-side translation.
- GPU process CanvasTranslator replays events, reaches FilterNodeDisplacementMapSoftware::Render, hits channelMap[0x7fffffff].
Impact
- OOB read in the GPU process, reachable from a compromised content process.
- The OOB-read value is used as a byte offset into pixel map data (mapData[mapIndex + xChannel]), which can further influence computed memory access patterns in the displacement loop.
- Degrades the content-to-GPU process isolation boundary.
Suggested fix
Validate aValue in SetAttribute before casting:
case ATT_DISPLACEMENT_MAP_X_CHANNEL:
if (aValue > COLOR_CHANNEL_A) {
return;
}
mChannelX = static_cast<ColorChannel>(aValue);
break;
case ATT_DISPLACEMENT_MAP_Y_CHANNEL:
if (aValue > COLOR_CHANNEL_A) {
return;
}
mChannelY = static_cast<ColorChannel>(aValue);
break;
Note: Other filter SetAttribute handlers appear to have the same unchecked static_cast pattern, notably FilterNodeBlendSoftware (BlendMode) and FilterNodeConvolveMatrixSoftware (ConvolveMatrixEdgeMode).
Reproduction
Build Firefox with:
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-debug
# Enable ASan specific code and build workarounds
ac_add_options --enable-address-sanitizer
# These three are required by ASan
ac_add_options --disable-jemalloc
ac_add_options --disable-crashreporter
ac_add_options --disable-elf-hack
ac_add_options --disable-install-strip
# Settings for an opt build (preferred)
# The -gline-tables-only ensures that all the necessary debug information for ASan
# is present, but the rest is stripped so the resulting binaries are smaller.
#ac_add_options --enable-debug-symbols=-gline-tables-only
ac_add_options --enable-debug
ac_add_options --enable-valgrind
Apply the attached patch and rebuild, then
./mach mochitest dom/bindings/test/test_displacementMapOOBGpu.html
ASAN should report the OOB access in FilterNodeDisplacementMapSoftware::Render in the GPU process.
Attachments
- repro.patch
- crash.txt
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 a missing range check on the channel attribute value before it is cast to the ColorChannel enum and used as an array index.
Impact
An out-of-bounds read occurs in the GPU process, and the read value is then used as a byte offset into pixel map data, which could further influence memory access patterns and degrades the content-to-GPU process isolation boundary.
What the attacker needed
Compromised content process; ability to send PCanvas IPC messages
The fix
The attribute value should be validated against the highest valid colour channel before the cast, and the report notes other filter SetAttribute handlers appear to share the same unchecked pattern.
How it was found
- A compromised content process creates a PCanvas actor through CanvasManagerChild.
- It serialises recorded drawing events, including filter creation, input wiring, the channel attribute and a draw, into a shared memory buffer.
- It calls SendInitTranslator to start GPU-side translation.
- The GPU process CanvasTranslator replays the events and reaches the displacement map filter's Render.
- Render indexes the four-element channel map with the unchecked value, causing the out-of-bounds read.
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 filter is a drawing effect that mixes pixels from two images. The code that picks which colour channel (red, green, blue or alpha) to read from was never checked, so a number far outside that small list was accepted. When the filter ran, the program read memory outside its small lookup table, which is an out-of-bounds read. The report says a compromised content process could reach this code in the more privileged 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.