Integer overflow in ANGLE (CVE-2026-17682)
A logic desynchronisation between ANGLE's frontend validation and its Vulkan backend allows the framebuffer attachment completeness check to be bypassed. An attacker could trigger an integer underflow in the mipmap level index, passing an out-of-bounds value to Vulkan commands and potentially reading out-of-bounds GPU memory.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
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 logic desynchronization between ANGLE's frontend validation and its Vulkan backend allows the framebuffer attachment completeness validation to be bypassed. By changing the texture base level and executing a copy operation without synchronizing the texture's dirty state, the backend's allocated range and frontend state desynchronize. This causes an integer underflow in toVkLevel when resolving the mipmap level index, passing an out-of-bounds value directly to Vulkan commands.
Affected files:
third_party/angle/src/libANGLE/renderer/vulkan/TextureVk.cppthird_party/angle/src/libANGLE/Context.cppthird_party/angle/src/libANGLE/Texture.cppthird_party/angle/src/libANGLE/validationES2.cppthird_party/angle/src/libANGLE/renderer/vulkan/vk_utils.cpp
Estimated timestamp from git blame: 2023-07-12
Root Cause
Static analysis of the ANGLE source code reveals a potential logic desynchronization between OpenGL ES state validation and the Vulkan backend during texture copy operations.
During validation in ValidateCopySubTextureCHROMIUM (in third_party/angle/src/libANGLE/validationES2.cpp), the source level is validated using isFramebufferAttachmentComplete:
if (!source->isFramebufferAttachmentComplete(sourceLevel, &error))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, error);
return false;
}
Inside Texture::isFramebufferAttachmentComplete (in third_party/angle/src/libANGLE/Texture.cpp), level-range checks are performed:
if (attachmentMipLevel != mState.mBaseLevel &&
(attachmentMipLevel < mState.mBaseLevel ||
attachmentMipLevel > mState.getMipmapMaxLevel())) {
return false;
}
If the requested sourceLevel (e.g., 0) matches the current frontend base level (mState.mBaseLevel = 0), this condition evaluates to 0 != 0 (false), which bypasses this level-range check.
Normally, modifying parameters like GL_TEXTURE_BASE_LEVEL marks the texture's parameter state as dirty (DIRTY_BIT_BASE_LEVEL) and defers backend state synchronization. However, when executing a copy, Context::copySubTexture (in third_party/angle/src/libANGLE/Context.cpp) only performs synchronization via syncStateForTexImage():
ANGLE_CONTEXT_TRY(syncStateForTexImage());
syncStateForTexImage() synchronizes using kTexImageDirtyBits and mTexImageDirtyObjects (which contains an empty dirty objects list kTexImageDirtyObjects). This means the source texture's pending base level change dirty bit is not synchronized before execution.
Consequently, the Vulkan backend retains a stale mFirstAllocatedLevel (e.g., 2 from a prior allocation) while the frontend has updated mState.mBaseLevel to 0. When the copy operation executes and attempts to resolve the Vulkan level index using toVkLevel(sourceLevelGL = 0), it triggers an integer underflow in GetLevelIndex:
vk::LevelIndex GetLevelIndex(gl::LevelIndex levelGL, gl::LevelIndex baseLevel) {
ASSERT(baseLevel <= levelGL); // Stripped in release builds
return vk::LevelIndex(levelGL.get() - baseLevel.get()); // 0 - 2 -> underflow to 0xFFFFFFFE
}
The resulting out-of-bounds mipmap level (0xFFFFFFFE) is written directly into the VkImageSubresourceLayers structure's mipLevel field and submitted to driver-level Vulkan commands (such as vkCmdCopyImage), circumventing host-side boundary checks.
Potential Trigger Path
Based on code flow analysis, the following potential sequence of GLES commands could trigger the underflow on an ES3 context with ANGLE-on-Vulkan (note: these steps are theoretical as our tooling currently lacks the capability to execute code):
-
Generate and bind a source texture
src:C++ GLuint src; glGenTextures(1, &src); glBindTexture(GL_TEXTURE_2D, src); -
Specify and initialize level 0 and level 2 of
srcto mark them initialized:C++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA8, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); -
Set
GL_TEXTURE_BASE_LEVELofsrcto2:C++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 2); -
Bind the texture and perform a dummy draw call to force the Vulkan backend to allocate the underlying
VkImagewithmFirstAllocatedLevel = 2:C++ glDrawArrays(GL_TRIANGLES, 0, 3); -
Revert the
GL_TEXTURE_BASE_LEVELofsrcto0(which flagsDIRTY_BIT_BASE_LEVELbut does not trigger synchronization yet):C++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); -
Generate and allocate a destination texture
dstat level 0:C++ GLuint dst; glGenTextures(1, &dst); glBindTexture(GL_TEXTURE_2D, dst); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); -
Execute the copy operation referencing
sourceLevel = 0:C++ glCopySubTextureCHROMIUM(src, 0, GL_TEXTURE_2D, dst, 0, 0, 0, 0, 0, 64, 64, GL_FALSE, GL_FALSE, GL_FALSE);
At this step, toVkLevel(0) calculates 0 - 2 = 0xFFFFFFFE, recording a malformed copy command straight to the Vulkan driver.
Security Impact
If successfully exploited, this underflow could allow an out-of-bounds GPU memory read (information disclosure). By reading back the destination texture dst (e.g., using glReadPixels), a compromised renderer process could potentially exfiltrate cross-origin GPU memory. On platforms like Android, where the GPU process runs unsandboxed, this represents a significant privilege boundary bypass.
Suggested Fix
To prevent this state desynchronization, the source and destination texture states must be fully synchronized before initiating copy commands.
Inside Context::copySubTexture (and other similar copy functions in Context.cpp), rather than only calling syncStateForTexImage(), ANGLE should explicitly synchronize the source and destination textures. This can be achieved by utilizing syncTextureForCopy:
ANGLE_CONTEXT_TRY(syncTextureForCopy(sourceTexture));
ANGLE_CONTEXT_TRY(syncTextureForCopy(destTexture));
Calling syncTextureForCopy ensures that any pending dirty bits on the texture parameter state (including DIRTY_BIT_BASE_LEVEL) are flushed and synchronized with the Vulkan backend prior to executing copySubTexture operations.
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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
Likely the copy operation only synchronised texture image state, not texture parameter state, so a pending base level change was not flushed to the Vulkan backend before the level index was calculated.
Impact
If successfully exploited, this underflow could allow an out-of-bounds GPU memory read (information disclosure), potentially exfiltrating cross-origin GPU memory; on platforms like Android where the GPU process runs unsandboxed, this represents a significant privilege boundary bypass.
What the attacker needed
ANGLE-on-Vulkan with an ES3 context; Ability to run GLES commands in the renderer
The fix
The copy functions should explicitly synchronise the source and destination textures using syncTextureForCopy before executing copy commands.
How it was found
- Create and bind a source texture.
- Initialise level 0 and level 2 of the source texture.
- Set the source texture's base level to 2.
- Perform a dummy draw to force the Vulkan backend to allocate the image with the base level at 2.
- Revert the source texture's base level to 0.
- Create and allocate a destination texture at level 0.
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.
ANGLE is a layer that translates OpenGL ES commands into Vulkan commands. The frontend checks whether a texture operation is allowed, but the backend that actually talks to the GPU can get out of sync with the frontend. Here, changing a texture's base level and then copying from it without syncing the change caused the backend to calculate a negative mipmap level, which was passed to the GPU driver as a huge number.
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.