GHSL-2020-040: Use After Free in Chrome WebAudio
A use-after-free in Chrome's WebAudio code occurs when a BaseAudioContext is suspended and an AudioScheduleSourceNode is stopped in the same quantum, leaving dangling pointers in finished_source_handlers_. An attacker could trigger this by destroying the context, potentially causing memory corruption in the renderer.
Chrome version: master branch build 79956ba, asan build 80.3987.132 Operating System: Ubuntu 18.04
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
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 code assumed finished_source_handlers_ was always a subset of active_source_handlers_, but ClearHandlersToBeDeleted cleared active_source_handlers_ without clearing finished_source_handlers_, leaving dangling pointers.
Impact
Use-after-free in the renderer, which could lead to memory corruption or code execution.
What the attacker needed
Victim visits a malicious web page
The fix
The issue was fixed in Chrome version 80.0.3987.149.
How it was found
- Suspend a BaseAudioContext and stop an AudioScheduleSourceNode in the same quantum.
- Destroy the context to trigger BaseAudioContext::Uninitialize, which calls ClearHandlersToBeDeleted.
- This clears active_source_handlers_ but leaves finished_source_handlers_ with dangling pointers.
- Trigger DeferredTaskHandler::BreakConnections to cause a use-after-free.
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 is a bug where a program keeps using memory after it has been freed, which can let an attacker control what happens next. Here, Chrome's audio system had a list of finished audio nodes that could still be accessed after the main list was cleared, so the program read freed memory. This could 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.