Detecting login state for almost any website on the internet
words.zemn.me
words.zemn.me
https://grepular.com/Abusing_HTTP_Status_Codes_to_Expose_Pri...
FF30 on Kubuntu.
"Update: Some of the example tests on this page no longer work (I don't have a Facebook account anymore and the Twitter URL I used went offline). The technique it's self is still alive and relevant though."
Admittedly it's not the most inciteful post ever but it gives a data point demonstrating that a reportedly non-tested suspect example failed. If you were looking for a FB login verification method then ...
The conclusion: security benefits of CSP outweigh cons.
[1] http://lists.w3.org/Archives/Public/public-webappsec/2014Feb...
[2] http://homakov.blogspot.de/2014/01/using-content-security-po...
Is there anything good that report-uri is used for that is more important than removing this exploit possibility?
http://lists.w3.org/Archives/Public/public-webappsec/2014Feb...
[1] https://grepular.com/Abusing_HTTP_Status_Codes_to_Expose_Pri...
Wouldn't it in theory be possible to require browsers to send an "Embedded-On" HTTP header that contains the domain of the embedding page? Then it's trivial for a website (Facebook/Google in this case) to block all requests from unrecognised domains with HTTP 403 Forbidden – regardless of your login state. It only requires that website owners know which domains they themselves use.
When it comes to Embedded-On, that is what the Origin header that is used in most modern browsers is for. It supersedes the privacy impinging Referer header. What you are describing is essentially 'hotlink' protection for generic resources.
It's not the case that this type of attack hinges on the use of images.
Edited to add:
There are two standards to disallow embedding, but both don't apply to <img> tags:
The X-Frame-Options header [1] applies to frame, iframe and object elements.
CSP's frame-ancestors directive [2] applies to "frame, iframe, object, embed or applet tag, or equivalent functionality in non-HTML resources".
There's may still be an option for blocking embedding as an image though: When trying to load a URL, AFAIK a browser sends a list of accepted content types. This should make it possible for a website to detect when a browser is trying to load a webpage as an image, which the website then can simply respond to e.g. with an error code.
[1] http://tools.ietf.org/html/draft-ietf-websec-x-frame-options...
[2] https://w3c.github.io/webappsec/specs/content-security-polic...
accept: image/webp,*/*;q=0.8
when requesting images.
I'm with you that a special CSP directive would be nice.It turns out you can't actually achieve a simple, secure system by repeatedly rushing to fix problems as they arise.
Everything has to be same origin. Exceptions only to be allowed with case-by-case explicit consent of the user.
The only thing that should bridge one website to another is a link to the 'top' level document.
Google got back to me [...] they had internally discussed
the information leak problems associated with CSP and had
come up with no solutions that did not hamper CSP's
function.
Surely disabling third party cookies would fix this?If it doesn't say www.facebook.com in the address bar, the browser doesn't send the facebook cookies, so the response is always consistent with the user not being logged in.
It might mean '+1' buttons have to be regular links, but other than that who loses out except ad networks?
Personally, I isolate my logged-in Google services in their own separate browser. I was hoping to find (or write) a browser plugin which opens URLs in different browsers based on regex of some sort (i.e. *.google.com, gmail.com, youtube.com links open in Chrome, everything else in Firefox), but I believe this is difficult to achieve because of the way browser sandboxing works (at least in Chrome).
The only difference is when you click to log in, your browser is briefly forwarded to a google.com server that then forwards you back. That, and it's much better for security.
If you are logged in Facebook, the facebook.com cookie is now first-party (because you visited facebook.com) and it is sent each time you make a request to Facebook from other domains. Blocking third party cookies usually mean that you block cookies from domain that you never directly visited (although Firefox has an option to disable ALL third-party cookies, even those from sites you visited [1]).
If the browser prevented sending cookies on cross-domain requests, it would block all authenticated cross-domain calls and that would severely limit the possible integration of web sites and applications. You could still pass session ids in the URL, but these can be sniffed by other servers, e.g., with the REFERER header.
[1] https://support.mozilla.org/en-US/kb/disable-third-party-coo...
It is still vulnerable if a site redirects to a different domain (or if framing is allowed, loads resources from a different domain) depending on private state.
The hash directive, from the CSP 1.1 draft and implemented in Mozilla Central, however, probably opens up a whole lot of new problems - you can check whether a given script matches a given hash.
Dude don't kill this bug, this is only reliable detection to use in other exploits
Now, I realise these will get very annoying very fast, so I suggest you could whitelist which domains can store things permanently and then only send them if the url in the location bar is from the domain which set them (because fuck iframes)... Of course iframes will need to work, so you'll also want to have whitelisting of cookies which can be used in an iframe from this or that domain.
All of which in the end has a pretty harsh setup for average users, but I'd like it.
Login to gmail, check messages, reply to messages, logout. Go see what's happening on twitter... login, scroll through timeline, send some tweets, logout. Go over to salesforce, update some customer records, look at chatter, logout. Jump over to kill some time on HN... login, look at replies to comments/discussions...
You get the picture. Nice idea in theory but immensely impractical for almost any standard user.
Yes, but less impractical than the solution that my parent poster suggested, which was my entire point.
So you've just broken the internet in a pretty major way, but not actually fixed the problem (esp. considering a lot of people don't use tabs or use them very minimally)
Also, it doesn't break the internet - it doesn't tinker with IP or TCP or HTTP or anything. I'm also not suggesting that all browsers do this, it's obviously way too annoying for an ordinary user to put up with. I just want my browser to do it. I want to fix the internet for myself.
Typically browsers haven't been great with this sort of thing, and usually end up being tricked into accepting "first party cookies" from a site through which you are redirected (e.g. Google's login process, where when you click "login", you are redirected from accounts.google.com to youtube.com and eventually to your final destination, so that you have "first party cookies" with Youtube, despite never voluntarily going to the site. Paypal did a similar thing with Doubleclick some years ago, where you clicked a link, it took you to a page where you're redirected to Doubleclick, they give you a tracking cookie, then redirected to the page you wanted to go to).
is this the css :visited issue again?
How does Facebook track sessions again? Right, through cookies. If third-party cookies are disabled, and an img src tag on marcosdumay.com triggers a request to facebook.com, this request will not contain my Facebook session cookie, and I'll appear to be logged out, even when I'm not.
In your browser, you have several options to deal with cookies: allow all of them, allow none, or disable third-party cookies only. Let's say I visit attacker-site.com, which includes both local content and stuff from other domains:
attacker-site.com
|`-- tracking-script.js
|`-- tracking-image.gif
|`-- facebook.com/me
`--- twitter.com/tweet-button.png
Content from other domains is third-party content by definition, and leads to
third-party requests, in this case to facebook.com and twitter.com. If
third-party cookies are disabled, those requests will will not include any
cookies. Even if I'm logged in to Facebook, to attacker-site.com it will appear
as if I'm not.It seems doable that you could use FB to list all people with a given surname in a locality and craft a page that finds which of those people your visitor is. So it could be used for doxing at some level.
You'd also have to be logged in.