TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Timing attack against HSTS to sniff browser history in Chrome and Firefox

257 pointsby bretthopperover 9 years ago

30 comments

ejcxover 9 years ago
Mitigation, get your site added to the HSTS Preload list.<p>Most of the advanced webappsec security features leak information. CSP, HPKP, HSTS, etc, which was all 100% known.<p>This talk is excellent because it puts together the attacks into real PoCs, real attacks, and great information on how it all works. These attacks in the talk are quality too, instead of being &#x27;mostly&#x27; theoretical.<p>This wasn&#x27;t really documented all in one place, or as high quality in the past. Way to go @bcrypt. High quality work.
评论 #10456018 未加载
评论 #10456050 未加载
评论 #10457285 未加载
评论 #10456038 未加载
hobsover 9 years ago
Probably a good idea to edit the title to indicate that this is an example attack site as well, not my favorite thing in general to land on without warning.<p>No js seems to mean no worries though.
评论 #10456119 未加载
评论 #10456077 未加载
评论 #10456559 未加载
评论 #10458557 未加载
zmanianover 9 years ago
The site attacks seems to fail in Tor Browser. It returns a list of sites that have nothing to do with my browser history. Probably because Tor Browser reduces the time precision.[1]<p>It seems like it would be nice to require some sort of user privilege escalation like accessing location, or webcam to access high precision timing. This would close off a huge class of time related side channels.<p>[1]<a href="https:&#x2F;&#x2F;trac.torproject.org&#x2F;projects&#x2F;tor&#x2F;ticket&#x2F;1517" rel="nofollow">https:&#x2F;&#x2F;trac.torproject.org&#x2F;projects&#x2F;tor&#x2F;ticket&#x2F;1517</a>
评论 #10456799 未加载
markbnjover 9 years ago
I hit the page from Chrome 45.0.2454.101 and it literally did not get a single site that I regularly visit. It did make a hit on Reddit, I guess, but I have only visited the site two or three times, and you could probably say that about 2&#x2F;3 of the population.
评论 #10456101 未加载
评论 #10456138 未加载
评论 #10456286 未加载
评论 #10456764 未加载
devitover 9 years ago
The root problem seems to be that the web security model is broken because you can get onload AND onerror callbacks from img coming from 3rd party sources regardless of CORS.<p>You are not allowed to read the content of those resources for security reasons, and the fact that you can detect whether they have been loaded seems just as broken (although obviously this usually only has privacy impact, while reading the contents easily allows impersonating the user or stealing secrets).<p>This attack abuses this by using HTTP URLs and causing HTTPS to trigger onerror by using a content security policy that disallow HTTPS, which allows to measure timing of the HTTP-&gt;HTTPS redirection, which is instantaneous if the site had already been visited due to HSTS caching.<p>So I think two changes are needed:<p>1. The browser should never fire onerror on non-CORS-allowed 3rd party resources, but instead fire onload even if an error happens<p>2. The onload event should ideally be triggered 1 second after the resource has been seen regardless of whether it has been loaded or not. If that breaks too many websites, the timing granularity should be rounded to the greatest period possible.<p>There is also the problem of lots websites having CORS policies that allow * , so should probably also fix browsers to not allow sites to have CORS * policies, at least for this purpose.<p>Alternatively, it might be possible to load those resources normally, but effectively consider them to be a &quot;3rd party origin from 1st party origin&quot; that is different from &quot;3rd party origin&quot; and from other 1st party origins for all caching purposes.<p>However, this seems risky because if the 3rd party site manages to somehow fingerprint the user (e.g. because the IP address is whitelisted) then that information is potentially leaked to the 1st party site. For example, it would be possible to detect whether your IP is whitelisted by a domain that otherwise returns errors to everyone.
评论 #10457644 未加载
评论 #10456957 未加载
评论 #10457079 未加载
peteretepover 9 years ago
Having disabled NoScript, Privacy Badger, HTTPS Everywhere, and AdBlock Pro, it can tell I&#x27;ve been to npmjs.com. I&#x27;m not immediately worried.<p>Maybe too obvious to point out, but as far as I can tell, it looks for entries in the browser cache, rather than looking at the history per-se. If you have the browser cache empty when you close the browser (gotta watch those evercookies!), that&#x27;s also not an issue.
评论 #10456127 未加载
SanPilotover 9 years ago
This approach is rather interesting. But I&#x27;m wondering whether a similar attack could be made by placing links on a web page and using the CSS :visited selector to change the style of visited web pages. Couldn&#x27;t you then check which links have that formatting and which don&#x27;t via JS?
评论 #10456244 未加载
评论 #10455966 未加载
评论 #10455968 未加载
hoverbearover 9 years ago
One nice thing is that it is quite inaccurate, I&#x27;ve visited a large number of the sites it tells me I haven&#x27;t.
评论 #10456132 未加载
评论 #10456148 未加载
woogleyover 9 years ago
I think many popular sites will be a false positive because some browsers ship with a list of HSTS domains.. visiting them in HTTP first wouldn&#x27;t happen. <a href="https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;chromium&#x2F;codesearch#chromium&#x2F;src&#x2F;net&#x2F;http&#x2F;transport_security_state_static.json" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;chromium&#x2F;codesearch#chromium&#x2F;src&#x2F;n...</a>
评论 #10458207 未加载
jpdusover 9 years ago
Strange. I disabled &quot;scripts from 3rd party sites&quot; and &quot;frames from 3rd party sites&quot; by default in ublock origin and this site successfully loads 329 external JS ressources from other sites (none are manually enabled). Does anyone have the same problem? Is this a bug of ublock origin or expected behaviour?
评论 #10456981 未加载
lifthrasiirover 9 years ago
A slide discussing HSTS+CSP attack (this one) and also HPKP attack: <a href="https:&#x2F;&#x2F;zyan.scripts.mit.edu&#x2F;presentations&#x2F;toorcon2015.pdf" rel="nofollow">https:&#x2F;&#x2F;zyan.scripts.mit.edu&#x2F;presentations&#x2F;toorcon2015.pdf</a>
michaelmiorover 9 years ago
This was wildly inaccurate for me. I think it was wrong far more than it was right.
bobedybobbobover 9 years ago
The core issue is the same that leads to cross domain search timing attacks [1] (which can be prevented with CSRF tokens)<p>With timing HTTP-&gt;HTTPS redirections maybe the issue is not that the response can be timed but that HTTP exists in the first place? There are other similar timing attacks that can easily be used to identify if a user is logged in to a specific website [2].<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10211306" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10211306</a> [2] <a href="http:&#x2F;&#x2F;crypto.stanford.edu&#x2F;~dabo&#x2F;papers&#x2F;webtiming.pdf" rel="nofollow">http:&#x2F;&#x2F;crypto.stanford.edu&#x2F;~dabo&#x2F;papers&#x2F;webtiming.pdf</a>
EngineerBetterover 9 years ago
Completely inaccurate for me.
dgoldstein0over 9 years ago
Hm, tried this on my Android phone first and it didn&#x27;t seem accurate - might have found 1 or 2 sites I actually visited, a few I wasn&#x27;t sure of, and would randomly change between reloads. Seems to work much better on desktop Chrome (win 7). Wonder why there&#x27;s a discrepancy.
miragesover 9 years ago
I&#x27;m using Chrome 46.0.2490.80 without HTTPS Everywhere and it couldn&#x27;t find any site I visited (tells me I visited none). I tried to visit a few and restart the test, it didn&#x27;t found anything either<p>Edit : retried in Firefox 41.0.2, it&#x27;s giving accurate results
Tinyyyover 9 years ago
How much of this is accurate, and how much of this is simply the top XXX sites that people visit?
评论 #10456429 未加载
评论 #10455915 未加载
gerglesover 9 years ago
Thankfully, this particular attack does not work with a running µmatrix. I do see a bunch of image requests to all these domains, but it shows that I haven&#x27;t visited any (except for the ones that are blocked completely by hosts files, amusingly enough).
评论 #10456155 未加载
RA_Fisherover 9 years ago
I was skeptical at first, then I visited some of the sites it said I had not visited. A second round caught them, eep! A little machine learning could probably make this much more accurate, the PoC is clear.
whoopdedoover 9 years ago
Are timing attacks over the internet affected by buffer bloat?<p>Not a single positive even though I have visited a number of the sites on the list. There&#x27;s even tabs open for Reddit right now.
drvc33over 9 years ago
this worked on an older version of chrome for me, but not the recent ones -- the sites listed were incorrect.<p>additionally, some alternative browsers based on chromium also gave inaccurate results when used on ipad and android.<p>this is strictly based on my exp w&#x2F; my own machines. im a security researcher so maybe my machines exhibit more unconventional settings &#x2F; environments that are atypical of the avg user.<p>will try again later on a different machine. this is interesting stuff,good work.
sengorkover 9 years ago
Security features (like any software features in general) are additional vulnerability vectors prone to implementation flaws.
gbraadover 9 years ago
Tried with Firefox for Android 41 and it is quite accurate.<p>Note: in China, so sometimes HTTPS actually fails to establish
BillinghamJover 9 years ago
Doesn&#x27;t seem to be working in Safari on Mac. I&#x27;m getting over 650 CSP errors in my console.
spacehomeover 9 years ago
I&#x27;m using HTTPS Everyhwere, and it couldn&#x27;t get a single website correct.
评论 #10456040 未加载
loginusernameover 9 years ago
Does not seem to work without Javascript enabled.
hamhamedover 9 years ago
A different version of this would of been to mess around with the :visited css selector since it&#x27;s assuming a list of domains that you probably visit
评论 #10455974 未加载
voltagex_over 9 years ago
Wow. Our corporate proxy isn&#x27;t going to like that many requests that quickly from one box. I wonder if they can add a landing page.
评论 #10456990 未加载
评论 #10455910 未加载
scosmanover 9 years ago
Sites you probably haven&#x27;t visited: &quot;myspace.com&quot; &lt; pffft. That&#x27;s too easy.
grflynnover 9 years ago
Luckily I have taken out entire classes of attacks against the browser (this one included) using simple, baseline configs that harden the browser. I am unsure how many people take these measures and I don&#x27;t know the stats for how many people are hardening their browser in some way, but I suspect large swathes of web users are at risk here.<p>Since this is Hackernews, my efforts to educate the masses on weaponized browser attacks like this would be futile, and I am sure many have configured their browser in some rudimentary way to merry away the assholes.<p>There is a certain sigh of relief and &#x27;ha catch me if you can&#x27; that coats me when I see PoCs like this rendered obsolete and inert.