Skip to content
Info disclosure Disclosed report Advanced CVE-2022-29916

Utilizing CSS variables caused a browser behavior that leaks the information on visited links

A page could style links with CSS custom properties whose values point to background images, and the browser's request order for those images differed for visited versus unvisited links. By placing marker links around the list and reading the server's request log, an attacker could tell which links the visitor had previously visited.

mat.sionkowski Follow

Originally disclosed on Mozilla

  • Fixed in 8 days
  • Paid in 15 days
  • Disclosed after 8 days
Text
Created attachment 9268750
files.zip

The video shows it the best: https://drive.google.com/file/d/1StFD0aHblp5iREsysaWbnytvCyj0DnX1/view

If you create multiple links like this:
<a href="https://facebook.com" id="facebook">facebook</a> <br>

with the style like this:
#facebook
{
 --visited-facebook: url('facebook-visited.gif');
 background-image: var(--visited-facebook);
}

Using the CSS variables will cause the browser to request the background image twice. 
If there are multiple links like this, each one with a certain background image - the browser will do one full run of requesting the images, then it will start the second full run of requesting images.

But the behavior completely changes when the same website is refreshed. Somehow caching influences the order of requesting background images. 
After refreshing - the browser still performs two runs of requesting images. The first one consists of all images in the right order. But the second run is one of two:
a) unvisited links, and then - at the end - the visited links 
or
b) only visited links - but still - at the end. 

So no matter what - the background images of visited links get requested right at the end. 

So I added additional links at the beginning and at the end to play a role of markers. Their background images contain a "MARKER" keyword. 

I opened the list of links in the iframe, and added javascript that reloads this inframe after a second to simulate a refresh. 

This way a server creates logs for all requested images. 
I created the script that finds the last entry of the MARKER image in the logs. This way we know that each log entry that happens after that is the entry created by visited links. 
Script "get_history.sh" shows which images got requested after the MARKER ( meaning that they come from visited links).

The original report as published on Mozilla's Bugzilla, by mat.sionkowski. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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's handling of CSS variable substitution for background images caused a second request pass whose ordering depended on the link's visited state, leaking history through timing/order rather than through any direct style read.

Impact

A site could learn which of its listed links a visitor had previously visited, though the leak depended on caching behaviour after a refresh and on the attacker reading their own server logs.

What the attacker needed

Attacker controls the page and its server logs; victim visits the attacker's page; page is refreshed for the ordering to show

How it was found

  1. Create several links, each with a CSS variable holding a background image URL, and apply it as the link's background image.
  2. Add marker links at the start and end whose background images contain a marker keyword.
  3. Load the links inside an iframe and reload it after a second to simulate a refresh.
  4. Inspect the server's request log and find the last marker request.
  5. Treat every image requested after that marker as coming from a visited link.

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 deliberately hide which links you have visited so websites cannot profile you. Here, a quirk in how the browser fetched background images defined through CSS variables made visited links' images load last, in a recognisable order. A site owner watching their own server logs could then work out which of the listed links a visitor had opened before.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.