CVE-2020-15225: Django filter Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-x7gm-rfgv-w973
CVSS 7.5
CWE-681
Published
Advisory Summary

CVE-2020-15225 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-681: Incorrect Conversion between Numeric Types) affecting Django filter libraries in the PyPI ecosystem. The issue involves potential dos with numberfilter conversion to integer values.. Remediation is available by upgrading affected packages to version 2.4.0.

CVE-2020-15225 at a Glance

CVE Identifier CVE-2020-15225
GHSA Identifier GHSA-x7gm-rfgv-w973
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-681: Incorrect Conversion between Numeric Types
Affected Product Django filter
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
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-2020-15225

To remediate this vulnerability, upgrade all affected Django filter 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-filter fixed: 2.4.0
pip install django-filter>=2.4.0
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-filter

How to Check if You Are Affected

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

pip show django-filter

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-681: Incorrect Conversion between Numeric Types, where when converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. if the resulting values are used in a sensitive context, then dangerous behaviors may occur. In Django filter, 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

### Impact 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. ### Patches 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. ### Workarounds Users may manually apply an equivalent validator if they are not able to upgrade. ### For more information If you have any questions or comments about this advisory: * Open an issue in [the django-filter repo](https://github.com/carltongibson/django-filter) Thanks to Marcin Waraksa for the report.

CVE-2020-15225 Affected Django filter Versions

1 component(s)
Fixed Versions:
2.4.0
Product / Package Ecosystem Affected Versions Fixed Version
django-filter
PyPI
< 2.4.0
2.4.0

References

Frequently Asked Questions

What is CVE-2020-15225?
CVE-2020-15225 is a security vulnerability in Django filter involving Potential DoS with NumberFilter conversion to integer values. under CWE-681: Incorrect Conversion between Numeric Types.
Which Django filter versions are affected?
Affected versions include releases prior to 2.4.0 across affected packages: django-filter.
What version fixes CVE-2020-15225?
Upgrading to 2.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is django-filter affected?
Yes, django-filter is affected in releases prior to 2.4.0. Upgrade your dependency to 2.4.0 or later.
What is the CVSS score of CVE-2020-15225?
CVE-2020-15225 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2020-15225?
CVE-2020-15225 is classified under CWE-681: Incorrect Conversion between Numeric Types (When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur.).
How can I check PyPI dependencies for CVE-2020-15225?
Run the dependency tree command: 'pip show django-filter'. 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-x7gm-rfgv-w973",
  "modified" : "2024-09-16T22:10:02Z",
  "published" : "2020-09-28T19:05:29Z",
  "aliases" : [ "CVE-2020-15225" ],
  "summary" : "Potential DoS with NumberFilter conversion to integer values.",
  "details" : "### Impact\n\nAutomatically 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. \n\n### Patches\n\nVersion 2.4.0+ applies a `MaxValueValidator` with a a default `limit_value` of 1e50 to the form field used by `NumberFilter` instances. \n\nIn 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. \n\n### Workarounds\n\nUsers may manually apply an equivalent validator if they are not able to upgrade.  \n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the django-filter repo](https://github.com/carltongibson/django-filter)\n\nThanks to Marcin Waraksa for the report. \n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/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-filter"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/carltongibson/django-filter/security/advisories/GHSA-x7gm-rfgv-w973"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15225"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/carltongibson/django-filter/commit/340cf7a23a2b3dcd7183f6a0d6c383e85b130d2b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/carltongibson/django-filter"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/carltongibson/django-filter/releases/tag/2.4.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django-filter/PYSEC-2021-64.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DPHENTRHRAYFXYPPBT7JRHZRWILRY44S"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FAT2ZAEF6DM3VFSOHKB7X3ASSHGQHJAK"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SVJ7AYU6FUSU3F653YCGW5LFD3IULRSX"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/django-filter"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210604-0010"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-681" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-09-28T19:04:39Z",
    "nvd_published_at" : "2021-04-29T21:15:00Z"
  }
}