CVE-2024-53907: Django Denial-of-Service Vulnerability in strip_tags() Method

django Updated 02 Oct 2025

Summary

06/12/2024
Yes i
Moderate
7.5

CVE-2024-53907: Django denial-of-service in django.utils.html.strip_tags(). Affects django across 6 version ranges.

>= 4.2, < 4.2.17 >= 4.2.0, < 4.2.17 >= 5.0, < 5.0.10 >= 5.0.0, < 5.0.10 >= 5.1, < 5.1.4 >= 5.1.0, < 5.1.4

Fixed in 4.2.17, 5.0.10 or 5.1.4, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2024-53907 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM, templating engine, and security features. However, certain versions of Django are vulnerable to a denial-of-service attack due to issues in the strip_tags() method, which is used to remove HTML tags from strings. This vulnerability can be exploited through specially crafted inputs, leading to potential service disruptions.

Vulnerability Detail

The vulnerability arises from the strip_tags() method and striptags template filter in Django versions 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17. Attackers can exploit this vulnerability by sending inputs that contain large sequences of nested incomplete HTML entities. This can cause the application to hang or crash, resulting in a denial-of-service condition. The severity of this vulnerability is classified as moderate, with a CVSS score of 7.5, indicating a significant risk to affected applications.

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 4.2, < 4.2.17 4.2.17
    pip install --upgrade "django==4.2.17"
  • >= 4.2.0, < 4.2.17 4.2.17
    pip install --upgrade "django==4.2.17"
  • >= 5.0, < 5.0.10 5.0.10
    pip install --upgrade "django==5.0.10"
  • >= 5.0.0, < 5.0.10 5.0.10
    pip install --upgrade "django==5.0.10"
  • >= 5.1, < 5.1.4 5.1.4
    pip install --upgrade "django==5.1.4"
  • >= 5.1.0, < 5.1.4 5.1.4
    pip install --upgrade "django==5.1.4"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If immediate upgrading is not feasible, consider implementing input validation to sanitize user inputs before they reach the strip_tags() method. This can help mitigate the risk of denial-of-service attacks.

Conclusion

In summary, the Django denial-of-service vulnerability in the strip_tags() method poses a significant risk to applications using affected versions. It is crucial to update to the latest patched versions to mitigate this risk. Implementing input validation can serve as a temporary measure while preparing for an upgrade.

See every vulnerability recorded for django →

Share this vulnerability

FAQ

Django versions 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17 are affected by this vulnerability.

The vulnerability can lead to a denial-of-service condition, causing the application to hang or crash when processing malicious inputs.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Yes, you can implement input validation to sanitize user inputs before they reach the strip_tags() method as a temporary workaround.

The CVSS score of this vulnerability is 7.5, indicating a moderate severity level.

Related vulnerabilities

Recent vulnerabilities recorded for django.

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 4.2, < 4.2.17 4.2.17
    pip install --upgrade "django==4.2.17"
  • >= 4.2.0, < 4.2.17 4.2.17
    pip install --upgrade "django==4.2.17"
  • >= 5.0, < 5.0.10 5.0.10
    pip install --upgrade "django==5.0.10"
  • >= 5.0.0, < 5.0.10 5.0.10
    pip install --upgrade "django==5.0.10"
  • >= 5.1, < 5.1.4 5.1.4
    pip install --upgrade "django==5.1.4"
  • >= 5.1.0, < 5.1.4 5.1.4
    pip install --upgrade "django==5.1.4"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback