Finding and Exploiting Safari Bugs Using Publicly Available Tools
A use-after-free in WebKit's SVG animation code lets attacker-controlled JavaScript run between obtaining an animator pointer and using it, so the animator can be freed and then used. By changing the animated property type mid-callback, the code ends up with an animator of one type and an animated value of another, giving a type confusion that the author turns into an information leak.
googleprojectzero.blogspot.com
Published on googleprojectzero.blogspot.com
Around a year ago, we published the results of research about the resilience of modern browsers against DOM fuzzing, a well-known technique for finding browser bugs. Together with the bug statistics we also published Domato, our DOM fuzzing tool that was used to find those bugs.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a re-entrancy flaw: resetAnimatedType() holds a raw animator pointer across a call that can run JavaScript, which can delete the animator and change the animated property type, leaving mismatched animator and animated-type objects.
Impact
The type confusion could be turned into an information leak that bypasses ASLR, and the author notes an unreliable exploit could still do damage in a malware campaign; the text does not demonstrate full code execution.
What the attacker needed
Victim loads a malicious page; JavaScript enabled; SVG animation support
The fix
It was fixed by no longer triggering JavaScript callbacks through computeCSSPropertyValue(), so the event handler is processed later.
How it was found
- Load a page whose SVG contains an animate element and an input with a focus handler.
- Trigger the focus handler so it resets the animate element's attributeName.
- Call setCurrentTime on the SVG so resetAnimatedType runs and the handler fires mid-function.
- The handler deletes the animator, and the function then builds the animated type from the freed animator.
- Call resetAnimatedType again so an animator of the new type is created alongside the old animated type.
- When the animated value is calculated, the new-type animator writes into the old-type animated value.
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 write-up has not been written yet. The Original tab links to the source.
When a web page animates something in an SVG image, the browser keeps a small helper object that knows how to handle that kind of value. The bug is that the page's own script can run in the middle of the browser using that helper, and the script can make the browser throw the helper away. The browser then keeps using the thrown-away helper, which is called a use-after-free, and the author shows this can be steered into leaking memory addresses.
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.