Out of bounds write in ANGLE (CVE-2026-87621)
ANGLE's D3D11 backend only used debug-only assertions to check that a destination mipmap level in texture copy operations fits within the allocated D3D11 storage. In release builds, an out-of-bounds level could produce a spec-invalid subresource index passed to the driver, potentially causing out-of-bounds GPU memory writes.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 51 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: In ANGLE's D3D11 backend, destination mipmap level boundaries during texture copies are guarded against the underlying D3D11 storage levels solely by debug-only ASSERTs. In release builds, this allows an out-of-bounds destination level to calculate a spec-invalid subresource index, which is passed directly to ID3D11DeviceContext::CopySubresourceRegion. This results in undefined driver behavior and potentially out-of-bounds GPU memory writes within the GPU process.
Affected files:
third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cppthird_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cppthird_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
Estimated timestamp from git blame: 2018-04-12
- Summary of the Issue (Meant for Human Triage)
In ANGLE's D3D11 backend, the TextureD3D_Cube and TextureD3D_2D texture copy methods (copyTexture and copySubTexture) rely on a debug-only ASSERT to ensure that the user-supplied destination mipmap level (destLevel) fits within the limits of the allocated D3D11 texture storage (mTexStorage).
During front-end API validation (ValidateCopyTextureCHROMIUM), destLevel is only bounded against implementation-defined global caps (e.g., caps.maxCubeMapTextureSize), rather than the destination texture's actual base dimensions. As a result, a validated API call can specify a destLevel that vastly exceeds the texture's actual allocated mipmap storage.
In release builds, the ASSERT macro expands to a no-op. On the D3D11 fast-path (when texture formats match and no flip is required), the out-of-bounds destLevel proceeds to Renderer11::copyTexture. There, it calculates a subresource index via the D3D11CalcSubresource macro. This produces a subresource index far beyond the allocated bounds. This index is passed directly to ID3D11DeviceContext::CopySubresourceRegion. Per the DirectX 11 specification, the runtime does not validate destination subresource indices on this call for performance reasons. This passes a spec-invalid index directly to the User-Mode Driver (UMD), leading to undefined behavior and potential out-of-bounds memory writes into driver-managed GPU memory allocations.
(Note: The steps and exploitation scenarios described below are potential and theoretical, as our automated tooling agent does not have the ability to execute live code or driver-level PoCs.)
- Proof-of-Concept & Detailed Execution Flow
Theoretical Attacker Steps to Trigger the Vulnerability
The attacker can initiate this flow either via a compromised renderer process sending forged IPCs, or potentially via WebGL2 texImage2D manipulating an accelerated canvas source (A-SERVER).
- Destination Texture Creation: The attacker creates a cube map texture with a small base size. For example,
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, data). This defines a 4x4 RGBA8 image. - Source Texture Creation: The attacker initializes a 1x1 source texture. For example,
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data). - Trigger Command: The attacker issues a
CopyTextureCHROMIUMcommand targeting an out-of-boundsdest_level. Parameters:source_id=src,source_level=0,dest_target=TEXTURE_CUBE_MAP_NEGATIVE_Z,dest_id=cube,dest_level=10,unpack_flip_y=0.
Step-by-Step Execution Flow
-
Front-End Validation Gap: The command reaches
third_party/angle/src/libANGLE/validationES2.cpp:ValidateCopyTextureCHROMIUM. It callsIsValidCopyTextureDestinationLevel, which checks thedestLevelagainst global capabilities:C++ // validationES2.cpp:268-270 case TextureType::CubeMap: return width <= (caps.maxCubeMapTextureSize >> level) && height <= (caps.maxCubeMapTextureSize >> level);Since
caps.maxCubeMapTextureSizeis 16384 on D3D11,16384 >> 10 = 16. The source width (1) is<= 16, so validation incorrectly succeeds despite the destination texture's base size only being 4x4. -
Backend Processing & Redefinition: Execution proceeds to
TextureD3D_Cube::copyTexture(third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp:2123). It callsredefineImagewithlevel=10. This successfully definesmImageArray[5][10]on the host without overflowing, asmImageArrayis a statically sizedstd::arraycontainingIMPLEMENTATION_MAX_TEXTURE_LEVELS(16) slots. -
Storage Allocation: The render-target fast path evaluates
canCreateRenderTargetForImagetotrueand callsensureRenderTarget(context). SincemTexStorageis initially null, this triggersinitializeStorage->createCompleteStorage. Storage size is computed based on the base-level image (4x4), resulting inmMipLevels = log2(4) + 1 = 3. TheTextureStorage11_Cubeis instantiated with 6 faces and 3 mips (18 subresources total). -
The Flawed Release-Build Guard: Execution returns to
TextureD3D_Cube::copyTexture:C++ // TextureD3D.cpp:2154-2156 ANGLE_TRY(ensureRenderTarget(context)); ASSERT(isValidFaceLevel(faceIndex, index.getLevelIndex())); ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.getLevelIndex()));The only bounds check ensuring
destLevel < mTexStorage->getLevelCount()is theASSERT(isValidFaceLevel(faceIndex, index.getLevelIndex())). In production release builds, this expands to a no-op, allowing the out-of-boundsdestLevel = 10to bypass safety checks. -
Subresource Calculation Sink: The out-of-bounds level is passed to
Renderer11::copyTexture(third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp). The fast-path conditions are met (!unpackFlipYand matching formats). It calculates the subresource index viadestStorage11->getSubresourceIndex:C++ // TextureStorage11.cpp:213-225 UINT mipSlice = static_cast<UINT>(index.getLevelIndex() + mTopLevel); // 10 UINT arraySlice = static_cast<UINT>(...); // 5 (Negative Z) UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels); // 10 + 5 * 3 = 25The computed subresource
25greatly exceeds the18subresources actually allocated. -
Undefined Behavior Execution:
C++ // Renderer11.cpp:2696 mDeviceContext->CopySubresourceRegion( destResource->get(), destSubresource, destOffset.x, destOffset.y, destOffset.z, sourceResource->get(), sourceSubresource, &d3dBox);The
DstSubresource = 25is passed directly to the D3D11 driver. This induces undefined driver behavior and potential out-of-bounds GPU memory writes.
Potential Fix
Replace the debug-only ASSERT in TextureD3D_Cube::copyTexture, TextureD3D_Cube::copySubTexture, TextureD3D_2D::copyTexture, and TextureD3D_2D::copySubTexture with actual runtime checks.
if (!isValidFaceLevel(faceIndex, index.getLevelIndex()))
{
return angle::Result::Stop; // Or emit GL_INVALID_VALUE / internal error
}
Alternatively, ValidateCopyTextureCHROMIUM should strictly evaluate destLevel against the initialized bounds of the target texture if it is already allocated, rather than relying exclusively on global caps.maxCubeMapTextureSize.
- Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)
The report accurately identifies a validating-layer gap in ANGLE's D3D11 backend. Front-end validation (
ValidateCopyTextureCHROMIUM/ValidateCopySubTextureCHROMIUM) boundsdestLevelagainst global caps rather than the destination texture's actual base-level dimensions. InTextureD3D_Cube::copyTextureandTextureD3D_2D, the destination level's bound against the allocated D3D11 storage levels is only guarded by a debug-onlyASSERT(isValidFaceLevel(...)). In release builds, this is a no-op, allowing an out-of-boundsdestLevelto flow intoD3D11CalcSubresource, generating an out-of-boundsdestSubresourceindex.Applying the KB 'GPU/media driver-sink triage' checklist: (a) Validation function
ValidateCopyTextureCHROMIUMmisses the parameter bound check against the texture's true mip levels. (b) The backend call site ismDeviceContext->CopySubresourceRegioninRenderer11.cpp(fast-path). (c) TheDstSubresourceparameter is explicitly listed as a bounds-bearing parameter in the KB triage table. Since (a), (b), and (c) hold from source, this qualifies for S1 per the GPU validating-layer gap row.Severity calculation:
- The vulnerability is reachable via A-SERVER (WebGL
texImage2Dwith an accelerated canvas source) or A-RENDERER.- The D3D11 backend is Windows-only, so it is rated on Windows.
- The GPU process is sandboxed on Windows, so memory corruption ceilings at High (S1).
- The previous critic downgraded to S2 because 'driver behavior varies', but the guidelines explicitly state that 'requires a specific driver version/vendor' or 'majority of drivers tolerate it' is NOT a downgrade factor. If the (a)/(b)/(c) test passes and it ships on >=1 platform, we rate at that platform's tier.
Probability of being real and exploitable: 100%. The code trace is completely accurate, and the missing validation allows a spec-invalid index to trigger undefined driver behavior.
Codebase Investigator Verification Logs:
ValidateCopyTextureCHROMIUMFlow Verified: Extensively checkedthird_party/angle/src/libANGLE/validationES2.cpp(lines 3533-3662) andIsValidCopyTextureDestinationLevel(lines 251-274). The validator confirmeddestLevelis exclusively verified againstcaps.maxCubeMapTextureSize >> levelwithout factoring in actualdestdimensions, precisely aligning with the vulnerability claim.- Storage and ASSERT Interaction Verified: Analyzed
TextureD3D.cpp(TextureD3D_Cube::copyTexture).redefineImagereleases storage iflevel >= storageLevels, but thencreateCompleteStoragerebuilds it matching the base-level size, meaning the storage level count remains strictly 3 for a 4x4 image. Confirmed the only boundary gate protecting the D3D call fromdestLevel=10isASSERT(isValidFaceLevel(...)). D3D11CalcSubresourceContext Verified: TracedTextureStorage11::getSubresourceIndexusage ofmMipLevels.mMipLevelsis set viaTextureStorage11_Cubeconstructor asmTopLevel + levels(e.g., 3). Passing adestLevelof 10 deterministically produces an OOBdestSubresourceparameter calculation.- Architectural Bounds: Confirmed host bounds are safe because
mImageArraysizes dynamically pad toIMPLEMENTATION_MAX_TEXTURE_LEVELS = 16, ensuring no host heap overflow occurs despite the backend driver overflow.
Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4
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 front-end validation only bounded the destination level against global capability limits rather than the destination texture's actual allocated mip levels, and the backend relied on a debug-only assertion for the real bound.
Impact
This could lead to undefined driver behaviour and potentially out-of-bounds GPU memory writes within the GPU process, though the report notes the exploitation scenarios are theoretical and the GPU process is sandboxed on Windows.
What the attacker needed
Windows with D3D11 backend; Ability to issue WebGL or IPC commands; No live PoC executed
The fix
The debug-only assertions should be replaced with runtime checks that reject invalid destination levels, or front-end validation should check against the destination texture's actual bounds.
How it was found
- Create a small cube map texture as the destination.
- Create a 1x1 source texture.
- Issue a CopyTextureCHROMIUM command with an out-of-bounds destination level.
- The front-end validation passes because it only checks global caps.
- The backend assertion is a no-op in release builds, so the out-of-bounds level reaches subresource calculation.
- The invalid subresource index is passed to CopySubresourceRegion, causing undefined driver behaviour.
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 program copies part of one texture to another, it must check that the destination level exists. Here, that check was only active in debug builds, so in normal builds a bad level number could slip through and be handed to the graphics driver. The driver may then write outside the intended memory, which is dangerous.
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.