Skip to content
Memory corruption Advisory Advanced CVE-2026-17832

Use after free in ANGLE (CVE-2026-17832)

A use-after-free write vulnerability exists in ANGLE's SyncEGL::initialize because a deferred lambda captures a member variable by reference. A concurrent thread can destroy the sync object before the lambda runs, causing a write to freed 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 Use-After-Free (UAF) write vulnerability exists in ANGLE's SyncEGL::initialize due to a by-reference capture of mSync inside a deferred UnlockedTailCall lambda. Because the lambda executes after the global EGL lock is released, a concurrent thread can destroy the sync object and free the underlying SyncEGL instance prior to the lambda running. When the deferred lambda eventually executes, it attempts to write the driver-returned EGLSync handle into the freed memory of the dangling mSync reference.

Affected files:

  • third_party/angle/src/libANGLE/renderer/gl/egl/SyncEGL.cpp

Estimated timestamp from git blame: 2024-04-23

Description

In ANGLE's OpenGL-on-EGL backend, a potential Use-After-Free (UAF) write vulnerability exists within SyncEGL::initialize (third_party/angle/src/libANGLE/renderer/gl/egl/SyncEGL.cpp).

The issue lies in how the UnlockedTailCall lambda is constructed:

C++
    egl::Display::GetCurrentThreadUnlockedTailCall()->add(
        [egl = mEGL, &sync = mSync, type, attribs = nativeAttribs](void *resultOut) {
            sync = egl->createSyncKHR(type, attribs.data());
            ...

Here, the lambda captures mSync (a member variable of the SyncEGL instance) by reference (&sync = mSync). This lambda is queued to be executed as an unlocked tail call after the global EGL lock is released.

Race Condition & Lifetime Analysis

During the window of time after the global EGL lock is released and before the thread's unlocked tail calls are executed, a concurrent thread can call eglDestroySync on the newly allocated sync object's ID:

  1. Thread A calls eglCreateSync. Under the global lock, Display::createSync allocates a predictable, sequential SyncID and invokes SyncEGL::initialize, which enqueues the UnlockedTailCall capturing &sync (referencing SyncEGL::mSync). The pointer to the Sync object is inserted into mSyncMap before releasing the global lock.
  2. The global lock is released.
  3. Thread B calls eglDestroySync using the sequential SyncID on another thread:
    • In Display::destroySyncImpl, if the per-type synchronization pool (mSyncPools) is full, syncs->erase() is called.
    • This destroys the std::unique_ptr<Sync>, which invokes the destructor of Sync.
    • The destructor of Sync destroys Sync::mFence (which is a std::unique_ptr<rx::EGLSyncImpl>, holding the underlying SyncEGL instance).
    • This immediately frees the heap-allocated SyncEGL object.
  4. Thread A executes its pending tail calls. The lambda runs and executes sync = egl->createSyncKHR(...), writing the returned EGLSync handle into the dangling sync reference, which now points to the freed SyncEGL::mSync field inside the deleted memory block.

Note that even if the idle pool is not full, this can result in double-creation, driver handle leaks, and state confusion if the wrapper is recycled and re-initialized by a third thread prior to the delayed tail call running.

Suggested Remediation

To resolve this lifetime vulnerability, avoid capturing raw member references by reference in deferred tail calls whose parent objects can be asynchronously deleted.

One potential fix is to manage the lifetime of the deferred sync creation via a shared state block (e.g., utilizing a ref-counted state struct or std::shared_ptr) that outlives both the SyncEGL object and the tail call, or to safely perform the driver-level sync creation synchronously prior to releasing the global EGL lock when deferred execution cannot guarantee lifetime safety.

Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379


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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

The deferred UnlockedTailCall lambda captures a member variable (mSync) by reference, but the parent SyncEGL object can be destroyed by another thread before the lambda executes.

Impact

A concurrent thread could cause a write to freed memory, leading to memory corruption that may be exploitable.

What the attacker needed

Multi-threaded EGL usage; concurrent eglCreateSync and eglDestroySync; sync pool full to trigger erase

The fix

The lifetime of the deferred sync creation should be managed via a shared state block (e.g., a ref-counted state struct or std::shared_ptr) that outlives both the SyncEGL object and the tail call, or the driver-level sync creation should be performed synchronously before releasing the global EGL…

How it was found

  1. Thread A calls eglCreateSync, which under the global lock allocates a sequential SyncID and enqueues an UnlockedTailCall capturing a reference to SyncEGL::mSync.
  2. The global lock is released.
  3. Thread B calls eglDestroySync with the sequential SyncID; if the sync pool is full, the Sync object is erased, destroying SyncEGL and freeing its memory.
  4. Thread A executes the pending tail call, writing the returned EGLSync handle into the dangling reference to freed 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.

A use-after-free happens when a program keeps a pointer to memory it has already freed and then writes to it. Here, a delayed task holds a reference to a member of an object that another thread can delete in the meantime, so the task writes into memory that no longer belongs to it. This can corrupt memory and potentially be exploited.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.