Heap buffer overflow in ANGLE (CVE-2026-9926)
A mismatch between the allocated staging buffer size and the load function's write size for the GL_BGR5_A1_ANGLEX format causes a heap buffer overflow in ANGLE's Vulkan backend. A compromised renderer could send a crafted TexImage2D command to the GPU process, leading to memory corruption and potentially arbitrary code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 50 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 without the security team.
Overview: A format mapping mismatch exists in ANGLE's Vulkan backend when processing the GL_BGR5_A1_ANGLEX internal format. The system allocates a staging buffer assuming 2 bytes per pixel, but selects a load function that writes 4 bytes per pixel, leading to a potential out-of-bounds write (heap overflow) in the GPU process.
Affected files:
third_party/angle/src/libANGLE/renderer/load_functions_table_autogen.cppthird_party/angle/src/image_util/loadimage.cppthird_party/angle/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cppthird_party/angle/src/libANGLE/renderer/Format_table_autogen.cpp
Estimated timestamp from git blame: 2021-09-08
Description
A potential out-of-bounds (OOB) write vulnerability exists in ANGLE's Vulkan backend. The issue arises from a discrepancy between how ANGLE calculates the required staging buffer size for a specific internal format and the amount of data written by the function selected to load that data.
Specifically, when an image is loaded using the internal format GL_BGR5_A1_ANGLEX (0x6ABD) paired with the type GL_UNSIGNED_BYTE, the following occurs in third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp (ImageHelper::stageSubresourceUpdateImpl):
- Allocation: ANGLE maps
GL_BGR5_A1_ANGLEXto the Vulkan storage formatangle::FormatID::B5G5R5A1_UNORM. This format has a definedpixelBytesof 2. Consequently, ANGLE allocates a Vulkan staging buffer sized for exactly 2 bytes per pixel (2 * width * height * depth). - Load Function: ANGLE retrieves the load function for this format/type combination. In
load_functions_table_autogen.cpp,GL_BGR5_A1_ANGLEXwithGL_UNSIGNED_BYTEmaps toLoadRGB5A1ToRGBA8. - OOB Write: The
LoadRGB5A1ToRGBA8function (inloadimage.cpp) performs a 16-bit to 32-bit pixel expansion. For every pixel processed, it unconditionally writes 4 bytes (uint8_t) to the destination staging buffer.
Because the buffer is allocated for 2 bytes per pixel, writing 4 bytes per pixel results in a massive contiguous heap overflow, writing past the allocated buffer bounds by 2 * width * height * depth bytes.
Impact
A compromised renderer process can trigger this vulnerability by sending a maliciously crafted TexImage2D IPC command to the GPU process. The passthrough command decoder forwards this to ANGLE, where ValidES3FormatCombination explicitly accepts the parameters. This results in a highly reliable heap overflow in the unsandboxed GPU process. The attacker dictates the overflow size via texture dimensions and partially controls the corrupted memory content through the deterministic 5-5-5-1 to 8-8-8-8 pixel expansion, potentially leading to arbitrary code execution.
Suggested Steps to Trigger (Theoretical)
Note: These are potential steps based on code analysis; our tooling cannot yet execute a working proof of concept.
- Compromise a renderer process.
- Construct a
TexImage2Dcommand via the command buffer IPC mechanism. - Set the parameters to trigger the vulnerable path:
internalformat=0x6ABD(GL_BGR5_A1_ANGLEX)format=GL_BGRA_EXTtype=GL_UNSIGNED_BYTE
- Provide shared memory containing the 16-bit pixel data.
- The GPU process will allocate a 2bpp staging buffer but write 4bpp into it, causing memory corruption.
Suggested Fix
The autogeneration scripts that map internal formats to storage formats and load functions must be synchronized.
Either:
- Change the mapping in
load_functions_table_autogen.cppso thatGL_BGR5_A1_ANGLEX+GL_UNSIGNED_BYTEuses a load function that does not expand to 32-bits (i.e., writes exactly 2 bytes per pixel to matchB5G5R5A1_UNORM). - If 32-bit expansion is required, change the storage format mapping in
vk_format_table_autogen.cppforGL_BGR5_A1_ANGLEXto a format withpixelBytes = 4(e.g., a standard 8-8-8-8 format) so the staging buffer is allocated with sufficient size.
Evaluated with Chrome root at commit: 137d451a126685dd5010e6609db9f6d4a78d8234
Results 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.
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 autogeneration scripts that map internal formats to storage formats and load functions are out of sync, so the buffer size calculation and the load function's write size disagree.
Impact
A compromised renderer could trigger a highly reliable heap overflow in the unsandboxed GPU process, potentially leading to arbitrary code execution.
What the attacker needed
Compromised renderer process
How it was found
- Compromise a renderer process.
- Construct a TexImage2D command via the command buffer IPC mechanism.
- Set the parameters to trigger the vulnerable path: internalformat = 0x6ABD (GL_BGR5_A1_ANGLEX), format = GL_BGRA_EXT, type = GL_UNSIGNED_BYTE.
- Provide shared memory containing the 16-bit pixel data.
- The GPU process will allocate a 2bpp staging buffer but write 4bpp into it, causing memory corruption.
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 an image is loaded, the program reserves a small box in memory for it but then writes twice as much data into that box, spilling over into neighbouring memory. This can corrupt other data and, in the worst case, let an attacker run their own code. The bug is in a graphics component called ANGLE, which translates drawing commands for the GPU.
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.