Webkit WebCore::GraphicsContext use-after-free vulnerability
A use-after-free flaw in WebKit's GraphicsContext handling of the fillText canvas method allows a crafted web page to trigger memory corruption. An attacker could potentially leak information and cause further memory corruption by tricking a victim into visiting a malicious page.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the way Webkit’s GraphicsContext handles certain events in WebKitGTK 2.30.4. A specially crafted web page can lead to a potential information leak and further memory corruption.
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 canvas height change triggers a style update that frees the GraphicsContext, but the code later accesses a gradient from that freed context without revalidating it.
Impact
With proper memory layout control and heap grooming, an attacker could potentially achieve information leak and further memory corruption.
What the attacker needed
Victim visits a malicious web page; WebKitGTK 2.30.4
How it was found
- Create a canvas element and obtain a 2D rendering context.
- Call fillText with text and coordinates.
- During the call, change the canvas height attribute, causing a style update that frees the GraphicsContext.
- The code then accesses the freed GraphicsContext's fillGradient, 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 happens when a program frees some memory but then keeps using it, like deleting a file and then trying to open it. Here, changing a canvas element's height while drawing text causes WebKit to read from memory that has already been freed. An attacker could use this to read sensitive data or crash the browser.
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.