Rogue Websites Exploit Flaw to Track Your Web History

webcam spying
Be careful the next time you visit some of the Web's most popular porn, news, and torrent sites as they could be peeking at your browser history without your consent. Researchers at University of California, San Diego have discovered that 485 of the 50,000 most popular Websites in the world are exploiting a flaw that lets them read your browser's Web history. The offending sites include YouPorn.com, Gamesfreak.com, Newsmax.com, and TwinCities.com, according to the researchers.

Called history sniffing, the combination of JavaScript and Cascading Style Sheet (CSS) properties enables the sites to figure out where you've been on the Web. The researchers' findings are published in a new study entitled "An Empirical Study of Privacy-Violating Information Flows in JavaScript Web Applications."

If you want to make sure you're protecting your Web browsing history from bad actors, read on to learn how history hijacking is done and how you can prevent it.

History Sniffing

CSS is a Web development language that controls many elements of a Web page's layout and is a commonly used tool among Web developers. One property of CSS is the "a:visited" property that displays visited Web links in a different color (typically purple) from links you haven't visited (typically blue). These properties are stored by your browser so that it can display the appropriate color for every link you come across on the Web.

What history hijackers do to find out where you've been is hide on their Web pages some invisible Web links to third-party sites such as Amazon, Twitter, and Facebook. Then the spying sites use a snippet of JavaScript code to find out from your browser what color the hidden links should have. After that's done, it's pretty straightforward to create a list of sites your browser has visited and sites it hasn't.

Who's Tracking

Although the researchers found 485 sites are exploiting the history-sniffing flaw, 46 of those sites are actively downloading your browser history. The researchers also found that another 17 sites for a total of 63 are transferring your browsing history to their network, but couldn't confirm the sites were using the information collected. The majority of sites, according to the UC San Diego researchers, are only inspecting the style properties and nothing more.

Reading over the researcher's findings, it's amazing to see how many hidden links are used by each site. About 18 of the offending 46 sites, such as Gamestorrents.com, FullTono.com, and PetitChef.com, are using the exploit to analyze your past visits to more than 220 sites. YouPorn.com, an amateur porn site and one of the 100 most visited sites on the Web, analyzes your browsing history for more than 21 sites, according to the researchers.

History sniffing is nothing new, but the UC San Diego study shows just how prevalent this exploit is. The researchers even say that some Web analytics companies such as Tealium and Beencounter provide history-sniffing services to their clients.

History-Sniffing Implications

It's easy to get carried away with the fear that your browsing history could be used for some nefarious purpose. One possibility could be building a profile about you based on your browsing history and other information collected by the site.

But there are also more benign uses of history sniffing that can actually make your browsing experience better, some Web developers argue. Blogger and Web developer Niall Kennedy points out that you can use history sniffing to determine which social networking sites you visit and show you "share" or "like" buttons only for those specific sites. Other uses include targeting you with your favorite blog aggregation service such as Google Reader and Netvibes, instead of showing you every RSS reader link on the planet. Or displaying mapping services you are more likely to use, such as Google Maps or MapQuest when you click a "show map" link.

There's no question, however, that having a Website target you in such a specific way can, as Google CEO Eric Schmidt might say, "cross the creepy line."

If you don't want your history sniffed or hijacked, there are several things you can do. Many modern browsers, including Google Chrome, Apple Safari, and Mozilla Firefox are able to defend against history sniffing. Internet Explorer may also defend against this attack if you use the browser in private browsing mode. If you want to make sure you are completely protected, you could also use the Firefox browser add-on NoScript that prevents sites from running JavaScript in your browser. Firefox users could also disable CSS visited links by modifying the browser's about:config file.

In addition to history sniffing, the UC San Diego researchers also looked at how major sites such as YouTube and The Huffington Post use scripts to track your mouse pointer movements. You can find the complete study here.

Connect with Ian Paul (@ianpaul) and Today@PCWorld on Twitter for the latest tech news and analysis.

Subscribe to the Security Watch Newsletter

Comments