CVE-2018-7536: Django Django Denial-of-service Possibility Vulnerability

MODERATE
Advisory Identifier: GHSA-r28v-mw67-m5p9
CVSS 5.3
CWE-185
Published
Advisory Summary

CVE-2018-7536 is a MODERATE (CVSS 5.3) django denial-of-service possibility vulnerability (CWE-185: Incorrect Regular Expression) affecting Django libraries in the PyPI ecosystem. The issue involves django denial-of-service possibility in urlize and urlizetrunc template filters. Remediation is available by upgrading affected packages to version 2.0.3, 1.11.11, 1.8.19.

CVE-2018-7536 at a Glance

CVE Identifier CVE-2018-7536
GHSA Identifier GHSA-r28v-mw67-m5p9
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-185: Incorrect Regular Expression
Affected Product Django
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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 Low (A:L)

How to Fix CVE-2018-7536

To remediate this vulnerability, upgrade all affected Django 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 fixed: 2.0.3
pip install Django>=2.0.3
Django fixed: 1.11.11
pip install Django>=1.11.11
Django fixed: 1.8.19
pip install Django>=1.8.19
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

How to Check if You Are Affected

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

pip show Django

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-185: Incorrect Regular Expression, where the product specifies a regular expression in a way that causes data to be improperly matched or compared. In Django, 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

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. The `django.utils.html.urlize()` function was extremely slow to evaluate certain inputs due to catastrophic backtracking vulnerabilities in two regular expressions (only one regular expression for Django 1.8.x). The `urlize()` function is used to implement the urlize and urlizetrunc template filters, which were thus vulnerable.

CVE-2018-7536 Affected Django Versions

3 component(s)
Fixed Versions:
2.0.31.11.111.8.19
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
≥ 2.0a1
< 2.0.3
2.0.3
Django
PyPI
≥ 1.11a1
< 1.11.11
1.11.11
Django
PyPI
≥ 1.8a1
< 1.8.19
1.8.19

References

NVD — CVE-2018-7536 NVD
https://nvd.nist.gov/vuln/detail/CVE-2018-7536
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/1ca63a66ef3163149ad822701273e8a1844192c2
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/abf89d729f210c692a50e0ad3f75fb6bec6fae16
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/e157315da3ae7005fa0683ffc9751dbeca7306c8
access.redhat.com/errata/rhsa-2018:29... WEB
https://access.redhat.com/errata/RHSA-2018:2927
access.redhat.com/errata/rhsa-2019:00... WEB
https://access.redhat.com/errata/RHSA-2019:0051
access.redhat.com/errata/rhsa-2019:00... WEB
https://access.redhat.com/errata/RHSA-2019:0082
access.redhat.com/errata/rhsa-2019:02... WEB
https://access.redhat.com/errata/RHSA-2019:0265
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-r28v-mw67-m5p9
Django Source Repository REPOSITORY
https://github.com/django/django
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2018-5.yaml
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2018/03/msg00006.html
usn.ubuntu.com/3591-1 WEB
https://usn.ubuntu.com/3591-1
Django Security Information SECURITY
https://web.archive.org/web/20200227131019/http://www.securityfocus.com/bid/103361
Django Security Information SECURITY
https://www.debian.org/security/2018/dsa-4161
Django Release RELEASE
https://www.djangoproject.com/weblog/2018/mar/06/security-releases

Frequently Asked Questions

What is CVE-2018-7536?
CVE-2018-7536 is a security vulnerability in Django involving Django denial-of-service possibility in urlize and urlizetrunc template filters under CWE-185: Incorrect Regular Expression.
Which Django versions are affected?
Affected versions include releases prior to 2.0.3, 1.11.11, 1.8.19 across affected packages: Django.
What version fixes CVE-2018-7536?
Upgrading to 2.0.3, 1.11.11, 1.8.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 2.0.3, 1.11.11, 1.8.19. Upgrade your dependency to 2.0.3, 1.11.11, 1.8.19 or later.
What is the CVSS score of CVE-2018-7536?
CVE-2018-7536 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2018-7536?
CVE-2018-7536 is classified under CWE-185: Incorrect Regular Expression (The product specifies a regular expression in a way that causes data to be improperly matched or compared.).
How can I check PyPI dependencies for CVE-2018-7536?
Run the dependency tree command: 'pip show Django'. 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-r28v-mw67-m5p9",
  "modified" : "2024-09-18T19:45:18Z",
  "published" : "2019-01-04T17:50:07Z",
  "aliases" : [ "CVE-2018-7536" ],
  "summary" : "Django denial-of-service possibility in urlize and urlizetrunc template filters",
  "details" : "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. The `django.utils.html.urlize()` function was extremely slow to evaluate certain inputs due to catastrophic backtracking vulnerabilities in two regular expressions (only one regular expression for Django 1.8.x). The `urlize()` function is used to implement the urlize and urlizetrunc template filters, which were thus vulnerable.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0a1"
      }, {
        "fixed" : "2.0.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.11a1"
      }, {
        "fixed" : "1.11.11"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.8a1"
      }, {
        "fixed" : "1.8.19"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-7536"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/1ca63a66ef3163149ad822701273e8a1844192c2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/abf89d729f210c692a50e0ad3f75fb6bec6fae16"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/e157315da3ae7005fa0683ffc9751dbeca7306c8"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:2927"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:0051"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:0082"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:0265"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-r28v-mw67-m5p9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2018-5.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/03/msg00006.html"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3591-1"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20200227131019/http://www.securityfocus.com/bid/103361"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2018/dsa-4161"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2018/mar/06/security-releases"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-185" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:53:19Z",
    "nvd_published_at" : "2018-03-09T20:29:00Z"
  }
}