Closed
Bug 741740
Opened 14 years ago
Closed 14 years ago
password reset token hijacking
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])
When a user requests a password reset AMO generates a url ending in a secret key, and emails it to them. The domain name part of this url can be overridden by the X-Forwarded-Host header. This could lead to the token being disclosed to arbitrary third party websites.
To reproduce, browse to
https://addons.mozilla.org/en-US/firefox/users/pwreset
Fill in your email address, click submit & intercept the request and insert:
X-Forwarded-Host: addons.moz1lla.org
then observe that you receive an email containing the following malicious link:
https://addons.moz1lla.org/users/pwreset/39rxq/<tokenremoved>
Comment 1•14 years ago
|
||
Where would this X-Forwarded-Host header come from?
- If someone is MITMing the secure connection this is the least of your worries.
- If the users is doing this to himself "Don't do that"
- If it's malware on the user's machine the malware already has all
the credentials it needs.
Maybe I'm misunderstanding.
| Reporter | ||
Comment 2•14 years ago
|
||
This is the password reset page; you don't have to be logged in to access it. You simply need to know the target's email address. So I can browse to that page, enter your email address and you will receive the (tainted) password reset email. The attack does rely on the target clicking the link in the email, but given that you have full control over the url it shouldn't be too hard to orchestrate.
| Reporter | ||
Comment 3•14 years ago
|
||
Here's a more convincing case. Say the attacker has control (legally or otherwise) over example.com They could modify the site so that all attempts to login fail with the message 'incorrect password', and modify the password reset code of example.com to trigger a tainted reset email from AMO. The user would then be expecting a password reset email, and would be much more likely to click the link when they received one titled "Password reset on example.com". (Although the from address would be "Mozilla Add-ons" <nobody@mozilla.org> )
Comment 4•14 years ago
|
||
Did this get silently fixed or did I test it wrong? Using Tamper Data to add the X-Forwarded-Host header didn't seem to do anything.
Comment 5•14 years ago
|
||
No fixes have gone out.
Comment 6•14 years ago
|
||
Never mind, did it wrong the first time. Confirming.
Updated•14 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 8•14 years ago
|
||
CCing James. This is using the built in django auth_view with a custom email_template_name. In that custom template this value comes from "domain" - I'm not sure where that is set though. I suspect this is a Django bug?
Comment 9•14 years ago
|
||
So, this is a Django bug, but it's a fixed Django bug :)
X-Forwarded-Host spoofing (specifically in the context of cache poisoning attacks) was a problem reported to us after Django 1.3 released; in response, we changed the behavior of HttpRequest.get_host() to only look at that header if the setting USE_X_FORWARDED_HOST is True (it defaults to False). The security announcement from upstream Django is here:
https://www.djangoproject.com/weblog/2011/sep/09/security-releases-issued/
AMO's pinned to a Django revision which did not have that fix applied; bumping up to Django 1.3.1 will resolve this. The relevant specific commits are:
https://github.com/django/django/commit/0a42298ea34bc3d76faa4d7abf37522f17797ab1 in master, or
https://github.com/django/django/commit/6dec4a394030f86ea6325ad4b9dfc8cd664ea83f in 1.3.X branch
should you want to cherry-pick them.
Comment 10•14 years ago
|
||
Awesome, thanks for the investigation. We tried to upgrade django in bug 694387 but ran into some fixture and oauth troubles. This will renew our vigor. :)
Depends on: 694387
Updated•14 years ago
|
Whiteboard: [infrasec:auth][ws:high]
| Reporter | ||
Comment 11•14 years ago
|
||
Apparently this version of Django has XSS too; https://www.djangoproject.com/weblog/2012/jul/30/security-releases-issued/
(I say this because I've been waiting a while to write something about the technique now :)
| Reporter | ||
Comment 12•14 years ago
|
||
I don't think updating Django will fix this one:
POST /en-US/firefox/user/pwreset HTTP/1.1
Host: addons.mozilla.org:asdf@evil.com
Comment 13•14 years ago
|
||
Opened bug 784801 to track the new variation of this issue.
Comment 14•14 years ago
|
||
We are on 1.4.1 this should be fixed. It can be verified on https://addons-dev.allizom.org/, and it will be rolled out next push.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Flags: sec-bounty+
| 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
•