Bug 1202818 (CVE-2015-2317)

Summary: CVE-2015-2317 Django: possible XSS attack via user-supplied redirect URLs
Product: [Other] Security Response Reporter: Martin Prpič <mprpic>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: abaron, apevec, ayoung, bkearney, cbillett, chrisw, dallan, gkotton, jrusnack, lhh, lpeer, markmc, mrunge, rbryant, sclewis, security-response-team, srevivo, tomckay
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Django 1.8rc1, Django 1.7.7, Django 1.6.11, Django 1.4.20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1203616, 1203617, 1203618, 1203619    
Bug Blocks: 1202821    
Description Flags
is-safe-url-master.diff none

Description Martin Prpič 2015-03-17 13:44:48 UTC
The following flaw was found in Django:

Django relies on user input in some cases (e.g. django.contrib.auth.views.login and i18n) to redirect the user to an "on success" URL. The security checks for these redirects (namely django.utils.http.is_safe_url()) accepted URLs with leading control characters and so considered URLs like \x08javascript:... safe. This issue doesn't affect Django currently, since we only put this URL into the Location response header and browsers seem to ignore JavaScript there. Browsers we tested also treat URLs prefixed with control characters such as %08//example.com as relative paths so redirection to an unsafe target isn't a problem either.

However, if a developer relies on is_safe_url() to provide safe redirect targets and puts such a URL into a link, they could suffer from an XSS attack as some browsers such as Google Chrome ignore control characters at the start of a URL in an anchor href.

This issue affects Django versions 1.8.x, 1.7.x, 1.6.x, and 1.4.x. This issue is fixed in versions 1.8 release candidate 1 (or beta 3), 1.7.7, 1.6.11, and 1.4.20.


Red Hat would like to thank the upstream Django project for reporting this issue.

Comment 1 Martin Prpič 2015-03-17 13:49:10 UTC
Created attachment 1002809 [details]

Comment 2 Martin Prpič 2015-03-17 13:49:13 UTC
Created attachment 1002810 [details]

Comment 3 Martin Prpič 2015-03-17 13:49:16 UTC
Created attachment 1002811 [details]

Comment 4 Martin Prpič 2015-03-17 13:49:18 UTC
Created attachment 1002812 [details]

Comment 5 Martin Prpič 2015-03-17 13:49:21 UTC
Created attachment 1002813 [details]

Comment 6 Martin Prpič 2015-03-19 09:34:47 UTC
External References:


Comment 7 Martin Prpič 2015-03-19 09:37:41 UTC
Created Django14 tracking bugs for this issue:

Affects: epel-6 [bug 1203619]

Comment 8 Martin Prpič 2015-03-19 09:37:44 UTC
Created python-django14 tracking bugs for this issue:

Affects: fedora-20 [bug 1203617]

Comment 9 Martin Prpič 2015-03-19 09:37:47 UTC
Created python-django tracking bugs for this issue:

Affects: fedora-all [bug 1203616]
Affects: epel-7 [bug 1203618]

Comment 10 Fedora Update System 2015-04-09 16:58:50 UTC
python-django-1.6.11-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2015-04-09 16:59:27 UTC
Django14-1.4.20-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2015-06-18 13:24:50 UTC
python-django14-1.4.20-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.