Heap buffer overflow in Skia (CVE-2026-14427)
A heap out-of-bounds write exists in Skia's signed distance field text rendering because the GPU process chooses a vertex stride from one perspective check while the CPU-side fill uses a different check. A compromised renderer could forge a serialized Slug so the GPU process writes up to 8KB past an allocated vertex buffer with attacker-controlled data.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 27 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential heap out-of-bounds write exists in Ganesh's signed distance field (SDF) text rendering pipeline. A compromised renderer can decouple the perspective predicates used for vertex buffer allocation and CPU-side vertex filling by forging a serialized Slug. This mismatch can cause the GPU process to allocate a vertex buffer with a 16-byte stride but fill it using a 20-byte stride, writing up to 8KB past the buffer boundary.
Affected files:
third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cppthird_party/skia/src/gpu/ganesh/text/GlyphData.cppthird_party/skia/src/gpu/ganesh/effects/GrDistanceFieldGeoProc.cppthird_party/skia/src/text/gpu/SubRunContainer.cppthird_party/skia/src/text/gpu/VertexFiller.cppthird_party/skia/src/gpu/ganesh/Device.cppcc/paint/paint_op_reader.cc
Estimated timestamp from git blame: 2022-10-13
Description
A potential heap out-of-bounds write vulnerability has been identified in Skia's Ganesh rendering backend, specifically within the signed distance field (SDF) text rendering path. The vulnerability stems from an inconsistency between the perspective predicates used to compute the GeometryProcessor's vertex-attribute layout and those used to determine the structure size during the CPU-side vertex-fill process.
Root Cause Analysis
-
GeometryProcessor Stride Calculation: In
third_party/skia/src/gpu/ganesh/ops/AtlasTextOp.cpp:195, the perspective flagkPerspective_DistanceFieldEffectFlagis derived fromviewDiffMatrix.hasPerspective():C++ DFGPFlags |= viewDiffMatrix.hasPerspective() ? kPerspective_DistanceFieldEffectFlag : 0;Here,
viewDiffMatrixis calculated as the difference between the drawing-timepositionMatrixand the serializedcreationMatrix(positionMatrix · creationMatrix⁻¹).If the perspective flag is not set,
GrDistanceFieldA8TextGeoProcselects a 2D position attribute (kFloat2_GrVertexAttribType, 8 bytes), resulting in a vertex stride of 16 bytes (8 bytes position + 4 bytes color + 4 bytes UV). -
CPU-Side Vertex Fill Structure Selection: In
third_party/skia/src/gpu/ganesh/text/GlyphData.cpp:299-320, the structure used to write the vertex data is chosen based directly onpositionMatrix.hasPerspective(), rather than theviewDifferencematrix:C++ SkMatrix viewDifference = vf.viewDifference(positionMatrix); if (!positionMatrix.hasPerspective()) { using Quad = Mask2DVertex[4]; // 16B/vertex fill2D(quadData((Quad*)vertexBuffer), color, viewDifference); } else { using Quad = Mask3DVertex[4]; // 20B/vertex fill3D(quadData((Quad*)vertexBuffer), color, viewDifference); }If
positionMatrixcontains perspective,fill3Dwrites vertices asMask3DVertexstructures, which are 20 bytes each. -
De-synchronization of Predicates: A compromised renderer can manipulate both matrices across the IPC boundary. During Slug deserialization in
third_party/skia/src/text/gpu/SubRunContainer.cpp:171, thecreationMatrixis read raw from the shared buffer without validation to verify if it contains perspective:C++ SkMatrix creationMatrix; buffer.readMatrix(&creationMatrix);
Potential Attack Scenario
Note: Our tooling does not currently have the capability to execute code, so this represents a suggested potential attack flow based on static analysis of the codebase.
- A compromised renderer updates the canvas CTM to an arbitrary invertible perspective matrix $P$ via
SetMatrixOp(P). - The renderer crafts and sends a serialized
DrawSlugOpcarrying a forgedSDFTSubRunwherecreationMatrixis also set to $P$. - During playback in the GPU process, the drawing context evaluates
positionMatrixas $P$ (has perspective). - The GPU process computes
viewDiff = positionMatrix * creationMatrix^-1 = P * P^-1 = Identity(no perspective). - Consequently,
calculate_sdf_parametersdoes not apply the perspective flag, setting the GP vertex stride to 16 bytes.target->makeVertexSpaceallocates $16 \times 4 \times N = 64 \times N$ bytes (e.g., 32,768 bytes for $N=512$). - However,
GlyphData::fillVertexDataevaluatespositionMatrix.hasPerspective() == trueand enters theelseblock, writing vertices asMask3DVertex(20-byte stride) at $80 \times N$ bytes (e.g., 40,960 bytes). - This results in up to an 8,192-byte heap out-of-bounds write past the allocated buffer. The written data (coordinates mapped through
viewDifferenceand the color) is fully specified by the attacker.
Suggested Remediation
To remediate this issue, the CPU-side vertex-filling logic should be aligned with the GP-side stride logic by keying the structure selection in GlyphData::fillVertexData on viewDifference.hasPerspective() rather than positionMatrix.hasPerspective(). Alternatively, strict matrix validation can be added during Slug deserialization to reject perspective creationMatrix inputs.
Evaluated with Chrome root at commit: 57b021e1fdae94a215627d29aeb1ccf2eb5b3e91
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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.
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
The GPU-side vertex stride is chosen using a perspective flag derived from the difference between the drawing matrix and the serialized creation matrix, while the CPU-side fill chooses its structure from the drawing matrix alone, so a forged creation matrix can make the two disagree.
Impact
A compromised renderer could cause a heap out-of-bounds write of up to 8KB in the GPU process with attacker-controlled data, potentially leading to memory corruption; the report notes its tooling could not execute code, so this is a suggested flow from static analysis.
What the attacker needed
Compromised renderer process; ability to send crafted serialized paint ops
The fix
The CPU-side structure selection should be keyed on the difference matrix's perspective flag rather than the drawing matrix's, or Slug deserialization should reject perspective creation matrices.
How it was found
- A compromised renderer sets the canvas transform to an arbitrary invertible perspective matrix.
- The renderer sends a serialized DrawSlugOp whose creation matrix is the same perspective matrix.
- During playback the GPU process computes the difference between the two matrices, which is the identity and has no perspective.
- The GPU process therefore allocates a vertex buffer using a 16-byte stride.
- The CPU-side fill sees perspective in the drawing matrix and writes 20-byte vertices, overflowing the buffer.
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.
When a browser draws text, it sometimes prepares a buffer of fixed size and then fills it with vertex data. Here the size calculation and the filling step disagreed about how much space each vertex needs, so the fill could run past the end of the buffer. A malicious renderer process could exploit this to corrupt memory 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.