Miggo Logo

CVE-2024-27921: Grav File Upload Path Traversal

8.8

CVSS Score
3.1

Basic Information

EPSS Score
0.90329%
Published
3/22/2024
Updated
10/4/2024
KEV Status
No
Technology
TechnologyPHP

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
getgrav/gravcomposer< 1.7.451.7.45

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the checkFileMetadata method's handling of the $filename parameter. When a user-supplied filename is provided, the code uses dirname($filename) to determine the target folder without sanitizing path traversal sequences. The subsequent Utils::basename() call only sanitizes the filename portion, not the derived folder path. This allows attackers to control the upload directory via path traversal in the filename parameter, as demonstrated in the PoC where '../../' sequences are used to overwrite composer.json. The patch later added a filename check for '..' in Utils::checkFilename(), confirming this was the missing validation.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Summ*ry *r*v is vuln*r**l* to * *il* uplo** p*t* tr*v*rs*l vuln*r**ility, t**t **n *llow *n **v*rs*ry to r*pl*** or *r**t* *il*s wit* *xt*nsions su** *s .json, .zip, .*ss, .*i*, *t*. T*is vuln*r**iltiy **n *llow *tt**k*rs to inj**t *r*itr*ry *o**

Reasoning

T** vuln*r**ility st*ms *rom t** ****k*il*M*t***t* m*t*o*'s **n*lin* o* t** $*il*n*m* p*r*m*t*r. W**n * us*r-suppli** *il*n*m* is provi***, t** *o** us*s *irn*m*($*il*n*m*) to **t*rmin* t** t*r**t *ol**r wit*out s*nitizin* p*t* tr*v*rs*l s*qu*n**s. T