CVE-2016-6186: Django Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-c8c8-9472-w52h
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2016-6186 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 vulnerability. Remediation is available by upgrading affected packages to version 1.8.14, 1.9.8, 1.10rc1.

CVE-2016-6186 at a Glance

CVE Identifier CVE-2016-6186
GHSA Identifier GHSA-c8c8-9472-w52h
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-2016-6186

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.8.14
pip install Django>=1.8.14
Django fixed: 1.9.8
pip install Django>=1.9.8
Django fixed: 1.10rc1
pip install Django>=1.10rc1
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-2016-6186, 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.8.14), 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

Cross-site scripting (XSS) vulnerability in the `dismissChangeRelatedObjectPopup` function in `contrib/admin/static/admin/js/admin/RelatedObjectLookups.js` in Django before 1.8.14, 1.9.x before 1.9.8, and 1.10.x before 1.10rc1 allows remote attackers to inject arbitrary web script or HTML via vectors involving unsafe usage of Element.innerHTML.

CVE-2016-6186 Affected Django Versions

3 component(s)
Fixed Versions:
1.8.141.9.81.10rc1
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
< 1.8.14
1.8.14
Django
PyPI
≥ 1.9
< 1.9.8
1.9.8
Django
PyPI
≥ 1.10a1
< 1.10rc1
1.10rc1

References

NVD — CVE-2016-6186 NVD
https://nvd.nist.gov/vuln/detail/CVE-2016-6186
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/6fa150b2f8b601668083042324c4add534143cb1
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/d03bf6fe4e9bf5b07de62c1a271c4b41a7d3d158
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/f68e5a99164867ab0e071a936470958ed867479d
Django Source Repository REPOSITORY
https://github.com/django/django
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2016-2.yaml
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DMLLFAUT4J4IP4P2KI4NOVWRMHA22WUJ
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KHHPN6MISX5I6UTXQHYLPTLEEUE6WDXW
Django Security Information SECURITY
https://web.archive.org/web/20201022155237/http://www.securityfocus.com/archive/1/538947/100/0/threaded
Django Security Information SECURITY
https://web.archive.org/web/20210123154652/http://www.securityfocus.com/bid/92058
Django Security Information SECURITY
https://web.archive.org/web/20211204042848/http://www.securitytracker.com/id/1036338
Django Release RELEASE
https://www.djangoproject.com/weblog/2016/jul/18/security-releases
www.exploit-db.com/exploits/40129 WEB
https://www.exploit-db.com/exploits/40129
Django Security Information SECURITY
http://packetstormsecurity.com/files/137965/Django-3.3.0-Script-Insertion.html
rhn.redhat.com/errata/rhsa-2016-15... WEB
http://rhn.redhat.com/errata/RHSA-2016-1594.html
rhn.redhat.com/errata/rhsa-2016-15... WEB
http://rhn.redhat.com/errata/RHSA-2016-1595.html
rhn.redhat.com/errata/rhsa-2016-15... WEB
http://rhn.redhat.com/errata/RHSA-2016-1596.html
seclists.org/fulldisclosure/2016... WEB
http://seclists.org/fulldisclosure/2016/Jul/53
Django Security Information SECURITY
http://www.debian.org/security/2016/dsa-3622
www.ubuntu.com/usn/usn-3039-1 WEB
http://www.ubuntu.com/usn/USN-3039-1
www.vulnerability-lab.com/get_content.php WEB
http://www.vulnerability-lab.com/get_content.php?id=1869

Frequently Asked Questions

What is CVE-2016-6186?
CVE-2016-6186 is a security vulnerability in Django involving Django Cross-site scripting Vulnerability 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.8.14, 1.9.8, 1.10rc1 across affected packages: Django.
What version fixes CVE-2016-6186?
Upgrading to 1.8.14, 1.9.8, 1.10rc1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 1.8.14, 1.9.8, 1.10rc1. Upgrade your dependency to 1.8.14, 1.9.8, 1.10rc1 or later.
What is the CVSS score of CVE-2016-6186?
CVE-2016-6186 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-2016-6186?
CVE-2016-6186 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-2016-6186?
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-c8c8-9472-w52h",
  "modified" : "2024-09-17T15:13:11Z",
  "published" : "2022-05-14T02:46:13Z",
  "aliases" : [ "CVE-2016-6186" ],
  "summary" : "Django Cross-site scripting Vulnerability",
  "details" : "Cross-site scripting (XSS) vulnerability in the `dismissChangeRelatedObjectPopup` function in `contrib/admin/static/admin/js/admin/RelatedObjectLookups.js` in Django before 1.8.14, 1.9.x before 1.9.8, and 1.10.x before 1.10rc1 allows remote attackers to inject arbitrary web script or HTML via vectors involving unsafe usage of Element.innerHTML.",
  "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" : "0"
      }, {
        "fixed" : "1.8.14"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.9"
      }, {
        "fixed" : "1.9.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.10a1"
      }, {
        "fixed" : "1.10rc1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-6186"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/6fa150b2f8b601668083042324c4add534143cb1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/d03bf6fe4e9bf5b07de62c1a271c4b41a7d3d158"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/f68e5a99164867ab0e071a936470958ed867479d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2016-2.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DMLLFAUT4J4IP4P2KI4NOVWRMHA22WUJ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KHHPN6MISX5I6UTXQHYLPTLEEUE6WDXW"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20201022155237/http://www.securityfocus.com/archive/1/538947/100/0/threaded"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20210123154652/http://www.securityfocus.com/bid/92058"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20211204042848/http://www.securitytracker.com/id/1036338"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2016/jul/18/security-releases"
  }, {
    "type" : "WEB",
    "url" : "https://www.exploit-db.com/exploits/40129"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/137965/Django-3.3.0-Script-Insertion.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-1594.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-1595.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-1596.html"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2016/Jul/53"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2016/dsa-3622"
  }, {
    "type" : "WEB",
    "url" : "http://www.ubuntu.com/usn/USN-3039-1"
  }, {
    "type" : "WEB",
    "url" : "http://www.vulnerability-lab.com/get_content.php?id=1869"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-31T18:31:52Z",
    "nvd_published_at" : "2016-08-05T15:59:00Z"
  }
}