CVE-2021-3281: Django Directory Traversal via archive.extract
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.96723%
CWE
Published
3/18/2021
Updated
9/20/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
django | pip | >= 2.2, < 2.2.18 | 2.2.18 |
django | pip | >= 3.1, < 3.1.6 | 3.1.6 |
django | pip | >= 3.0, < 3.0.12 | 3.0.12 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the lack of path validation in archive extraction methods. The commit 05413afa8c18cdb978fcdf470e09f7a12b234a23 adds a new target_filename()
method to validate
paths, which was missing in vulnerable versions. Both TarArchive
and ZipArchive
's extract methods directly used os.path.join()
without sanitization, making them vulnerable to path traversal. The patch modifies these methods to use the new validation
, confirming these functions as the vulnerability source.