GHSA-vm8q-m57g-pff3 BIT-django-2024-27351 CVE-2024-27351 PYSEC-2024-47
Regular expression denial-of-service in Django
- Severity
- 5.3 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 1.85%
- Chance of exploitation in the next 30 days. Higher than 79.17% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-1333 Inefficient Regular Expression Complexity
- Fix
3.2.25- Upgrade django to this version or later
Description
In Django 3.2 before 3.2.25, 4.2 before 4.2.11, and 5.0 before 5.0.3, the django.utils.text.Truncator.words() method (with html=True) and the truncatewords_html template filter are subject to a potential regular expression denial-of-service attack via a crafted string. NOTE: this issue exists because of an incomplete fix for CVE-2019-14232 and CVE-2023-43665.
Affected versions
PyPI
| Package | Vulnerable | Fixed in |
|---|---|---|
| django | >= 3.2, < 3.2.25 |
3.2.25 |
| django | >= 4.2, < 4.2.11 |
4.2.11 |
| django | >= 5.0, < 5.0.3 |
5.0.3 |
| django | >= 3.2, < 3.2.25>= 4.2, < 4.2.11>= 5.0, < 5.0.3 |
3.2.254.2.115.0.3 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
django PyPI → 3.2.25
- pip
pip install --upgrade "django>=3.2.25"- poetry
poetry add "django>=3.2.25"- uv
uv add "django>=3.2.25"
Severity breakdown
CVSS 3.1 5.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- Required
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-1333: Inefficient Regular Expression Complexity
The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.
How to prevent it
- Architecture and Design: Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.
- System Configuration: Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.
- Implementation: Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.
- Implementation: Limit the length of the input that the regular expression will process.
References
Advisories
Write-ups
Packages
Other links
- github.com/django/django/commit/072963e4c4d0b3a7a8c5412bc0c7d27d1a9c3521
- github.com/django/django/commit/3394fc6132436eca89e997083bae9985fb7e761e
- github.com/django/django/commit/3c9a2771cc80821e041b16eb36c1c37af5349d4a
- docs.djangoproject.com/en/5.0/releases/security
- github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2024-47.yaml
- groups.google.com/forum
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/D2J…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SN2…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZQJ…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/D2JIR…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SN2PL…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZQJOM…
- djangoproject.com/weblog/2024/mar/04/security-releases
- openwall.com/lists/oss-security/2024/03/04/1
- docs.djangoproject.com/en/5.0/releases/security
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/D2J…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SN2…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZQJ…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/D2JIR…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SN2PL…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZQJOM…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-q238-5cxm-5c9h Django GeoDjango vulnerable to denial of service through deeply nested geometry collections | Medium | Also affects django |
| GHSA-wvqv-fj8w-qmhm Django GeoDjango spatial lookups allow file writes and outbound requests through GDAL raster parsing | High | Also affects django |
| GHSA-8qcx-xf44-272x Django: DomainNameValidator permits newline characters that may enable HTTP header injection | Medium | Also affects django |
| GHSA-crhf-3pfg-w68w Django: GDALRaster may over-read heap memory when constructed from bytes | Medium | Also affects django |
| GHSA-3h9f-r86x-qvjx Django: cache middleware may expose private responses when unrelated request cookies are present | Medium | Also affects django |
| GHSA-8cjm-8mp7-r2xf Django: UpdateCacheMiddleware may disclose cached responses due to case-sensitive Cache-Control handling | Medium | Also affects django |
| GHSA-mm6v-q8q9-pgcf Django fails to prevent reuse of a partially-initialized connection after a failed `STARTTLS` handshake | Low | Also affects django |
| GHSA-h7pc-vwp9-298g Django: signed cookies are vulnerable to salt namespace collisions | Medium | Also affects django |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor