7 ms·
Cookies Lack Integrity: Real-World Implications
- adamnemecek 11y agoHere's the research paper presented at USENIX https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-zheng.pdf https://www.usenix.org/system/files/conference/usenixsecurit...
- deleted 11y ago[deleted]
- AdmiralAsshat 11y agoI haven't dug around my browser config or the Extensions store in awhile. Does anyone happen to know if IE/Chrome/Firefox can be configured to not accept cookies from non-HTTPS sites?
- jonknee 11y agoDoesn't look like you can in Chrome, at least without a custom extension. They control it based on hostname: https://support.google.com/chrome/answer/3123708 https://support.google.com/chrome/answer/3123708
- paulsutter 11y agoChrome plug-ins have a lot of control over network requests through the webRequest API[1]. They're easy to write - email me if you have questions. [1] https://developer.chrome.com/extensions/webRequest https://developer.chrome.com/extensions/webRequest "Use the chrome.webRequest API to observe and analyze traffic and to intercept, block, or modify requests in-flight"
- LoSboccacc 11y ago"man in the middle can do nasty thing, here is a castle of vulnerabilities we built on top of already having pwnd the communication channel" related http://blogs.msdn.com/b/oldnewthing/archive/2006/05/08/592350.aspx http://blogs.msdn.com/b/oldnewthing/archive/2006/05/08/59235... "It rather involved being on the other side of this airtight hatchway"
- Chlorus 11y agoMy new favorite: "I have discovered a critical security vulnerability in Windows which I intend to present at the XYZ conference. It allows any user with administrator privileges to perform operation Q, something that should be available only to SYSTEM." http://blogs.msdn.com/b/oldnewthing/archive/2015/09/23/10643223.aspx http://blogs.msdn.com/b/oldnewthing/archive/2015/09/23/10643...
- adamnemecek 11y agothat's not a fair comparison since https is supposed to prevent mitm.
- LoSboccacc 11y agoit is fair because the paper injection works by either pwning a subdomain or be the MTM, hence it involves already being on the other side of the airtight hatchway
- HeyImAlex 11y agoBeing the MITM isn't hard ("free public wifi"). That's one of the reasons we have HTTPS. If being MITM can get you around HTTPS then... that's not good.
- MichaelGG 11y agoThe MITM is not "getting around HTTPS". It's exploiting vulnerabilities in web apps. Hence the paper's name of "Cookies Lack Integrity: Real-World Implications" instead of the nonsense "bypass HTTPS" title used here.
- jacobwcarlson 11y agoI can't for the life of me find it, but there was a paper a few years ago about evading App Store policies by purposely introducing vulnerabilities in your app. The idea being that e.g. you have a buffer overflow and the app makes a specific network request that exploits it, resulting in code execution free from Apple's policies. So that ONT post is a bit short-sighted in thinking bugs that don't result in privilege escalation aren't "security holes."
- ck2 11y agosolution: Deploy HSTS on top-level domain yeah easy for you to say
- blfr 11y agoWhy? What's hard about HSTS? Although they don't include subdomains.
- LoSboccacc 11y agonot really hard but a limit of HSTS in this particular scenario is that it doesn't automatically redirect you to https if it is the first visit to the web site, which means if the http channel is compromised (the scenario calls for MTM) the hsts can't do anything to fix it (you can simply strip the 302 locations or tell the server that the other endpoint is talking https). only returning visitor will be redirected client side and only if they saw at some point the HSTS header over https.
- aianus 11y agoPlease see the above comment from toomuchtodo about HSTS preloading.
- LoSboccacc 11y agohey that's great! didn't know there was such a process. will list all my stuff. thanks!
- McRask 11y agoThere is still the issue of trust on first use. Unless the domain is preloaded in the browser as HSTS there is no assurance that there won't be at least one HTTP request.
- toomuchtodo 11y agohttps://hstspreload.appspot.com/ https://hstspreload.appspot.com/ Took five minutes to configure the preload directive for HSTS in our nginx headers and submit our domain.
- techscruggs 11y agoAnother great argument for using signed cookies.
- deleted 11y ago[deleted]
- joosters 11y agoPresumably this could be done transparently by the web server? Incoming cookies could be validated and then the underlying cookie value passed on to the app. Meanwhile, cookies set by the app get rewritten by the web server to include the signature. This would mean that no server-side code would need to be changed in order to support the cookie signing. Are there any web servers out there that do this?
- ademarre 11y agoUnfortunately no. An attacker can inject a signed cookie just as easily as an unsigned one. A signed cookie can prove integrity, that its data hasn't been tampered with; it can't prove that it is coming from the browser it was issued to.
- jerf 11y agoThat is not a thing a cookie can do, so while it may be sad, there's not much to be done about it.
- MichaelGG 11y agoThat's a main point of the paper: taking legit sessions from Attacker and shoving them into Victim, then being able to spy on Victim even when Victim is on HTTPS. Apps aren't handling this case well, as in the example of being signed into GMail under Victim, but showing the chat widget of Attacker.
- daave 11y agoExactly. A better, or at least more general, mitigation than enabling HSTS (though that's a good idea anyway), is to not design your web application in such a way that a modified cookie in the client creates a vulnerability. Since cookies are stored in the client, they are always going to be susceptible to malware on the user's machine. So, trusting that the contents of a cookie were authored by the service receiving them is a bad idea in general. Cookies should be stored along with some additional information that verifies their authorship. A relatively simple way to accomplish this is to have your application include an HMAC in the cookie contents, and verify it whenever the cookie is received. e.g, if you are storing $session_id in a cookie, change your cookie contents to be "$session_id:$hmac_of_session_id", and verify the HMAC every time a cookie is presented. Now a user, or malware, or a MITM, is not in the position to take over or modify a different user's session simply by altering the cookie, since they will not be able to produce a valid HMAC (the key is never shared with the user). If even storing the key in your web frontends is too risky, you could use RSA or DSA signatures, only store the public key in the web frontend that verifies cookies, and store the private key in a more hardened cookie-signing service that isn't directly exposed to external networks. This service can be invoked when new sessions are created or upon user login, if applicable. On top of this, if the client supports ChannelID, you should include the ChannelID in the message that is HMAC'd, so that stolen cookies cannot be reused on other machines.
- nostromo 11y agoBrowsers should consider not showing a green lock unless a site uses HSTS.
- MichaelGG 11y agoBut even with HSTS, if it wasn't preloaded, an attacker could inject cookies on the first visit (then take user to real HTTPS site). Or, if the domain doesn't have full HSTS for all subdomains, there's still a potential vuln as you can inject from non-HSTS subdomains. The paper notes that Google and some other big properties have technical issues in deploying global HSTS.
- ploxiln 11y agoMajor browsers have given up on user indicators anyway. They've decided that all they can do is pass/fail, and if fail, make it very hard for the user to access the site at all. (I hate the trend but that's how it is.)
- paulschreiber 11y agoWhy isn't cert.org using HTTPS by default?
- nchelluri 11y agoI think of the following: - store only session ID in cookie - regenerate session ID upon privilege escalation (login, what else?) - destroy session upon logout That being the case, is this really capable of doing much damage? Especially once you enable HSTS.
- Eridrus 11y agoThis is still vulnerable to the same kinds of attacks you can do with login CSRF: http://seclab.stanford.edu/websec/csrf/csrf.pdf http://seclab.stanford.edu/websec/csrf/csrf.pdf Though the attack scenarios for that are always very tenuous.
- agl 11y agoVU#804060 is talking about "cookie forcing". This is not a new discovery. Here's Chris Evans (not the actor) talking about it in 2008: http://scarybeastsecurity.blogspot.com/2008/11/cookie-forcing.html http://scarybeastsecurity.blogspot.com/2008/11/cookie-forcin... The best solution is to preload HSTS on a domain and include all subdomains, and we've been saying that for years. That prevents any HTTP connections, although it's obviously not an easy solution in many cases. The USENIX paper does suggest some unilateral changes to cookie semantics to address this issue, but any such changes have eye-watering compatibility concerns and could only be deployed after a lot of testing.
- chetanahuja 11y ago"The best solution is to preload HSTS on a domain and include all subdomains" That's the great thing about HTTPS/SSL security. Every attack, every vulnerability, every problem with performance is met with "just make sure your server enables XYZ and blah blah blah is updated and make sure the clients are only connecting from chrome while standing on one leg and singing the national anthem while looking at a picture of the Pope. So yeah, it's actually really secure. When are we going to accept that it's a fool's errand. SSL is a hopeless case and design something better for today's world?
- TD-Linux 11y agoWhat do you suppose TLS 1.3 is?
- chetanahuja 11y agoPlease explain how the OP cookie hijacking attack will be mitigated by TLS1.3?
- grey-area 11y agoWe'd all love to see the plan.
- chetanahuja 11y ago
- PaulHoule 11y agoI am more afraid of the man at the browser and the man in the browser rather than middleman attacks. For instance a user might be trying to use your paid service for free or otherwise get information they are not supposed to and if you are using cookies for authentication, authorization or application state, the user could modify the cookie and break your system. Not to mention the cookie is a vector for XSS, buffer overflows, and other troubles. So if you are sending anything in a cookie that you don't want people to tamper with you should cryptographically sign it, or alternatively, send them a single opaque random identifier that points to a session or request record inside the server. There are way too many cookies on web requests now, and just from the viewpoint of speed, the opaque reference is a performance win in the age of Hazelcast. Replay attacks can be made but there are many countermeasures, such as adding a timestamp and a nonce. This defends against the major threat (the would-be user who wants to abuse your web site) vs a more hypothetical case (sophisticated outsider wants something.)
- MichaelGG 11y agoWhat you're talking about is defending the site. That's great and of course you should do that. What the paper talks about is defending the user. The example they give is being able to inject cookies then override the GMail chat widget with the attacker's account. Such an attack doesn't put the site at risk - Google is fine. But it puts Google's users at risk, as they are signed in, yet chatting on another account.
- derefr 11y agoThe point the GP was trying to make, I think, is that if the site's operator has cared enough about their own security to cryptographically sign their cookies, then this provides security to the users as a free benefit, because a MITM wanting to attack the user doesn't have the site's signing key either.
- MichaelGG 11y agoCookie signing doesn't fix this. Attacker will just login, take his own signed, valid, session cookies, shove them into Victim. Now Victim uses whatever.com and Attacker can see. The example they gave was being able to do this to Gmail. Victim is logged into Gmail, but the Gmail Chat widget is logged in as Attacker.
- coldcode 11y agoSo is this a real issue or a theoretical one? Are people actively using this to do harm or is something someone could do?
- ademarre 11y agoThis exposes a weakness in the "double-submit cookie" CSRF defense technique. https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookies https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(...