Miggo Logo

CVE-2022-44289: Thinkphp has a code logic error

8.8

CVSS Score
3.1

Basic Information

EPSS Score
0.28512%
Published
12/6/2022
Updated
2/2/2023
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
topthink/frameworkcomposer<= 5.0.24
topthink/frameworkcomposer>= 5.1, <= 5.1.41

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the checkImg() method's flawed validation logic. The original implementation checks if a file's extension is in the image list (gif/jpg/etc.) and its MIME type is invalid, returning an error only in that specific case. This allows files with non-image extensions (like .php) to bypass content validation entirely. When combined with ThinkPHP's move() method for uploads, this permits dangerous file types to be uploaded. The GitHub issue explicitly shows this function's logic inversion and demonstrates how it leads to getshell vulnerabilities.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T*inkp*p *.*.** *n* *.*.** **s * *o** lo*i* *rror w*i** **us*s *il* uplo** **ts**ll.

Reasoning

T** vuln*r**ility st*ms *rom t** ****kIm*() m*t*o*'s *l*w** v*li**tion lo*i*. T** ori*in*l impl*m*nt*tion ****ks i* * *il*'s *xt*nsion is in t** im*** list (*i*/jp*/*t*.) **n** its MIM* typ* is inv*li*, r*turnin* *n *rror only in t**t sp**i*i* **s*.