CVE-2020-13596: Django Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-2m34-jcjv-45xf
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2020-13596 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Django libraries in the PyPI ecosystem. The issue involves xss in django. Remediation is available by upgrading affected packages to version 2.2.13, 3.0.7.

CVE-2020-13596 at a Glance

CVE Identifier CVE-2020-13596
GHSA Identifier GHSA-2m34-jcjv-45xf
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Django
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2020-13596

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.2.13
pip install Django>=2.2.13
Django fixed: 3.0.7
pip install Django>=3.0.7
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-2020-13596, 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.2.13), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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 version 2.2 before 2.2.13 and 3.0 before 3.0.7. Query parameters generated by the Django admin ForeignKeyRawIdWidget were not properly URL encoded, leading to a possibility of an XSS attack.

CVE-2020-13596 Affected Django Versions

2 component(s)
Fixed Versions:
2.2.133.0.7
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
≥ 2.2a1
< 2.2.13
2.2.13
Django
PyPI
≥ 3.0a1
< 3.0.7
3.0.7

References

Frequently Asked Questions

What is CVE-2020-13596?
CVE-2020-13596 is a security vulnerability in Django involving XSS in Django under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Django versions are affected?
Affected versions include releases prior to 2.2.13, 3.0.7 across affected packages: Django.
What version fixes CVE-2020-13596?
Upgrading to 2.2.13, 3.0.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 2.2.13, 3.0.7. Upgrade your dependency to 2.2.13, 3.0.7 or later.
What is the CVSS score of CVE-2020-13596?
CVE-2020-13596 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2020-13596?
CVE-2020-13596 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check PyPI dependencies for CVE-2020-13596?
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-2m34-jcjv-45xf",
  "modified" : "2024-09-20T15:43:12Z",
  "published" : "2020-06-05T16:24:28Z",
  "aliases" : [ "CVE-2020-13596" ],
  "summary" : "XSS in Django",
  "details" : "An issue was discovered in Django version 2.2 before 2.2.13 and 3.0 before 3.0.7. Query parameters generated by the Django admin ForeignKeyRawIdWidget were not properly URL encoded, leading to a possibility of an XSS attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2a1"
      }, {
        "fixed" : "2.2.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0a1"
      }, {
        "fixed" : "3.0.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-13596"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/1f2dd37f6fcefdd10ed44cb233b2e62b520afb38"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/6d61860b22875f358fac83d903dc629897934815"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/3.0/releases/security"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2m34-jcjv-45xf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2020-32.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!msg/django-announce/pPEmb2ot4Fo/X-SMalYSBAAJ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4A2AP4T7RKPBCLTI2NNQG3T6MINDUUMZ"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20200611-0002"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4381-1"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4381-2"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2020/dsa-4705"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2020/jun/03/security-releases"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2021.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-04T18:32:57Z",
    "nvd_published_at" : "2020-06-03T14:15:00Z"
  }
}