Use after free in GPU (CVE-2026-7918)
A logic error in the GPU command decoder skips cleanup of a buffer's mapping state when an allocation fails, leaving a dangling pointer to driver memory. A compromised renderer could write attacker-controlled data to that freed memory, potentially achieving code execution in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 34 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 potential logic error in GLES2DecoderPassthroughImpl::DoBufferData skips cleaning up internal mapped buffer state when an allocation error occurs in ANGLE. This leaves a dangling pointer to unmapped driver memory, which can be written to via a subsequent glUnmapBuffer command. A compromised renderer could exploit this to achieve arbitrary code execution in the GPU process, escaping the sandbox.
Affected files:
gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
Estimated timestamp from git blame: 2021-06-30
Description
A potential write-after-unmap vulnerability exists in gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc within GLES2DecoderPassthroughImpl::DoBufferData.
When glBufferData is called on an already-mapped buffer, the OpenGL ES specification dictates an implicit unmap. ANGLE handles this unmap before attempting to allocate the new buffer.
If the new allocation fails (e.g., triggering a GL_OUT_OF_MEMORY because of an impossibly large size request during robust resource initialization), DoBufferData catches the error via CheckErrorCallbackState() and executes an early return. Crucially, this early return skips the cleanup code (resources_->mapped_buffer_map.erase(...)) that removes the buffer's mapping information from the decoder's state.
Normally, an OOM error destroys the context. However, a compromised renderer can bypass this by setting lose_context_when_out_of_memory to false in the ContextCreationAttribs during the initial context creation IPC.
Because the context survives and the mapping is not erased, the decoder retains a stale pointer to the implicitly unmapped driver memory. The attacker can then trigger DoUnmapBuffer, which copies attacker-controlled data from shared memory into this dangling driver pointer before unmapping.
Impact
This issue provides a powerful Write-After-Free (Write-After-Unmap) primitive. Because the dangling pointer points to driver-allocated memory (e.g., Vulkan, Metal, or D3D11) rather than PartitionAlloc memory, it is not protected by MiraclePtr (BackupRefPtr). A compromised renderer could potentially exploit this to overwrite adjacent driver structures and achieve Remote Code Execution (RCE) in the highly privileged GPU process, escaping the sandbox.
Suggested Exploitation Steps
Note: These are potential steps based on code analysis; our tooling cannot yet execute a working Proof of Concept.
- A compromised renderer process creates a new GLES context, setting
lose_context_when_out_of_memory = falsevia theContextCreationAttribsIPC payload. - The attacker allocates a buffer and maps it for writing using
glMapBufferRange. Chrome safely stores the driver's mapping pointer inmapped_buffer_map. - The attacker issues a
glBufferDatacommand for the exact same buffer with a massivesizeand anullptrdata argument. - Inside ANGLE, the buffer is implicitly unmapped (freeing the driver memory). ANGLE then attempts to allocate a zero-filled buffer of the massive size, which fails and returns a
GL_OUT_OF_MEMORYerror. - Chrome intercepts the error. Because context loss on OOM was disabled in Step 1, the context safely survives.
DoBufferDataearly-returns, abandoning the cleanup and leaving the stale driver pointer inmapped_buffer_map. - The attacker populates the shared memory associated with the mapping with a malicious payload.
- The attacker calls
glUnmapBuffer(orglFlushMappedBufferRange). Chrome retrieves the stale pointer and performs amemcpyof the attacker's payload directly into the freed driver memory.
Suggested Fix
The cleanup of mapped_buffer_map should not be conditionally bypassed if an error occurs. In GLES2DecoderPassthroughImpl::DoBufferData, the buffer mapping should be erased unconditionally if the API call is made, as the implicit unmap happens in ANGLE regardless of whether the subsequent buffer allocation succeeds.
For example, move the erase operation before the error check:
CheckErrorCallbackState();
api()->glBufferDataFn(target, size, data, usage);
// Calling buffer data on a mapped buffer will implicitly unmap it in the driver.
// We must unconditionally remove it from our tracking map, even if the allocation below failed.
resources_->mapped_buffer_map.erase(bound_buffers_[target]);
if (CheckErrorCallbackState()) {
return error::kNoError;
}
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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 an early return on allocation error skips the cleanup that removes the buffer's mapping entry, leaving a stale pointer to implicitly unmapped driver memory.
Impact
A compromised renderer could potentially overwrite adjacent driver structures and achieve remote code execution in the GPU process, escaping the sandbox.
What the attacker needed
Compromised renderer process; ability to create GLES context with OOM loss disabled
The fix
The buffer mapping should be erased unconditionally after the buffer data call, before checking for errors.
How it was found
- A compromised renderer creates a GLES context with context loss on out-of-memory disabled.
- The attacker allocates a buffer and maps it for writing.
- The attacker issues a buffer data command for the same buffer with a massive size and no data.
- The driver implicitly unmaps the buffer, then the allocation fails with an out-of-memory error.
- The decoder early-returns without erasing the mapping, leaving a stale pointer.
- The attacker fills shared memory with a payload and calls unmap, causing a copy into freed driver memory.
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 frees memory but keeps a pointer to it, that pointer is called dangling. If the program later writes through that pointer, it can corrupt other data or let an attacker run their own code. Here, a mistake in Chrome's graphics code left such a pointer behind after a failed memory allocation.
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.