CVE-2016-7401: Django Django CSRF Protection Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-crhm-qpjc-cm64
CVSS 7.5
Published
Advisory Summary

CVE-2016-7401 is a HIGH (CVSS 7.5) django csrf protection bypass vulnerability (General Security Weakness) affecting Django libraries in the PyPI ecosystem. The issue involves django csrf protection bypass. Remediation is available by upgrading affected packages to version 1.8.15, 1.9.10.

CVE-2016-7401 at a Glance

CVE Identifier CVE-2016-7401
GHSA Identifier GHSA-crhm-qpjc-cm64
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification General Security Weakness
Affected Product Django
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.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).

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 High (I:H)
Availability None (A:N)

How to Fix CVE-2016-7401

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.15
pip install Django>=1.8.15
Django fixed: 1.9.10
pip install Django>=1.9.10
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-7401, 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.15), 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 General Security Weakness. 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

The cookie parsing code in Django before 1.8.15 and 1.9.x before 1.9.10, when used on a site with Google Analytics, allows remote attackers to bypass an intended CSRF protection mechanism by setting arbitrary cookies.

CVE-2016-7401 Affected Django Versions

2 component(s)
Fixed Versions:
1.8.151.9.10
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
< 1.8.15
1.8.15
Django
PyPI
≥ 1.9
< 1.9.10
1.9.10

References

NVD — CVE-2016-7401 NVD
https://nvd.nist.gov/vuln/detail/CVE-2016-7401
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/6118ab7d0676f0d622278e5be215f14fb5410b6a
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/6fe846a8f08dc959003f298b5407e321c6fe3735
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/d1bc980db1c0fffd6d60677e62f70beadb9fe64a
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-3.yaml
Django Security Information SECURITY
https://web.archive.org/web/20200227223637/http://www.securityfocus.com/bid/93182
Django Security Information SECURITY
https://web.archive.org/web/20210927195154/http://www.securitytracker.com/id/1036899
Django Release RELEASE
https://www.djangoproject.com/weblog/2016/sep/26/security-releases
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2038.html
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2039.html
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2040.html
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2041.html
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2042.html
rhn.redhat.com/errata/rhsa-2016-20... WEB
http://rhn.redhat.com/errata/RHSA-2016-2043.html
Django Security Information SECURITY
http://www.debian.org/security/2016/dsa-3678
www.ubuntu.com/usn/usn-3089-1 WEB
http://www.ubuntu.com/usn/USN-3089-1

Frequently Asked Questions

What is CVE-2016-7401?
CVE-2016-7401 is a security vulnerability in Django involving Django CSRF Protection Bypass under General Security Weakness.
Which Django versions are affected?
Affected versions include releases prior to 1.8.15, 1.9.10 across affected packages: Django.
What version fixes CVE-2016-7401?
Upgrading to 1.8.15, 1.9.10 (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.15, 1.9.10. Upgrade your dependency to 1.8.15, 1.9.10 or later.
What is the CVSS score of CVE-2016-7401?
CVE-2016-7401 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2016-7401?
CVE-2016-7401 is classified under General Security Weakness.
How can I check PyPI dependencies for CVE-2016-7401?
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-crhm-qpjc-cm64",
  "modified" : "2024-09-18T16:16:33Z",
  "published" : "2022-05-14T03:55:50Z",
  "aliases" : [ "CVE-2016-7401" ],
  "summary" : "Django CSRF Protection Bypass",
  "details" : "The cookie parsing code in Django before 1.8.15 and 1.9.x before 1.9.10, when used on a site with Google Analytics, allows remote attackers to bypass an intended CSRF protection mechanism by setting arbitrary cookies.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.8.15"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.9"
      }, {
        "fixed" : "1.9.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-7401"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/6118ab7d0676f0d622278e5be215f14fb5410b6a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/6fe846a8f08dc959003f298b5407e321c6fe3735"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/d1bc980db1c0fffd6d60677e62f70beadb9fe64a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2016-3.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20200227223637/http://www.securityfocus.com/bid/93182"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20210927195154/http://www.securitytracker.com/id/1036899"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2016/sep/26/security-releases"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2038.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2039.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2040.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2041.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2042.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2016-2043.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2016/dsa-3678"
  }, {
    "type" : "WEB",
    "url" : "http://www.ubuntu.com/usn/USN-3089-1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-31T18:44:08Z",
    "nvd_published_at" : "2016-10-03T18:59:00Z"
  }
}