Algorithmic Complexity Vulnerability in Django

python-django Updated 02 Oct 2025

Summary

13/10/2009
N/A
Yes i
Unrated
Not published

CVE-2009-3695: Algorithmic complexity vulnerability in the forms library in Django 1.0 before 1.0.4 and 1.1 before 1.1.1 allows remote attackers to cause a denial of service (CPU consumption) via a crafted (1) EmailField (email address... Affects python-django versions < 1.1.1-1. Fixed in 1.1.1-1. 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 Penetration testing for web, API and mobile 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 for building web applications using the Python programming language. It provides a set of tools and libraries that simplify the development process. The vulnerability in question affects Django versions 1.0 before 1.0.4 and 1.1 before 1.1.1. This vulnerability specifically targets the forms library in Django, which is responsible for handling form input and validation. The forms library includes fields such as EmailField and URLField, which are used to validate email addresses and URLs respectively.

Vulnerability Detail

The vulnerability, identified as CVE-2009-3695, is an algorithmic complexity vulnerability. It allows remote attackers to cause a denial of service (CPU consumption) by exploiting crafted input in the EmailField or URLField. The vulnerability triggers a large amount of backtracking in a regular expression, leading to excessive CPU usage. This can result in a significant degradation of performance or even a complete denial of service if the system becomes overwhelmed.

How To Fix

Minimum fixed version

1.1.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-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 temporary workaround can be implemented. This involves modifying the regular expression used by the affected fields to limit the potential for backtracking. However, it is important to note that this workaround may not provide complete protection and upgrading to the latest version is still the recommended solution. Here is an example of how the regular expression for the EmailField can be modified:

from django.core.validators import EmailValidator

class FixedEmailValidator(EmailValidator):
    def __call__(self, value):
        self.validate(value)

EmailField.validators.append(FixedEmailValidator())

This code snippet extends the EmailValidator class and overrides its call method to prevent excessive backtracking.

Conclusion

The algorithmic complexity vulnerability in Django's forms library can be exploited to cause a denial of service. Upgrading to Django version 1.1.1 or later is the recommended solution to fix this vulnerability. If immediate upgrade is not possible, a temporary workaround can be implemented. It is important to stay vigilant and apply the necessary fixes to ensure the security and stability of Django applications. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for python-django →

Share this vulnerability

FAQ

The vulnerability can lead to a denial of service (CPU consumption) if exploited. This can result in degraded performance or even a complete system outage.

Django versions 1.0 before 1.0.4 and 1.1 before 1.1.1 are affected by this vulnerability.

You can use the Vulert Playground at Vulert Scanner to check if your Django installation is affected by this vulnerability. Simply upload your package-lock.json file and the playground will analyze it for vulnerabilities.

Yes, a patch is available in Django version 1.1.1 and later. It is recommended to upgrade to the latest version to fix the vulnerability.

There are no known exploits for this vulnerability at the moment. However, it is important to apply the patch or workaround as soon as possible to prevent potential attacks.

Related vulnerabilities

Recent vulnerabilities recorded for python-django.

How To Fix

Minimum fixed version

1.1.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-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