CVE-2024-53907
High · 7.5Django denial-of-service in django.utils.html.strip_tags()
CVSS
7.5
EPSS
1.4%
Published
Dec 6, 2024
CISA due date
—
Cloudanix analysis
A problem in Django's tool for removing HTML tags lets attackers send specially crafted text that can slow down or freeze parts of a website.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Web Framework
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The strip_tags() method and striptags template filter enter excessive processing loops when given inputs containing large sequences of nested incomplete HTML entities, resulting in denial of service through resource exhaustion.
Why it matters to the business
Web applications may become slow or unresponsive when processing certain user-supplied content, leading to degraded service availability, increased infrastructure costs, and potential disruption of user-facing features.
How an attack unfolds
An attacker identifies application endpoints or templates that invoke strip_tags or striptags on untrusted input and submits crafted payloads consisting of deeply nested incomplete HTML entities to trigger prolonged CPU consumption or application hangs.
How to fix it
Upgrade to Django 5.1.4, 5.0.10, or 4.2.17 (or later) which contain the fix in commit 3b3a5f4efbf93692557b7f473519bd0ad8f04c6a. As a temporary mitigation, avoid calling these functions on untrusted input or wrap calls with strict timeouts and resource limits.
How to confirm the fix worked
After upgrade, replay known problematic entity sequences against the functions under controlled load and confirm that processing completes in bounded time without excessive CPU or memory growth. Scan codebases for remaining direct calls to the affected functions.
Typical attack path
- Map application surfaces that use Django strip_tags or striptags on external data
- Generate or mutate input containing large sequences of nested incomplete HTML entities
- Submit the payload via HTTP requests or form fields to trigger the vulnerable code path
- Observe resource exhaustion or service degradation on the target instance
How to detect it
Correlate web server or application logs with spikes in CPU or memory usage on Django worker processes; search for requests containing repeated incomplete HTML entity patterns such as long runs of ampersand sequences without proper termination.
What your security team should do
- Prioritize upgrade of all Django installations to the fixed releases listed in remediation guidance
- Audit templates and view code for usage of striptags and strip_tags on untrusted data
- Implement input size limits and request timeouts around HTML-processing paths until patches are applied
- Monitor EPSS and exploit maturity signals for any future increase in weaponization
The record
An issue was discovered in Django 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17. The strip_tags() method and striptags template filter are subject to a potential denial-of-service attack via certain inputs containing large sequences of nested incomplete HTML entities.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | django | 4.2 | 4.2.17 |
| PyPI | django | 4.2.0 | 4.2.17 |
| PyPI | django | 5.0 | 5.0.10 |
| PyPI | django | 5.0.0 | 5.0.10 |
| PyPI | django | 5.1 | 5.1.4 |
| PyPI | django | 5.1.0 | 5.1.4 |
| Bitnami | django | 4.2.0 | 4.2.17 |
| Chainguard | awx | 0 | 24.6.1-r2 |
| Chainguard | py3-django | 0 | 5.1.4-r0 |
| Chainguard | py3-supported-django | 0 | 5.1.4-r0 |
| Chainguard | py3.10-django | 0 | 5.1.4-r0 |
| Chainguard | py3.10-django-bin | 0 | 5.1.4-r0 |
| Chainguard | py3.11-django | 0 | 5.1.4-r0 |
| Chainguard | py3.11-django-bin | 0 | 5.1.4-r0 |
| Chainguard | py3.12-django | 0 | 5.1.4-r0 |
| Chainguard | py3.12-django-bin | 0 | 5.1.4-r0 |
| Chainguard | py3.13-django | 0 | 5.1.4-r0 |
| Chainguard | py3.13-django-bin | 0 | 5.1.4-r0 |
| Debian:11 | python-django | 0 | 2:2.2.28-1~deb11u3 |
| Debian:12 | python-django | 0 | No fix |
| Debian:13 | python-django | 0 | 3:4.2.17-1 |
| Debian:14 | python-django | 0 | 3:4.2.17-1 |
| Mageia:9 | python-django | 0 | 4.1.13-1.2.mga9 |
| Red Hat:ansible_automation_platform:2.5::el8 | automation-controller-venv-tower | 0 | 0:4.6.6-1.el8ap |
| Red Hat:ansible_automation_platform:2.5::el8 | automation-gateway-server | 0 | 0:2.5.20250115-1.el8ap |
| Red Hat:ansible_automation_platform:2.5::el8 | python3.11-aiohttp | 0 | 0:3.10.11-1.el8ap |
| Red Hat:ansible_automation_platform:2.5::el8 | python3.11-aiohttp-debuginfo | 0 | 0:3.10.11-1.el8ap |
| Red Hat:ansible_automation_platform:2.5::el8 | python3.11-aiohttp-debugsource | 0 | 0:3.10.11-1.el8ap |
| Red Hat:ansible_automation_platform:2.5::el9 | automation-controller-venv-tower | 0 | 0:4.6.6-1.el9ap |
| Red Hat:ansible_automation_platform:2.5::el9 | automation-gateway-server | 0 | 0:2.5.20250115-1.el9ap |
| Red Hat:ansible_automation_platform:2.5::el9 | python3.11-aiohttp | 0 | 0:3.10.11-1.el9ap |
| Red Hat:ansible_automation_platform:2.5::el9 | python3.11-aiohttp-debuginfo | 0 | 0:3.10.11-1.el9ap |
| Red Hat:ansible_automation_platform:2.5::el9 | python3.11-aiohttp-debugsource | 0 | 0:3.10.11-1.el9ap |
| Red Hat:ansible_automation_platform_developer:2.5::el8 | automation-controller-venv-tower | 0 | 0:4.6.6-1.el8ap |
| Red Hat:ansible_automation_platform_developer:2.5::el9 | automation-controller-venv-tower | 0 | 0:4.6.6-1.el9ap |
| SUSE:Linux Enterprise Module for Package Hub 15 SP6 | python-Django | 0 | 4.2.11-150600.3.12.1 |
| SUSE:Package Hub 15 SP5 | python-Django | 0 | 2.2.28-bp155.7.21.1 |
| Ubuntu:20.04:LTS | python-django | 0 | 2:2.2.12-1ubuntu0.26 |
| Ubuntu:22.04:LTS | python-django | 0 | 2:3.2.12-2ubuntu1.15 |
| Ubuntu:24.04:LTS | python-django | 0 | 3:4.2.11-1ubuntu1.4 |
| Ubuntu:24.10 | python-django | 0 | 3:4.2.15-1ubuntu1.1 |
| Ubuntu:25.04 | python-django | 0 | 3:4.2.17-2 |
| Ubuntu:Pro:14.04:LTS | python-django | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | python-django | 0 | 1.8.7-1ubuntu5.15+esm8 |
| Ubuntu:Pro:18.04:LTS | python-django | 0 | 1:1.11.11-1ubuntu1.21+esm8 |
| Wolfi | py3-django | 0 | 5.1.4-r0 |
| Wolfi | py3-supported-django | 0 | 5.1.4-r0 |
| Wolfi | py3.10-django | 0 | 5.1.4-r0 |
| Wolfi | py3.10-django-bin | 0 | 5.1.4-r0 |
| Wolfi | py3.11-django | 0 | 5.1.4-r0 |
| Wolfi | py3.11-django-bin | 0 | 5.1.4-r0 |
| Wolfi | py3.12-django | 0 | 5.1.4-r0 |
| Wolfi | py3.12-django-bin | 0 | 5.1.4-r0 |
| Wolfi | py3.13-django | 0 | 5.1.4-r0 |
| Wolfi | py3.13-django-bin | 0 | 5.1.4-r0 |
| openSUSE:Leap 15.5 | python-Django | 0 | 2.2.28-bp155.7.21.1 |
| openSUSE:Leap 15.6 | python-Django | 0 | 4.2.11-150600.3.12.1 |
| openSUSE:Tumbleweed | python-Django | 0 | 5.1.4-1.1 |
| openSUSE:Tumbleweed | python-Django4 | 0 | 4.2.17-1.1 |
| openSUSE:Tumbleweed | python-Django6 | 0 | 6.0-1.1 |
| pypi | Django | 4.2.0 | No fix |
| pypi | Django | 5.0.0 | No fix |
| pypi | Django | 5.1.0 | No fix |
Related vulnerabilities
- GHSA-8p8v-wh79-9r56 Django vulnerable to Uncontrolled Resource Consumption Also affects django
- GHSA-mjgh-79qc-68w3 Django has a Race Condition vulnerability Also affects django
- CVE-2026-25673 An issue was discovered in 6.0 before 6.0.3, 5.2 before 5.2.12, and 4.2 before 4.2.29. Also affects django
- CVE-2026-25674 An issue was discovered in 6.0 before 6.0.3, 5.2 before 5.2.12, and 4.2 before 4.2.29. Also affects django
- GHSA-6426-9fv3-65x8 Django has an SQL Injection issue Also affects django
- GHSA-gvg8-93h5-g6qq Django has an SQL Injection issue Also affects django
- GHSA-2mcm-79hx-8fxw Django has Observable Timing Discrepancy Also affects django
- GHSA-33mw-q7rj-mjwj Django has Inefficient Algorithmic Complexity Also affects django