Django's anti-CSRF Referer validation can be bypassed using the X-FORWARDED-HOST header
Originally disclosed on Mozilla
- Fixed in 43 days
- Paid in 2.6 years
- Disclosed after 43 days
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20110103 Fedora/3.6.13-1.fc14 Firefox/3.6.13
Build Identifier:
When Django receives a POST request it validates the Referer header against the Host. However, if the X-Forwarded-Host header is present, it validates the referer against that instead. That header can be spoofed to match the referer, so Django accepts the request.
When combined with the csrf-token overriding attack outlined in https://bugzilla.mozilla.org/show_bug.cgi?id=648881 this probably exposes all AMO users with non-updated browsers to potentially account-hijacking CSRF.
( On slightly out of date browsers, using the technique outlined in http://lists.webappsec.org/pipermail/websecurity_lists.webappsec.org/2011-February/007533.html attackers can make victims spoof the X-Forwarded-Host header cross domain. )
Reproducible: Always
Steps to Reproduce:
1. Browse to https://addons.mozilla.org/en-US/firefox/users/edit, click 'update'
2. Intercept the request and change the 'Referer' value to 'https://cow.org/
3. Add a new header 'X-FORWARDED-HOST: cow.org'
4. Observe that the request succeeds ('302 found' rather than '403 forbidden')
The X-Forwarded-Host trick was suggested by 'barbarianbob'. I'll try and get his email so he can see the bug. If he agrees, any bounty can be split 50/50.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A CSRF bug in Developer Pages. Mozilla made it public on 25 May 2011.
About CSRF
Another site makes a signed-in user's browser perform an action they did not intend.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.