Closed
Bug 825641
Opened 13 years ago
Closed 11 years ago
Host-header password reset poisoning attack
Categories
(addons.mozilla.org Graveyard :: Administration, defect)
addons.mozilla.org Graveyard
Administration
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: albinowax, Unassigned)
References
Details
(Keywords: reporter-external, sec-high, Whiteboard: [infrasec:auth][ws:high])
A variation of the poisoned password reset attack described in https://bugzilla.mozilla.org/show_bug.cgi?id=741740 is still possible, due to an apparent server issue with the server's host whitelist. A direct attack like:
POST /en-US/firefox/users/pwreset HTTP/1.1
Host: evil.com
will fail. However, it's possible to confuse nginx by placing the full URI in the first line:
POST https://addons.mozilla.org/en-US/firefox/users/pwreset HTTP/1.1
Host: evil.com
Resulting in a poisoned reset link:
https://evil.com/users/pwreset/3ocig/<token_removed>
| Reporter | ||
Updated•13 years ago
|
Updated•13 years ago
|
Flags: sec-bounty?
Comment 1•13 years ago
|
||
James (Bennett): is this a Django bug? Something you've seen before?
| Reporter | ||
Comment 2•13 years ago
|
||
As AMO is using server-side caching, it may be possible to exploit this issue for defacement using cache-poisoning. I don't think I could safely test this though.
I've investigated the logic a little. The example configuration described for Apache at https://docs.djangoproject.com/en/1.4/topics/security/#host-headers-and-virtual-hosting and the ?nginx? config used by Mozilla both have the same issue; they fail to enforce
'It always validates incoming HTTP Host headers against the expected host name.'
Instead, they validate the ServerName/server_name variable, which is only set by the host header if a host isn't specified in the first line of the request. I think the best solution would probably be for Django to use the ServerName value if it's present. Alternatively/as a short team solution, you could modify the server config to validate the actual host header.
| Reporter | ||
Comment 3•13 years ago
|
||
I've notified security@djangoproject.com, and they're probably going to fix it with a whitelist of trusted hosts approach. This ought to prevent any recurrences.
Updated•13 years ago
|
Flags: sec-bounty? → sec-bounty+
| Reporter | ||
Comment 5•13 years ago
|
||
It appears that AMO has *.mozilla.org whitelisted. Given the number of sites and servers this contains, it might be safer to lock it down a tad more - every https resource loaded by the 404 page of every server (on every port) could get the key in the referer header. Not a huge risk, but not ideal.
Comment 6•12 years ago
|
||
Next actions on this bug are to review why we have *.mozilla.org whitelisted and if we could make it something more like *.a.m.o or even a.m.o. After that we either change it or wontfix it knowing the risk.
Comment 7•12 years ago
|
||
(In reply to Wil Clouser [:clouserw] from comment #6)
> Next actions on this bug are to review why we have *.mozilla.org whitelisted
> and if we could make it something more like *.a.m.o or even a.m.o. After
> that we either change it or wontfix it knowing the risk.
There's no specific reason for *.mozilla.org, just that when we pushed out this fix getting the list of domains that was needed on prod was hard to figure out and it doesn't match stage or dev. Recommend caution on this push since you can't test it.
| Reporter | ||
Comment 8•12 years ago
|
||
Either *.a.m.o and a.m.o sounds fine to me. I spent a while looking for ways to exploit the current wildcard and made a semi-functional exploit using a malicious attachment at bugXXXXX.bugzilla.mozilla.org. It required that the target first click the poisoned email link (which would redirect them to https://bugzilla.mozilla.org/show_bug.cgi?id=XXXXXX), and then click 'view attachment' - I never quite managed to get it down to a single click.
Comment 10•11 years ago
|
||
Retested - nginx is properly responding now, closing bug.
Request:
POST https://addons.mozilla.org/en-US/firefox/users/pwreset HTTP/1.1
Host: evil.com
(snip)
csrfmiddlewaretoken=XXXXXXXXXXXXXXX&email=amuntner%40mozilla.com
Response:
HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Thu, 24 Sep 2015 11:06:54 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 166
Connection: close
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 11•11 years ago
|
||
(various other permutations of the malicious input returned the same result)
| Assignee | ||
Updated•10 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
Updated•6 years ago
|
Group: client-services-security
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•