CVE-2017-7233: Django Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-37hp-765x-j95x
CVSS 6.1
CWE-601
Published
Advisory Summary

CVE-2017-7233 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Django libraries in the PyPI ecosystem. The issue involves django open redirect and possible xss attack via user-supplied numeric redirect urls. Remediation is available by upgrading affected packages to version 1.10.7, 1.9.13, 1.8.18.

CVE-2017-7233 at a Glance

CVE Identifier CVE-2017-7233
GHSA Identifier GHSA-37hp-765x-j95x
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
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-2017-7233

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.10.7
pip install Django>=1.10.7
Django fixed: 1.9.13
pip install Django>=1.9.13
Django fixed: 1.8.18
pip install Django>=1.8.18
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-2017-7233, 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.10.7), 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-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. 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

Django 1.10 before 1.10.7, 1.9 before 1.9.13, and 1.8 before 1.8.18 relies on user input in some cases to redirect the user to an "on success" URL. The security check for these redirects (namely ``django.utils.http.is_safe_url()``) considered some numeric URLs "safe" when they shouldn't be, aka an open redirect vulnerability. Also, if a developer relies on ``is_safe_url()`` to provide safe redirect targets and puts such a URL into a link, they could suffer from an XSS attack.

CVE-2017-7233 Affected Django Versions

3 component(s)
Fixed Versions:
1.10.71.9.131.8.18
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
≥ 1.10a1
< 1.10.7
1.10.7
Django
PyPI
≥ 1.9a1
< 1.9.13
1.9.13
Django
PyPI
≥ 1.8a1
< 1.8.18
1.8.18

References

NVD — CVE-2017-7233 NVD
https://nvd.nist.gov/vuln/detail/CVE-2017-7233
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/254326cb3682389f55f886804d2c43f7b9f23e4f
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/8339277518c7d8ec280070a780915304654e3b66
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/f824655bc2c50b19d2f202d7640785caabc82787
access.redhat.com/errata/rhsa-2017:14... WEB
https://access.redhat.com/errata/RHSA-2017:1445
access.redhat.com/errata/rhsa-2017:14... WEB
https://access.redhat.com/errata/RHSA-2017:1451
access.redhat.com/errata/rhsa-2017:14... WEB
https://access.redhat.com/errata/RHSA-2017:1462
access.redhat.com/errata/rhsa-2017:14... WEB
https://access.redhat.com/errata/RHSA-2017:1470
access.redhat.com/errata/rhsa-2017:15... WEB
https://access.redhat.com/errata/RHSA-2017:1596
access.redhat.com/errata/rhsa-2017:30... WEB
https://access.redhat.com/errata/RHSA-2017:3093
access.redhat.com/errata/rhsa-2018:29... WEB
https://access.redhat.com/errata/RHSA-2018:2927
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-37hp-765x-j95x
Django Source Repository REPOSITORY
https://github.com/django/django
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2017-9.yaml
Django Release RELEASE
https://www.djangoproject.com/weblog/2017/apr/04/security-releases
Django Security Information SECURITY
http://www.debian.org/security/2017/dsa-3835

Frequently Asked Questions

What is CVE-2017-7233?
CVE-2017-7233 is a security vulnerability in Django involving Django open redirect and possible XSS attack via user-supplied numeric redirect URLs under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Django versions are affected?
Affected versions include releases prior to 1.10.7, 1.9.13, 1.8.18 across affected packages: Django.
What version fixes CVE-2017-7233?
Upgrading to 1.10.7, 1.9.13, 1.8.18 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Django affected?
Yes, Django is affected in releases prior to 1.10.7, 1.9.13, 1.8.18. Upgrade your dependency to 1.10.7, 1.9.13, 1.8.18 or later.
What is the CVSS score of CVE-2017-7233?
CVE-2017-7233 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-2017-7233?
CVE-2017-7233 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check PyPI dependencies for CVE-2017-7233?
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-37hp-765x-j95x",
  "modified" : "2024-09-18T16:08:51Z",
  "published" : "2019-01-04T17:50:26Z",
  "aliases" : [ "CVE-2017-7233" ],
  "summary" : "Django open redirect and possible XSS attack via user-supplied numeric redirect URLs",
  "details" : "Django 1.10 before 1.10.7, 1.9 before 1.9.13, and 1.8 before 1.8.18 relies on user input in some cases to redirect the user to an \"on success\" URL. The security check for these redirects (namely ``django.utils.http.is_safe_url()``) considered some numeric URLs \"safe\" when they shouldn't be, aka an open redirect vulnerability. Also, if a developer relies on ``is_safe_url()`` to provide safe redirect targets and puts such a URL into a link, they could suffer from an XSS attack.",
  "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.10a1"
      }, {
        "fixed" : "1.10.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.9a1"
      }, {
        "fixed" : "1.9.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.8a1"
      }, {
        "fixed" : "1.8.18"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-7233"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/254326cb3682389f55f886804d2c43f7b9f23e4f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/8339277518c7d8ec280070a780915304654e3b66"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/f824655bc2c50b19d2f202d7640785caabc82787"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:1445"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:1451"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:1462"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:1470"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:1596"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:3093"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:2927"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-37hp-765x-j95x"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2017-9.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2017/apr/04/security-releases"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2017/dsa-3835"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T20:54:21Z",
    "nvd_published_at" : null
  }
}