Privacy isn’t always easy.
We’re close to landing some changes in the Firefox development tree that will fix a privacy leak that browsers have been struggling with for some time. We’re really excited about this fix, we hope other browsers will follow suit. It’s a tough problem to fix, though, so I’d like to describe how we ended up with this approach.
History Sniffing
Links can look different on web sites based on whether or not you’ve visited the page they reference. You’ve probably seen this before: in some cases, visited links are purple instead of blue. This is just one of the many features web designers use to make the web the best it can be, and for the most part that’s a good thing.
The problem is that appearance can be detected by the page showing you links, cluing the page into which of the presented pages you’ve been to. The result: not only can you see where you’ve been, but so can the web site!
Originally specified as a useful feature for the Web, visited link styling has been part of the web for… well, forever. So this is a pretty old problem, and resurfaces every once in a while to generate more paranoid netizens.
The most obvious fix is to disable different styles for visited versus unvisted links, but this would be employed at the expense of utility: while sites can no longer figure out which links you’ve clicked, neither can you. David Baron has implemented a way to help keep users’ data private while minimizing the effect on the web, and we are deploying it to protect our users. We think this represents the best solution to the problem, and we’ll be delighted if other browsers approach this the same way.
Technical Details.
The biggest threats here are the high-bandwidth techniques, or those that extract lots of information from users’ browsers quickly. These are particularly worrisome since they enable not only very focused attacks, but also the widespread brute-force attacks that are, in general, more useful to a variety of attackers (potentially including fingerprinting).
The JavaScript function getComputedStyle() and its related functions are fast and can be used to guess visitedness at hundreds of thousands of links per minute. To make it harder for web sites to figure out where you’ve been without radically changing the web, we’re approaching the way we style links in three fairly subtle ways:
Change 1: Layout-Based Attacks
First of all, we’re limiting what types of styling can be done to visited links to differentiate them from unvisited links. Visited links can only be different in color: foreground, background, outline, border, SVG stroke and fill colors. All other style changes either leak the visitedness of the link by loading a resource or changing position or size of the styled content in the document, which can be detected and used to identify visited links.
While we are changing what is allowed in CSS, the CSS 2.1 specification takes into consideration how visited links can be abused:
“UAs may therefore treat all links as unvisited links, or implement other measures to preserve the user’s privacy while rendering visited and unvisited links differently.” [CSS 2 Specification]
Change 2: Some Timing Attacks
Next, we are changing some of the guts of our layout engine to provide a fairly uniform flow of execution to minimize differences in layout time for visited and unvisited links. The changes cause all styles to be resolved on all links for both visited and unvisited states, and it is stored; then, when the link is styled, the appropriate set of styles is chosen making the code paths for visited and unvisited links essentially the same length. This should eliminate some of the easy-to-mount timing attacks.
Change 3: Computed Style Attacks
JavaScript is not going to have access to the same style data it used to. When a web page tries to get the computed style of a link (or any of its sub-elements), Firefox will give it unvisited style values.
What does this mean for users?
For the most part, users shouldn’t notice a change in how the web works. A few web sites may look a little different, but visited links will still show up differently colored. A few sites that use more than color to differentiate visited links may look slightly broken at first while they adjust to these changes, but we think it’s the right trade-off to be sure we protect our users’ privacy. This is a troubling and well-understood attack; as much as we hate to break any portion of the web, we need to shut the attack down to the extent we can.
We have to be realistic, though: there are many ways all browsers leak information about you, and fixing CSS history sniffing will not block all of these leaks. But we believe it’s important to stop the scariest, most effective history attacks any way we can since it will be a big win for users’ privacy.
If the remaining attacks worry you, or you can’t wait for us to ship this fix, version 3.5 and newer versions of Firefox already allow you to disable all visited styling (immediately stops this attack) by setting the layout.css.visited_links_enabled option in about:config to false. While this will plug the history leak, you’ll no longer see any visited styling anywhere.
Enhancing Privacy on the Web.
We want to bridge the gap between our users’ expectations of privacy and what actually happens on the web. Sometimes users have an expectation that we preserve their privacy a certain way, and if we can, we want to live up to it. Privacy isn’t a feature that can simply be added to a browser, though; it often comes at the expense of utility. We think we’ve found a fix that will balance flexibility for web developers while providing a safer experience for our users on the web.
Sid Stamm, Mozilla Security
Colin Dean
wrote on
Alex Stapleton
wrote on
Giorgio Maone
wrote on
Matthew
wrote on
Sid Stamm
wrote on
Wladimir Palant
wrote on
Adam
wrote on
Sid Stamm
wrote on
helenrae
wrote on
thornmaker
wrote on
Sid Stamm
wrote on
Ulrich
wrote on
Tony Mechelynck
wrote on
Roger
wrote on
David Baron
wrote on
David Baron
wrote on
Alex
wrote on
Damian
wrote on
Remco
wrote on
Steve Krenzel
wrote on
David Baron
wrote on
Apphacker
wrote on
Michael
wrote on
Michael
wrote on
Matt
wrote on
Jaanus
wrote on
Colby Russell
wrote on
Mike Samuel
wrote on
Colby Russell
wrote on
Sid Stamm
wrote on
Anna
wrote on
Frank Yan
wrote on
Ben Curtis
wrote on
James
wrote on
Jesse Ruderman
wrote on
Eris
wrote on
Daniel Veditz
wrote on
Colby Russell
wrote on
Watches
wrote on
AJ
wrote on
Philip
wrote on
Tom
wrote on
Davin
wrote on
ant
wrote on
Sid Stamm
wrote on
Dood
wrote on
mogya
wrote on
Kulmegil
wrote on
Sai Emrys
wrote on
Sid Stamm
wrote on
Sai Emrys
wrote on
Otávio
wrote on
Dhouwn
wrote on
Ferenc Veres
wrote on
Edward Jones
wrote on
Adam Messinger
wrote on
Chris
wrote on
Justen
wrote on
Daniel Veditz
wrote on
Chris
wrote on
Bruce
wrote on
Mitchell Evan
wrote on
bpjonsson
wrote on
izdelava strani
wrote on
Pat
wrote on
Bruce
wrote on
Sid Stamm
wrote on