Bug 1202809 (CVE-2015-2316) - CVE-2015-2316 Django: possible denial of service in strip_tags()
Summary: CVE-2015-2316 Django: possible denial of service in strip_tags()
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2015-2316
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1203614 1203615
Blocks: 1202821
TreeView+ depends on / blocked
 
Reported: 2015-03-17 13:30 UTC by Martin Prpič
Modified: 2023-05-12 08:03 UTC (History)
13 users (show)

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


Attachments (Terms of Use)
is-safe-url-master.diff (4.14 KB, text/plain)
2015-03-17 13:33 UTC, Martin Prpič
no flags Details
strip-tags-1.8.diff (4.14 KB, text/plain)
2015-03-17 13:33 UTC, Martin Prpič
no flags Details
strip-tags-1.7.diff (4.14 KB, text/plain)
2015-03-17 13:34 UTC, Martin Prpič
no flags Details
strip-tags-1.6.diff (2.84 KB, text/plain)
2015-03-17 13:35 UTC, Martin Prpič
no flags Details
strip-tags-master.diff (4.14 KB, text/plain)
2015-03-17 13:35 UTC, Martin Prpič
no flags Details

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

In a previous release, django.utils.html.strip_tags was changed to work iteratively. The problem is that the size of the input it is processing can increase on each iteration which results in an infinite loop in strip_tags(). This issue only affects versions of Python that haven't received a bugfix in HTMLParser (http://bugs.python.org/issue20288); namely Python < 2.7.7 and 3.3.5. Some operating system vendors have also backported the fix for the Python bug into their packages of earlier versions.

To remedy this issue, strip_tags() will now return the original input if it detects the length of the string it is processing increases. Remember that absolutely NO guarantee is provided about the results of strip_tags() being HTML safe. So NEVER mark safe the result of a strip_tags() call without escaping it first, for example with django.utils.html.escape.

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

Acknowledgements:

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

Comment 1 Martin Prpič 2015-03-17 13:33:12 UTC
Created attachment 1002792 [details]
is-safe-url-master.diff

Comment 2 Martin Prpič 2015-03-17 13:33:56 UTC
Created attachment 1002793 [details]
strip-tags-1.8.diff

Comment 3 Martin Prpič 2015-03-17 13:34:21 UTC
Created attachment 1002794 [details]
strip-tags-1.7.diff

Comment 4 Martin Prpič 2015-03-17 13:35:04 UTC
Created attachment 1002795 [details]
strip-tags-1.6.diff

Comment 5 Martin Prpič 2015-03-17 13:35:34 UTC
Created attachment 1002796 [details]
strip-tags-master.diff

Comment 6 Martin Prpič 2015-03-19 09:33:36 UTC
External References:

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

Comment 7 Martin Prpič 2015-03-19 09:36:33 UTC
Created python-django tracking bugs for this issue:

Affects: fedora-all [bug 1203614]
Affects: epel-7 [bug 1203615]

Comment 8 Fedora Update System 2015-04-09 16:58:47 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.


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