News for hackers. Stuff that matters.
Re:Issue: Bitbucket relies on the Referer HTTP header by hedora on Monday January 02, 2017 @12:09PM (#13302450)
So redirecting all port 80 requests to https://<domain>/ (or otherwise kill port 80 on the server).

Then, make sure each page view overwrites / clears any side-effecting session state.

Put another way, why should unexpected cookies change the side effects of post requests?

Anyway, if the browser is connecting via port 80, the MITM can just use a transparent http->https proxy to rewrite the referrer, and forward the request to the https server, so you've already lost.

Re:Issue: Bitbucket relies on the Referer HTTP header by innoying on Monday January 02, 2017 @12:17PM (#13302541)
I think you're misunderstanding the attack scenario here:

> Anyway, if the browser is connecting via port 80, the MITM can just use a transparent http->https proxy to rewrite the referrer, and forward the request to the https server, so you've already lost.

That wouldn't actually work since the user's active session cookie has the "Secure" flag set (i.e. isn't sent over HTTP). Sure if the user logged-in again on the HTTP page you could exploit this with a transparent proxy but there's very little outside of implementing HPKP that BitBucket could do to prevent that attack.

Re:Issue: Bitbucket relies on the Referer HTTP header by berdario on Monday January 02, 2017 @12:33PM (#13302696)
Exactly

But even shutting down access to port 80 on the server wouldn't be enough: the attacker only needs the victim to send the request, it doesn't need for the plaintext request to actually reach the server

(did you mean HSTS instead of HPKP, btw? The scenario I described didn't involve MITM of a HTTPS connection, and thus HPKP wouldn't be strictly needed )

also, I agree that the condition under which this check might be useful are quite convoluted... since Security is often in tension with Usability there is a case to be made for less defense-in-depth, and removing (potentially?) redundant checks... but I think we should be wary of making simplistic arguments for it, due to how delicate web app security is

Re:Issue: Bitbucket relies on the Referer HTTP header by hedora on Monday January 02, 2017 @01:09PM (#13303025)
Agreed; killing port 80 just decreases the chances the browser makes subsequent port 80 requests.

I still think the referrer is only helping paper over a deeper design flaw (using cookies to carry post state) at the expense of getting some users to trade privacy for availability, and decreasing performance/opening up attacks for people that install extensions as a workaround.

Re:Issue: Bitbucket relies on the Referer HTTP header by hedora on Monday January 02, 2017 @12:29PM (#13302663)
The proxy would have to spoof the secure cookie flags (and also maybe rewrite JavaScript to request http instead of https) but MITM attacks are already costly, and bitbucket is a big, high value target; this is all within the reach of industrial espionage or state sponsored attack (or bored teens).

I just read up on hsts and hpkp. They both seem pretty broken in the face of http MITM attacks (why aren't they part of the secure dns stuff?!?). Also, hpkp is often disabled for self signed and imported (private) CA certs. sigh.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key...

They both look much better than the django referrer hack though. Thanks for the pointer.

Re:Issue: Bitbucket relies on the Referer HTTP header by ec109685 on Monday January 02, 2017 @12:21PM (#13302579)
Generally your MITM scenario won't work. You won't have access to secure cookies to pass along in the attack.

I do agree though if you can spoof arbitrary cookies, I don't see how you are secure from MITM attacks.