Miggo Logo

CVE-2021-3281: Django Directory Traversal via archive.extract

5.3

CVSS Score
3.1

Basic Information

EPSS Score
0.96723%
Published
3/18/2021
Updated
9/20/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
djangopip>= 2.2, < 2.2.182.2.18
djangopip>= 3.1, < 3.1.63.1.6
djangopip>= 3.0, < 3.0.123.0.12

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

In *j*n*o *.* ***or* *.*.**, *.* ***or* *.*.**, *n* *.* ***or* *.*.*, t** *j*n*o.utils.*r**iv*.*xtr**t m*t*o* (us** *y "st*rt*pp --t*mpl*t*" *n* "st*rtproj**t --t*mpl*t*") *llows *ir**tory tr*v*rs*l vi* *n *r**iv* wit* **solut* p*t*s or r*l*tiv* p*t*

Reasoning

T** vuln*r**ility st*ms *rom t** l**k o* p*t* v*li**tion in *r**iv* *xtr**tion m*t*o*s. T** *ommit **************************************** ***s * n*w `t*r**t_*il*n*m*()` m*t*o* to `v*li**t*` p*t*s, w*i** w*s missin* in vuln*r**l* v*rsions. *ot* `T*r