# CVE-2020-15225: Denial of Service vulnerability in django-filter


- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 29 Apr 2021
- **Updated:** 4 Aug 2024
- **Also known as:** DEBIAN-CVE-2020-15225, GHSA-x7gm-rfgv-w973, MGASA-2021-0511, PYSEC-2021-64, UBUNTU-CVE-2020-15225

## What is CVE-2020-15225?

CVE-2020-15225 is a high-severity vulnerability in Fedoraproject Fedora, published on 29 Apr 2021. 

### Official description

django-filter is a generic system for filtering Django QuerySets based on user selections. In django-filter before version 2.4.0, automatically generated `NumberFilter` instances, whose value was later converted to an integer, were subject to potential DoS from maliciously input using exponential format with sufficiently large exponents. Version 2.4.0+ applies a `MaxValueValidator` with a a default `limit_value` of 1e50 to the form field used by `NumberFilter` instances. In addition, `NumberFilter` implements the new `get_max_validator()` which should return a configured validator instance to customise the limit, or else `None` to disable the additional validation. Users may manually apply an equivalent validator if they are not able to upgrade.

Weakness: CWE-681 (Incorrect Conversion between Numeric Types)

## Which versions are affected by CVE-2020-15225?

3 open source packages ship an affected version, including django-filter. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `django-filter` | PyPI | All versions | 2.4.0 |
| `django-filter` | PyPI | All versions | 2.4.0 |
| `django-filter` | PyPI | All versions | 2.4.0 |

Products: Django-Filter Project Django-Filter, Fedoraproject Fedora.

## How do I fix CVE-2020-15225?

Upgrade django-filter to 2.4.0 or later.

## Is CVE-2020-15225 being exploited?

There is no known exploitation of CVE-2020-15225 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-15225 and fix it if it is affected.

What it is: CVE-2020-15225 is a high-severity vulnerability in Fedoraproject Fedora, published on 29 Apr 2021. 
Exploitation: There is no known exploitation of CVE-2020-15225 in the wild and no public exploit code.

Affected packages and fixed versions:
- django-filter (PyPI): affected all versions; fixed in 2.4.0
- django-filter (PyPI): affected all versions; fixed in 2.4.0
- django-filter (PyPI): affected all versions; fixed in 2.4.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-15225/ (Markdown: https://insights.sbomify.com/CVE-2020-15225/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-15225
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-15225
- OSV: https://osv.dev/vulnerability/CVE-2020-15225

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-15225/
Summaries are generated and may contain mistakes; the official description above is the record.
