CVE-2023-43665: Django Django Denial-of-service Vulnerability

HIGH
Advisory Identifier: GHSA-h8gc-pgj2-vjm3
CVSS 5.9
CWE-400 CWE-1284
Published
Advisory Summary

CVE-2023-43665 is a HIGH (CVSS 5.9) django denial-of-service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Django libraries in the PyPI ecosystem. The issue involves django denial-of-service in django.utils.text.truncator. Remediation is available by upgrading affected packages to version 3.2.22, 4.1.12, 4.2.6.

CVE-2023-43665 at a Glance

CVE Identifier CVE-2023-43665
GHSA Identifier GHSA-h8gc-pgj2-vjm3
Severity HIGH
CVSS v3.1 Base Score 5.9
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Django
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2023-43665

To remediate this vulnerability, upgrade all affected Django dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Django fixed: 3.2.22
pip install Django>=3.2.22
Django fixed: 4.1.12
pip install Django>=4.1.12
Django fixed: 4.2.6
pip install Django>=4.2.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Django

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-43665, inspect your installed packages using pip:

pip show Django

Analyze the terminal output to locate any version of Django in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.22), your application is affected.

Note: The pip show Django command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Django, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

In Django 3.2 before 3.2.22, 4.1 before 4.1.12, and 4.2 before 4.2.6, the django.utils.text.Truncator chars() and words() methods (when used with html=True) are subject to a potential DoS (denial of service) attack via certain inputs with very long, potentially malformed HTML text. The chars() and words() methods are used to implement the truncatechars_html and truncatewords_html template filters, which are thus also vulnerable. NOTE: this issue exists because of an incomplete fix for CVE-2019-14232.

CVE-2023-43665 Affected Django Versions

3 component(s)
Fixed Versions:
3.2.224.1.124.2.6
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
≥ 3.2a1
< 3.2.22
3.2.22
Django
PyPI
≥ 4.1a1
< 4.1.12
4.1.12
Django
PyPI
≥ 4.2a1
< 4.2.6
4.2.6

References

NVD — CVE-2023-43665 NVD
https://nvd.nist.gov/vuln/detail/CVE-2023-43665
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/be9c27c4d18c2e6a5be8af4e53c0797440794473
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/c7b7024742250414e426ad49fb80db943e7ba4e8
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/ccdade1a0262537868d7ca64374de3d957ca50c5
Django Release RELEASE
https://docs.djangoproject.com/en/4.2/releases/security
Django Source Repository REPOSITORY
https://github.com/django/django
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2023-226.yaml
groups.google.com/forum/ WEB
https://groups.google.com/forum/#!forum/django-announce
groups.google.com/forum/ WEB
https://groups.google.com/forum/#%21forum/django-announce
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HJFRPUHDYJHBH3KYHSPGULQM4JN7BMSU
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZQJOMNRMVPCN5WMIZ7YSX5LQ7IR2NY4D
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HJFRPUHDYJHBH3KYHSPGULQM4JN7BMSU
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZQJOMNRMVPCN5WMIZ7YSX5LQ7IR2NY4D
Django Security Information SECURITY
https://security.netapp.com/advisory/ntap-20231221-0001
Django Release RELEASE
https://www.djangoproject.com/weblog/2023/oct/04/security-releases
Django Security Information SECURITY
http://www.openwall.com/lists/oss-security/2024/03/04/1

Frequently Asked Questions

What is CVE-2023-43665?
CVE-2023-43665 is a security vulnerability in Django involving Django Denial-of-service in django.utils.text.Truncator under CWE-400: Uncontrolled Resource Consumption.
Which Django versions are affected?
Affected versions include releases prior to 3.2.22, 4.1.12, 4.2.6 across affected packages: Django.
What version fixes CVE-2023-43665?
Upgrading to 3.2.22, 4.1.12, 4.2.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 3.2.22, 4.1.12, 4.2.6. Upgrade your dependency to 3.2.22, 4.1.12, 4.2.6 or later.
What is the CVSS score of CVE-2023-43665?
CVE-2023-43665 has a CVSS v3.1 base score of 5.9 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2023-43665?
CVE-2023-43665 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2023-43665?
Run the dependency tree command: 'pip show Django'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h8gc-pgj2-vjm3",
  "modified" : "2025-11-04T19:43:42Z",
  "published" : "2023-11-03T06:36:30Z",
  "aliases" : [ "CVE-2023-43665" ],
  "summary" : "Django Denial-of-service in django.utils.text.Truncator",
  "details" : "In Django 3.2 before 3.2.22, 4.1 before 4.1.12, and 4.2 before 4.2.6, the django.utils.text.Truncator chars() and words() methods (when used with html=True) are subject to a potential DoS (denial of service) attack via certain inputs with very long, potentially malformed HTML text. The chars() and words() methods are used to implement the truncatechars_html and truncatewords_html template filters, which are thus also vulnerable. NOTE: this issue exists because of an incomplete fix for CVE-2019-14232.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.2a1"
      }, {
        "fixed" : "3.2.22"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.1a1"
      }, {
        "fixed" : "4.1.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2a1"
      }, {
        "fixed" : "4.2.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-43665"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/be9c27c4d18c2e6a5be8af4e53c0797440794473"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/c7b7024742250414e426ad49fb80db943e7ba4e8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/ccdade1a0262537868d7ca64374de3d957ca50c5"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/4.2/releases/security"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2023-226.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!forum/django-announce"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#%21forum/django-announce"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HJFRPUHDYJHBH3KYHSPGULQM4JN7BMSU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZQJOMNRMVPCN5WMIZ7YSX5LQ7IR2NY4D"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HJFRPUHDYJHBH3KYHSPGULQM4JN7BMSU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZQJOMNRMVPCN5WMIZ7YSX5LQ7IR2NY4D"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20231221-0001"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2023/oct/04/security-releases"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2024/03/04/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1284", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-03T19:35:28Z",
    "nvd_published_at" : "2023-11-03T05:15:30Z"
  }
}