GHSA-6r3c-8xf3-ggrr: Django sendfile2 Path Traversal Vulnerability
MODERATEGHSA-6r3c-8xf3-ggrr is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Django sendfile2 libraries in the PyPI ecosystem. The issue involves directory traversal outside of sendfile_root in django-sendfile2. Remediation is available by upgrading affected packages to version 0.6.0.
GHSA-6r3c-8xf3-ggrr at a Glance
How to Fix GHSA-6r3c-8xf3-ggrr
To remediate this vulnerability, upgrade all affected Django sendfile2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install django-sendfile2>=0.6.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show django-sendfile2
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-6r3c-8xf3-ggrr, inspect your installed packages using pip:
pip show django-sendfile2
Analyze the terminal output to locate any version of Django sendfile2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.0), your application is affected.
Note: The pip show django-sendfile2 command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Django sendfile2, 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
GHSA-6r3c-8xf3-ggrr Affected Django sendfile2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
django-sendfile2
|
PyPI |
< 0.6.0
|
0.6.0
|
References
Frequently Asked Questions
What is GHSA-6r3c-8xf3-ggrr?
Which Django sendfile2 versions are affected?
What version fixes GHSA-6r3c-8xf3-ggrr?
Is django-sendfile2 affected?
What CWE is associated with GHSA-6r3c-8xf3-ggrr?
How can I check PyPI dependencies for GHSA-6r3c-8xf3-ggrr?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6r3c-8xf3-ggrr",
"modified" : "2021-09-22T18:37:22Z",
"published" : "2020-06-24T17:15:26Z",
"aliases" : [ ],
"summary" : "Directory traversal outside of SENDFILE_ROOT in django-sendfile2",
"details" : "django-sendfile2 currently relies on the backend to correctly limit file paths to `SENDFILE_ROOT`. This is not the case for the `simple` and `development` backends, it is also not necessarily the case for any of the other backends either (it's just an assumption that was made by the original author).\n\nThis will be fixed in 0.6.0 which is to be released the same day as this advisory is made public.\n\nWhen upgrading, you will need to make sure `SENDFILE_ROOT` is set in your settings module if it wasn't already.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "django-sendfile2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.6.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/moggers87/django-sendfile2/security/advisories/GHSA-6r3c-8xf3-ggrr"
}, {
"type" : "WEB",
"url" : "https://github.com/moggers87/django-sendfile2/commit/f870c52398a55b9b5189932dd8caa24efb4bc1e1"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/moggers87/django-sendfile2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-18T16:55:25Z",
"nvd_published_at" : null
}
}