History leakage through anchors in SVG in canvas tags
A web page could embed an SVG containing anchor elements inside an image, draw that image into a canvas, and then inspect the pixels or the resulting PNG file size to detect whether the user had previously visited certain URLs. This leaked the user's browsing history despite the browser's normal restrictions on visited-link styling.
Originally disclosed on Mozilla
- Fixed in 5 days
- Paid in 12 days
- Disclosed after 5 days
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20171120142222
Steps to reproduce:
Demo: http://homepages.cs.ncl.ac.uk/dan.jackson/avisited/
...you may need to reload a couple of times to make it work.
1. Place an <a> tag for each history sniffing attempt in an external SVG document (within a 'foreignObject' tag)
2. Create an <img> that references the SVG file
3. Draws that image to a <canvas> element
4. Try one/both of:
a. look through the pixels to find the a:visited colour; or
b. save the canvas as a (PNG) Blob to see if there is a file size difference (the unvisited colour is the same as the background colour, resulting in a smaller file).
Actual results:
The page is (at least after reloading) able to determine URLs I have previously visited.
Expected results:
The page should not be able to sniff the user's browsing history.
In particular, it looks like other browsers render "a:visited" the same as "a" when drawing SVG to an image.
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 browser applied the visited-link colour when rendering an SVG image into a canvas, instead of treating the image as unvisited as other browsers do.
What the attacker needed
Victim visits a malicious page; page may need reloading to work
The fix
The browser should render visited anchors the same as unvisited ones when drawing SVG into an image, as other browsers do.
How it was found
- Place anchor tags for each history-sniffing attempt inside an external SVG document within a foreignObject tag
- Create an image element that references the SVG file
- Draw that image onto a canvas element
- Inspect the canvas pixels for the visited-link colour, or save the canvas as a PNG blob and compare file sizes
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.
Browsers normally hide whether you have visited a link, so websites cannot learn your browsing history. Here, the page put links inside a picture (an SVG image), drew that picture onto a canvas, and then checked the colours or file size to see if the links looked different because they had been visited. That difference revealed which sites the user had been to.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.