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

Use after free in Presentation API (CVE-2024-5498)

In the Presentation API's success callback, resolving a promise can run user JavaScript that frees the request object, which is then used afterwards on Android. An attacker could trigger a use-after-free, potentially leading to memory corruption or code execution.

Anymous Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 22 days

VULNERABILITY DETAILS

after issue 40053095 fixed, and then re -adds vulnerabilities.In function PresentationConnectionCallbacks::OnSuccess, Invoking Promise.resolve may trigger user callback. "request_" [0] can be freed in the callback and cause use-after-free.

PoC see https://issues.chromium.org/issues/40053095

[0] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/presentation/presentation_connection_callbacks.cc;l=83;bpv=0;bpt=1 void PresentationConnectionCallbacks::OnSuccess( const mojom::blink::PresentationInfo& presentation_info, mojo::PendingRemotemojom::blink::PresentationConnection connection_remote, mojo::PendingReceivermojom::blink::PresentationConnection connection_receiver) { // Reconnect to existing connection. if (connection_ && connection_->GetState() == mojom::blink::PresentationConnectionState::CLOSED) { connection_->DidChangeState( mojom::blink::PresentationConnectionState::CONNECTING); }

// Create a new connection. if (!connection_ && request_) { connection_ = ControllerPresentationConnection::Take( resolver_.Get(), presentation_info, request_); }

connection_->Init(std::move(connection_remote), std::move(connection_receiver));

resolver_->Resolve(connection_); #if BUILDFLAG(IS_ANDROID) PresentationMetrics::RecordPresentationConnectionResult(request_, true); //[0] #endif }

introduce commit https://chromium-review.googlesource.com/c/chromium/src/+/3540656

Fix

@@ -77,11 +77,10 @@ void PresentationConnectionCallbacks::OnSuccess(

connection_->Init(std::move(connection_remote), std::move(connection_receiver));

  • resolver_->Resolve(connection_); #if BUILDFLAG(IS_ANDROID) PresentationMetrics::RecordPresentationConnectionResult(request_, true); #endif
  • resolver_->Resolve(connection_); }

void PresentationConnectionCallbacks::OnError(

The original report as published on the Chromium issue tracker, by anymous. 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 the promise is resolved before the request object is used for metrics, so a user callback can free it in between.

Impact

Could cause a use-after-free, potentially leading to memory corruption or code execution, though the text does not detail the full impact.

What the attacker needed

Android platform; Presentation API usage

The fix

The fix moves the promise resolution after the metrics call so the request object is no longer used after user code can run.

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 using a piece of memory after it has been released. Here, resolving a promise lets the page's own code run, and that code can cause the request object to be freed while the browser still uses it afterwards.

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 Anymous

View all

1 more disclosed report, 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.