Catastrophic Backtracking Vulnerability in Django

py-django Updated 02 Oct 2025

Summary

09/03/2018
N/A
Yes i
Medium
5.3

CVE-2018-7537: An issue was discovered in Django 2.0 before 2.0.3, 1.11 before 1.11.11, and 1.8 before 1.8.19. Affects py-django across 2 version ranges.

< 1.11.11-r0 >= feac4c30ce7635e17ce1adc4c2c7a1eb0721aeb3, < c686dd8e6bb3817bcf04b8f13c025b4d3c3dc6dc

Fixed in 1.11.11-r0. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

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 popular web framework written in Python that simplifies the development of web applications. It provides various utilities and features to handle common web development tasks. However, Django versions 2.0 before 2.0.3, 1.11 before 1.11.11, and 1.8 before 1.8.19 are vulnerable to a catastrophic backtracking vulnerability in the Truncator's chars() and words() methods when the html=True argument is used. This vulnerability affects the truncatechars_html and truncatewords_html template filters.

Vulnerability Detail

The vulnerability arises due to a regular expression used in the Truncator's chars() and words() methods. When the html=True argument is passed, certain inputs can cause the regular expression to exhibit catastrophic backtracking, resulting in extremely slow evaluation. This can be exploited by an attacker to perform denial-of-service attacks against Django applications that utilize the affected template filters. The vulnerability has a CVSS score of 5.3.

How To Fix

Minimum fixed version

1.11.11-r0

This is the first release that contains the fix.

sudo apk add --upgrade py-django

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading Django is not immediately feasible, a workaround can be implemented by avoiding the usage of the truncatechars_html and truncatewords_html template filters. Instead, developers can manually truncate the text in their views or templates using alternative methods that do not rely on the vulnerable filters.

Conclusion

In conclusion, Django versions 2.0 before 2.0.3, 1.11 before 1.11.11, and 1.8 before 1.8.19 are vulnerable to a catastrophic backtracking vulnerability in the Truncator's chars() and words() methods. Upgrading to the patched versions or avoiding the usage of the vulnerable template filters is recommended to mitigate the risk. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for py-django →

Share this vulnerability

FAQ

Django is a web framework written in Python that simplifies web application development.

Django versions 2.0 before 2.0.3, 1.11 before 1.11.11, and 1.8 before 1.8.19 are affected.

A catastrophic backtracking vulnerability occurs when a regular expression takes an exponentially long time to evaluate certain inputs, leading to a denial-of-service risk.

An attacker can exploit this vulnerability by providing specially crafted inputs to Django applications that use the truncatechars_html or truncatewords_html template filters, causing the application to become unresponsive.

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

Related vulnerabilities

Recent vulnerabilities recorded for py-django.

How To Fix

Minimum fixed version

1.11.11-r0

This is the first release that contains the fix.

sudo apk add --upgrade py-django

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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