Use after free in ANGLE (CVE-2026-0908)
The ANGLE HandleAllocator mishandles handle exhaustion, leading to use of an invalid iterator and a use-after-free. An attacker could potentially trigger a crash or memory corruption by exhausting shader object IDs.
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
Reporter statement
I reported the same issue to Firefox(status: confirmed) because ANGLE’s HandleAllocator does not handle ID-exhaustion correctly. Since Chromium ships the same ANGLE code, I believe Chromium is affected as well. ()
Why I believe Chromium/ANGLE is affected
Firefox and Chromium use the same ANGLE upstream sources for this component (the HandleAllocator implementation is identical or functionally equivalent at the affected site).
I couldn’t find handling for ID-exhaustion on the Chromium side either (same behavior at the allocator level)
VULNERABILITY DETAILS
third_party/angle/src/libANGLE/HandleAllocator.cpp (gl::HandleAllocator::allocate()) mishandles handle-exhaustion. After erasing the last HandleRange from mUnallocatedList, the very next allocation does:
First, when the ID is exhausted,
if (listIt->begin == listIt->end)
{
mUnallocatedList.erase(listIt);
}
due to this code, mUnallocatedList becomes an invalid iterator, and the HandleRange object that was inside calls its destructor.
The problem occurs when, after all IDs are exhausted, you create an object again to receive an ID. When you attempt another allocation after all IDs are exhausted,
auto listIt = mUnallocatedList.begin();
this again accesses an invalid iterator, and due to begin(), you once again obtain the HandleRange object whose destructor should already have been called. Since this HandleRange object did not initialize its begin and end values again,
if (listIt->begin == listIt->end)
{
mUnallocatedList.erase(listIt);
}
this code causes one more erase. At this time, since the size of mUnallocatedList is 0, a problem also occurs in that erase. (In Firefox, when performing that erase, a 4-byte container overflow read occurred in the ASan log, and while attempting to read an inaccessible region, an unhandled exception occurred during debugging. In Firefox, I was able to check the ASan log and follow the debugging to the end, but I could not do so in Chromium. Please refer to the debugging video that will be attached later, and if you can let me know why I could not debug to the end and why the ASan log did not occur, it would be very helpful for submitting the ASan log in the future. I will continue to update the report and attach the ASan log later.)
Environment
Debugger: Visual Studio 2022 Browser: Google Chrome 143.0.7473.0 (Developer Build) (64-bit) OS Name: Microsoft Windows 11 Pro OS Version: 10.0.26100 N/A build 26100 Precondition: Sufficient computer memory resources are required to create a UINTMAX number of shader objects
Reproduction:
Since I do not have sufficient computer memory resources, I have manipulated the begin value as follows: The original HandleAllocator constructor:
HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1), mLoggingEnabled(false) { mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max())); } was modified to:
HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1), mLoggingEnabled(false) { // EXPERIMENT: narrow free range to (2^32-1000 .. 2^32-1) for fast exhaustion
const GLuint kStart = std::numeric_limits<GLuint>::max() - 1000u; const GLuint kEnd = std::numeric_limits<GLuint>::max(); mUnallocatedList.push_back(HandleRange(kStart, kEnd)); } Then, I entered the following code into the web browser's console:
PoC
(() => {
let c = document.querySelector('#dbg-webgl-canvas');
if (!c) {
c = document.createElement('canvas');
c.id = 'dbg-webgl-canvas';
c.width = 4; c.height = 4;
document.body.appendChild(c);
}
window.gl = c.getContext('webgl2') || c.getContext('webgl');
console.log('gl ready:', gl ? (gl instanceof WebGL2RenderingContext ? 'WebGL2' : 'WebGL1') : 'FAILED');
})();
(() => {
if (!gl) { console.warn('run setup first'); return; }
const N = 2000; // Increase if necessary
window.__shaders = window.__shaders || [];
for (let i = 0; i < N; ++i) {
const type = (i & 1) ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER;
__shaders.push(gl.createShader(type));
}
console.log('created shaders:', __shaders.length);
})();
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 HandleAllocator does not properly handle the case when all IDs are exhausted, leading to an invalid iterator being used after erasing the last range.
Impact
Could cause a crash or memory corruption, potentially leading to code execution, but the reporter could not fully debug in Chromium and did not provide an ASan log.
What the attacker needed
Sufficient memory to create many shader objects; modified ANGLE build for fast exhaustion
How it was found
- Modify the HandleAllocator constructor to narrow the free range for fast exhaustion.
- Open the browser console and run the provided JavaScript to create a WebGL context.
- Run the second JavaScript snippet to create many shader objects, exhausting the IDs.
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 component that translates WebGL (graphics) commands. It keeps track of objects like shaders using IDs. When all IDs are used up, a bug causes it to access memory that has already been freed, which can crash the browser or potentially allow code execution.
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.