Webkit MediaRecorder API stopRecording use-after-free vulnerability
A use-after-free flaw in WebKitGTK's MediaRecorder API occurs when stopping a recording, where a lock object is released before its destructor runs. An attacker could exploit this to cause memory corruption and potentially achieve arbitrary code execution by luring a user to a malicious webpage.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the MediaRecorder API of Webkit WebKitGTK 2.40.5. A specially crafted web page can abuse this vulnerability to cause memory corruption and potentially arbitrary code execution.
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 a locking object's destructor accesses memory after the underlying object has been freed, due to improper lifetime management during the stop recording process.
Impact
A malicious webpage could cause memory corruption and potentially achieve arbitrary code execution, though the text notes that proper heap grooming and timing are needed.
What the attacker needed
Victim visits a malicious webpage; browser is WebKitGTK 2.40.5
How it was found
- Create a media stream destination and a MediaRecorder from its stream.
- Start the MediaRecorder.
- Stop the MediaRecorder, triggering the 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 bug happens when a program frees memory but then keeps using it, like deleting a file but still trying to open it. Here, the browser's recording feature mishandles memory when you stop recording, so a malicious website could corrupt memory and possibly run harmful code on your computer. You would need to visit the bad site for this to happen.
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.