DjangoFramework / library · Djangoproject

CVE-2025-32873

MEDIUM · 5.3 CVSS v3.1 Published 2025-05-08
Fix available
A fix is available. Upgrade to 4.2.21 / 5.1.9 or later.
See remediation →
62/100
Remediation priority · Elevated
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
An issue was discovered in Django 4.2 before 4.2.21, 5.1 before 5.1.9, and 5.2 before 5.2.1. The django.utils.html.strip_tags() function is vulnerable to a potential denial-of-service (slow performance) when processing inputs containing large sequences of incomplete HTML tags. The template filter striptags is also vulnerable, because it is built on top of strip_tags().

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

The django.utils.html.strip_tags() function and the striptags template filter are vulnerable to denial-of-service through slow performance when processing inputs with large sequences of incomplete HTML tags, allowing attackers to cause excessive processing time.

MitigationUpgrade Django to version 4.2.21, 5.1.9, or 5.2.1 or later to receive the performance fix, and consider implementing input validation or length limits on content processed by strip_tags/striptags as a defense-in-depth measure.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
DjangoFramework / library
Affected:>= 4.2.0, < 4.2.21>= 5.1, < 5.1.9= 5.2

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify installed Django version
    Run 'python -c "import django; print(django.get_version())"' or check your requirements.txt / Pipfile.lock
    Affected if Version is 4.2.0-4.2.20, 5.1.0-5.1.8, or 5.2.0 (exact)
  2. Find usage of strip_tags in code
    Search codebase for 'from django.utils.html import strip_tags' or 'strip_tags(' pattern using grep or IDE search
    Affected if Your code imports or calls strip_tags function
  3. Find usage of striptags template filter
    Search template files (.html) for '|striptags' filter usage, for example '{{ some_var|striptags }}'
    Affected if Any Django templates use the striptags filter on user-controlled or external input
  4. Identify data flow to vulnerable functions
    Trace where strip_tags or striptags processes input - check if input comes from user requests, API calls, or external sources
    Affected if The functions process data that could contain maliciously crafted incomplete HTML tags

You are affected if your Django version falls in the vulnerable range AND your application uses strip_tags or striptags on content that could contain attacker-supplied incomplete HTML tag sequences.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 4.2.21 / 5.1.9 or later
Fixed in 4.2.215.1.9
Interim mitigation

Upgrade Django to version 4.2.21, 5.1.9, or 5.2.1 or later to receive the performance fix, and consider implementing input validation or length limits on content processed by strip_tags/striptags as a defense-in-depth measure.

Recommended fix High confidence

Django 4.2.21, 5.1.9, or 5.2.1 (depending on your current branch)

  1. 1. Identify the current Django version in use by checking requirements.txt, pyproject.toml, or running 'django-admin --version'
  2. 2. Determine which Django branch is in use (4.2.x, 5.1.x, or 5.2.x) to select the appropriate upgrade target
  3. 3. For Django 4.2.x: Upgrade to version 4.2.21 or later
  4. 4. For Django 5.1.x: Upgrade to version 5.1.9 or later
  5. 5. For Django 5.2.x: Upgrade to version 5.2.1 or later
  6. 6. Update the Django dependency in requirements.txt or pyproject.toml with the appropriate version (e.g., 'Django>=4.2.21,<5.0' or 'Django>=5.1.9,<5.2' or 'Django>=5.2.1')
  7. 7. Run 'pip install -r requirements.txt' or 'pip install Django==<fixed_version>' to install the updated package
  8. 8. Run Django tests, especially any tests that use the striptags template filter or strip_tags() function, to verify the fix works correctly
Caveat Django minor version upgrades within the same major series typically have minimal breaking changes; however, review the release notes for any deprecation warnings or behavior changes between your current version and the target fixed version before upgrading

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Django Scoped from the published advisory
  • Consultation3.0 h
  • Implementation4.0 h
  • Testing4.0 h
  • Review / QA2.0 h
13.0 hours of engineering $2,280
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $3,648.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2025-32873 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2025-32873 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data