CVE-2022-36359: Django Django Vulnerable To Reflected File Vulnerability

HIGH
Advisory Identifier: GHSA-8x94-hmjh-97hq
CVSS 8.8
CWE-494
Published
Advisory Summary

CVE-2022-36359 is a HIGH (CVSS 8.8) django vulnerable to reflected file vulnerability (CWE-494: Download of Code Without Integrity Check) affecting Django libraries in the PyPI ecosystem. The issue involves django vulnerable to reflected file download attack. Remediation is available by upgrading affected packages to version 3.2.15, 4.0.7.

CVE-2022-36359 at a Glance

CVE Identifier CVE-2022-36359
GHSA Identifier GHSA-8x94-hmjh-97hq
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-494: Download of Code Without Integrity Check
Affected Product Django
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:U/C:H/I:H/A:H).

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

How to Fix CVE-2022-36359

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: 3.2.15
pip install Django>=3.2.15
Django fixed: 4.0.7
pip install Django>=4.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-2022-36359, 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 3.2.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 CWE-494: Download of Code Without Integrity Check, where the product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code. 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 the HTTP FileResponse class in Django 3.2 before 3.2.15 and 4.0 before 4.0.7. An application is vulnerable to a reflected file download (RFD) attack that sets the Content-Disposition header of a FileResponse when the filename is derived from user-supplied input.

CVE-2022-36359 Affected Django Versions

2 component(s)
Fixed Versions:
3.2.154.0.7
Product / Package Ecosystem Affected Versions Fixed Version
Django
PyPI
< 3.2.15
3.2.15
Django
PyPI
≥ 4.0
< 4.0.7
4.0.7

References

NVD — CVE-2022-36359 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-36359
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/b3e4494d759202a3b6bf247fd34455bf13be5b80
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/b7d9529cbe0af4adabb6ea5d01ed8dcce3668fb3
Security Fix Commit FIX COMMIT
https://github.com/django/django/commit/bd062445cffd3f6cc6dcd20d13e2abed818fa173
Django Release RELEASE
https://docs.djangoproject.com/en/4.0/releases/security
Django Source Repository REPOSITORY
https://github.com/django/django
Django Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-245.yaml
groups.google.com/g/django-announce/c... WEB
https://groups.google.com/g/django-announce/c/8cz--gvaJr4
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI
Django Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220915-0008
Django Security Information SECURITY
https://www.debian.org/security/2022/dsa-5254
Django Release RELEASE
https://www.djangoproject.com/weblog/2022/aug/03/security-releases
Django Security Information SECURITY
http://www.openwall.com/lists/oss-security/2022/08/03/1

Frequently Asked Questions

What is CVE-2022-36359?
CVE-2022-36359 is a security vulnerability in Django involving Django vulnerable to Reflected File Download attack under CWE-494: Download of Code Without Integrity Check.
Which Django versions are affected?
Affected versions include releases prior to 3.2.15, 4.0.7 across affected packages: Django.
What version fixes CVE-2022-36359?
Upgrading to 3.2.15, 4.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 3.2.15, 4.0.7. Upgrade your dependency to 3.2.15, 4.0.7 or later.
What is the CVSS score of CVE-2022-36359?
CVE-2022-36359 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-36359?
CVE-2022-36359 is classified under CWE-494: Download of Code Without Integrity Check (The product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code.).
How can I check PyPI dependencies for CVE-2022-36359?
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-8x94-hmjh-97hq",
  "modified" : "2024-12-18T22:08:23Z",
  "published" : "2022-08-11T14:49:12Z",
  "aliases" : [ "CVE-2022-36359" ],
  "summary" : "Django vulnerable to Reflected File Download attack",
  "details" : "An issue was discovered in the HTTP FileResponse class in Django 3.2 before 3.2.15 and 4.0 before 4.0.7. An application is vulnerable to a reflected file download (RFD) attack that sets the Content-Disposition header of a FileResponse when the filename is derived from user-supplied input.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.15"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Django"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0"
      }, {
        "fixed" : "4.0.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36359"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/b3e4494d759202a3b6bf247fd34455bf13be5b80"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/b7d9529cbe0af4adabb6ea5d01ed8dcce3668fb3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/django/django/commit/bd062445cffd3f6cc6dcd20d13e2abed818fa173"
  }, {
    "type" : "WEB",
    "url" : "https://docs.djangoproject.com/en/4.0/releases/security"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/django/django"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-245.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/django-announce/c/8cz--gvaJr4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220915-0008"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2022/dsa-5254"
  }, {
    "type" : "WEB",
    "url" : "https://www.djangoproject.com/weblog/2022/aug/03/security-releases"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/08/03/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-494" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-11T14:49:12Z",
    "nvd_published_at" : "2022-08-03T14:15:00Z"
  }
}