CVE-2011-0696: CSRF
Django 1.1.x before 1.1.4 and 1.2.x before 1.2.5 does not properly validate HTTP requests that contain an X-Requested-With header, which makes it easier for remote attackers to conduct cross-site request forgery (CSRF) attacks via forged AJAX requests that leverage a "combination of browser plugins and redirects," a related issue to CVE-2011-0447.
Other sources
http://www.djangoproject.com/weblog/2011/feb/08/security/
Django includes a CSRF-protection mechanism, which makes use of a token inserted into outgoing forms. Middleware then checks for the token's presence on form submission, and validates it.
Previously, however, our CSRF protection made an exception for AJAX requests, on the following basis:
1. Many AJAX toolkits add an X-Requested-With header when using XMLHttpRequest. 2. Browsers have strict same-origin policies regarding XMLHttpRequest. 3. In the context of a browser, the only way that a custom header of this nature can be added is with XMLHttpRequest.
Therefore, for ease of use, we did not apply CSRF checks to requests that appeared to be AJAX on the basis of the X-Requested-With header. The Ruby on Rails web framework had a similar exemption.
Recently, engineers at Google made members of the Ruby on Rails development team aware of a combination of browser plugins and redirects which can allow an attacker to provide custom HTTP headers on a request to any website. This can allow a forged request to appear to be an AJAX request, thereby defeating CSRF protection which trusts the same-origin nature of AJAX requests.
Michael Koziarski of the Rails team brought this to our attention, and we were able to produce a proof-of-concept demonstrating the same vulnerability in Django's CSRF handling.
To remedy this, Django will now apply full CSRF validation to all requests, regardless of apparent AJAX origin. This is technically backwards-incompatible, but the security risks have been judged to outweigh the compatibility concerns in this case.
Additionally, Django will now accept the CSRF token in the custom HTTP header X-CSRFTOKEN, as well as in the form submission itself, for ease of use with popular JavaScript toolkits which allow insertion of custom headers into all AJAX requests.
— Red Hat
Affected Software
Remediation
Patch Available
Patch Available
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2011-0696?
CVE-2011-0696 has a medium severity rating due to its impact on the CSRF protection mechanism in affected versions of Django.
How do I fix CVE-2011-0696?
To remediate CVE-2011-0696, upgrade Django to version 1.1.4 or 1.2.5 or later.
Which versions of Django are affected by CVE-2011-0696?
CVE-2011-0696 affects Django versions 1.1.0 to 1.1.3 and 1.2.0 to 1.2.4.
What type of vulnerability is CVE-2011-0696?
CVE-2011-0696 is a cross-site request forgery (CSRF) vulnerability affecting the CSRF-protection mechanism in Django.
Is CVE-2011-0696 still a concern for modern Django applications?
CVE-2011-0696 is generally not a concern for modern Django applications as it pertains to older versions that are no longer supported.