Skip to content
Memory corruption Advisory Advanced CVE-2024-9960

Use after free in Dawn (CVE-2024-9960)

A reference-counted device object in the Dawn graphics library could be freed by one thread while another thread was still using it, because two threads passed the same null check at the same time. An attacker able to trigger concurrent error handling could cause a use-after-free, which in a browser context may lead to memory corruption or a crash.

Anonymous Follow

Originally disclosed on Chrome VRP

Bounty$2,000 Medium View original
  • Fix shipped in 3 months

#REPRODUCTION CASE This is a difficult-to-reproduce issue caused by conditional race conditions. I have provided the ASAN logs recorded by the FUZZER at the time and a root cause analysis report.

#BISECT https://dawn-review.googlesource.com/c/dawn/+/165527

#RCA

  1. DeviceBase is a reference-counted singleton object.
  2. According to the ASAN logs, threads T0 and T34 both called DeviceBase::HandleError function.
  3. T0 and T34 passed the conditional check mLostEvent != nullptr at position [0] simultaneously.
  4. T0 reached position [1], causing mLostEvent to be released, but T34 had already proceeded to position [2], resulting in a Use-After-Free (UAF) issue.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/dawn/native/Device.cpp;drc=a72186c5de7a11109a88c45bbe1fe6d84e8baf00;l=280
void DeviceBase::HandleError(std::unique_ptr<ErrorData> error,
                             InternalErrorType additionalAllowedErrors,
                             WGPUDeviceLostReason lostReason) {
    AppendDebugLayerMessages(error.get());
...CUT...

    const std::string messageStr = error->GetFormattedMessage();
    if (type == InternalErrorType::DeviceLost) {
        // The device was lost, schedule the application callback's execution.
        // Note: we don't invoke the callbacks directly here because it could cause re-entrances ->
        // possible deadlock.
        if (mLostEvent != nullptr) {												<< [0]
            mLostEvent->mReason = FromAPI(lostReason);
            mLostEvent->mMessage = messageStr;
            GetInstance()->GetEventManager()->SetFutureReady(mLostEvent.Get());		<< [2]
            mLostEvent = nullptr;													<< [1]
        }

        mQueue->HandleDeviceLoss();

The original report as published on the Chromium issue tracker, by Anonymous. 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

Likely a check-then-act race: the null check on mLostEvent and the subsequent release were not atomic, so two threads could both pass the check and one could free the object while the other still used it.

Impact

Concurrent calls to the error handler could trigger a use-after-free, which may cause memory corruption or a crash; the report does not demonstrate code execution.

What the attacker needed

Concurrent error handling on a device; difficult to reproduce reliably

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 two parts of a program run at the same time (threads), they can both check that a shared object exists and then both act on it. Here one thread freed the object after its check, while the other thread had already passed its own check and then used the now-freed object. Using memory after it has been freed is dangerous because the program may read or write data that no longer belongs to it.

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 by Anonymous

View all

2,270 more disclosed reports, best first.

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.