Bug 1202818 (CVE-2015-2317) - CVE-2015-2317 Django: possible XSS attack via user-supplied redirect URLs
Summary: CVE-2015-2317 Django: possible XSS attack via user-supplied redirect URLs
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2015-2317
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1203616 1203617 1203618 1203619
Blocks: 1202821
TreeView+ depends on / blocked
 
Reported: 2015-03-17 13:44 UTC by Martin Prpič
Modified: 2023-05-12 08:16 UTC (History)
16 users (show)

Fixed In Version: Django 1.8rc1, Django 1.7.7, Django 1.6.11, Django 1.4.20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-10-21 00:44:28 UTC
Embargoed:


Attachments (Terms of Use)
is-safe-url-1.4.diff (3.63 KB, text/plain)
2015-03-17 13:49 UTC, Martin Prpič
no flags Details
is-safe-url-1.6.diff (5.30 KB, text/plain)
2015-03-17 13:49 UTC, Martin Prpič
no flags Details
is-safe-url-1.7.diff (6.66 KB, text/plain)
2015-03-17 13:49 UTC, Martin Prpič
no flags Details
is-safe-url-1.8.diff (6.65 KB, text/plain)
2015-03-17 13:49 UTC, Martin Prpič
no flags Details
is-safe-url-master.diff (6.65 KB, text/plain)
2015-03-17 13:49 UTC, Martin Prpič
no flags Details

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.

Acknowledgements:

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]
is-safe-url-1.4.diff

Comment 2 Martin Prpič 2015-03-17 13:49:13 UTC
Created attachment 1002810 [details]
is-safe-url-1.6.diff

Comment 3 Martin Prpič 2015-03-17 13:49:16 UTC
Created attachment 1002811 [details]
is-safe-url-1.7.diff

Comment 4 Martin Prpič 2015-03-17 13:49:18 UTC
Created attachment 1002812 [details]
is-safe-url-1.8.diff

Comment 5 Martin Prpič 2015-03-17 13:49:21 UTC
Created attachment 1002813 [details]
is-safe-url-master.diff

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

https://www.djangoproject.com/weblog/2015/mar/18/security-releases/

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.


Note You need to log in before you can comment on or make changes to this bug.