CVE-2019-12308: Django Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-7rp2-fm2h-wchj
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2019-12308 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 django cross-site scripting in adminurlfieldwidget. Remediation is available by upgrading affected packages to version 1.11.21, 2.1.9, 2.2.2.

CVE-2019-12308 at a Glance

CVE Identifier CVE-2019-12308
GHSA Identifier GHSA-7rp2-fm2h-wchj
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.0/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-2019-12308

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: 1.11.21
pip install Django>=1.11.21
Django fixed: 2.1.9
pip install Django>=2.1.9
Django fixed: 2.2.2
pip install Django>=2.2.2
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-2019-12308, 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 1.11.21), 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 1.11 before 1.11.21, 2.1 before 2.1.9, and 2.2 before 2.2.2. The clickable Current URL value displayed by the AdminURLFieldWidget displays the provided value without validating it as a safe URL. Thus, an unvalidated value stored in the database, or a value provided as a URL query parameter payload, could result in an clickable JavaScript link.

CVE-2019-12308 Affected Django Versions

3 component(s)
Fixed Versions:
1.11.212.1.92.2.2
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
≥ 1.11a1
< 1.11.21
1.11.21
Django
PyPI
≥ 2.1a1
< 2.1.9
2.1.9
Django
PyPI
≥ 2.2a1
< 2.2.2
2.2.2

References

NVD — CVE-2019-12308 NVD
https://nvd.nist.gov/vuln/detail/CVE-2019-12308
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/09186a13d975de6d049f8b3e05484f66b01ece62
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/afddabf8428ddc89a332f7a78d0d21eaf2b5a673
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/c238701859a52d584f349cce15d56c8e8137c52b
Django Release RELEASE
https://www.djangoproject.com/weblog/2019/jun/03/security-releases
Django Security Information SECURITY
https://www.debian.org/security/2019/dsa-4476
usn.ubuntu.com/4043-1 WEB
https://usn.ubuntu.com/4043-1
Django Security Information SECURITY
https://security.gentoo.org/glsa/202004-17
seclists.org/bugtraq/2019/jul/10 WEB
https://seclists.org/bugtraq/2019/Jul/10
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/USYRARSYB7PE3S2ZQO7PZNWMH7RPGL5G
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2019/07/msg00001.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2019/06/msg00001.html
groups.google.com/forum/ WEB
https://groups.google.com/forum/#!topic/django-announce/GEbHU7YoVz8
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2019-79.yaml
Django Source Repository REPOSITORY
https://github.com/django/django
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-7rp2-fm2h-wchj
Django Release RELEASE
https://docs.djangoproject.com/en/dev/releases/security
Django Release RELEASE
https://docs.djangoproject.com/en/dev/releases/2.2.2
Django Release RELEASE
https://docs.djangoproject.com/en/dev/releases/2.1.9
Django Release RELEASE
https://docs.djangoproject.com/en/dev/releases/1.11.21
Django Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html
Django Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html
Django Security Information SECURITY
http://www.openwall.com/lists/oss-security/2019/06/03/2

Frequently Asked Questions

What is CVE-2019-12308?
CVE-2019-12308 is a security vulnerability in Django involving Django Cross-site Scripting in AdminURLFieldWidget 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 1.11.21, 2.1.9, 2.2.2 across affected packages: Django.
What version fixes CVE-2019-12308?
Upgrading to 1.11.21, 2.1.9, 2.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 1.11.21, 2.1.9, 2.2.2. Upgrade your dependency to 1.11.21, 2.1.9, 2.2.2 or later.
What is the CVSS score of CVE-2019-12308?
CVE-2019-12308 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2019-12308?
CVE-2019-12308 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-2019-12308?
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-7rp2-fm2h-wchj",
  "modified" : "2024-09-20T16:03:27Z",
  "published" : "2019-06-10T18:43:25Z",
  "aliases" : [ "CVE-2019-12308" ],
  "summary" : "Django Cross-site Scripting in AdminURLFieldWidget",
  "details" : "An issue was discovered in Django 1.11 before 1.11.21, 2.1 before 2.1.9, and 2.2 before 2.2.2. The clickable Current URL value displayed by the AdminURLFieldWidget displays the provided value without validating it as a safe URL. Thus, an unvalidated value stored in the database, or a value provided as a URL query parameter payload, could result in an clickable JavaScript link.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/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" : "1.11a1"
      }, {
        "fixed" : "1.11.21"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1a1"
      }, {
        "fixed" : "2.1.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2a1"
      }, {
        "fixed" : "2.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-12308"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/09186a13d975de6d049f8b3e05484f66b01ece62"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/afddabf8428ddc89a332f7a78d0d21eaf2b5a673"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/c238701859a52d584f349cce15d56c8e8137c52b"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2019/jun/03/security-releases"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2019/dsa-4476"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4043-1"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202004-17"
  }, {
    "type" : "WEB",
    "url" : "https://seclists.org/bugtraq/2019/Jul/10"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/USYRARSYB7PE3S2ZQO7PZNWMH7RPGL5G"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2019/07/msg00001.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2019/06/msg00001.html"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!topic/django-announce/GEbHU7YoVz8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2019-79.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-7rp2-fm2h-wchj"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/dev/releases/security"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/dev/releases/2.2.2"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/dev/releases/2.1.9"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/dev/releases/1.11.21"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00006.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00025.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2019/06/03/2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-06-10T18:41:42Z",
    "nvd_published_at" : "2019-06-03T17:29:00Z"
  }
}