Skip to content
CSRF Disclosed report

Django's anti-CSRF Referer validation can be bypassed using the X-FORWARDED-HOST header

James Kettle Follow

Originally disclosed on Mozilla

  • Fixed in 43 days
  • Paid in 2.6 years
  • Disclosed after 43 days
Text
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.

The original report as published on Mozilla's Bugzilla, by Jаmes Kettle. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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.

More by James Kettle

View all

14 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.