Fix CVE-2025-15138 upload fullpath extension bypass - #1419
Conversation
|
Putting aside the proposed changes for the moment, there's a discrepancy between the CVE's description and the actual nature of the exploit/vulnerability as per described by the linked reference at mesquite-dream-86b(dot)notion(dot)site. The CVE's description describes the exploit/vulnerability as a "path traversal vulnerability" ("This manipulation of the argument fullpath causes path traversal"). The linked reference at mesquite-dream-86b(dot)notion(dot)site describes the exploit/vulnerability as an "unrestricted file upload vulnerability" (or "file extension bypass", depending on preferred terminology). In fact, the linked reference mentions, "but since no directory traversal is needed and only the file extension needs to be changed, the code remains vulnerable...". I think the CVE's description probably should be reworked a little to better align with the information provided by its linked references (I mention this in case, per chance, whoever originally drafted that CVE happens to read my reply here, and happens to be in a position of still being able to modify it). Just makes it a little easier, when some proposed changes are connected to a public CVE or advisory, to be able to properly review and judge the proposed changes, when everything aligns with relevant source information (i.e., when one can checklist whether x/y/z parts of proposed changes address x/y/z parts of relevant CVEs/advisories and also x/y/z parts of connected relevant source information and so on). |
Summary
Fixes CVE-2025-15138, where the upload
fullpathparameter could be used to bypass upload extension validation and influence the final upload destination/name.Changes
$_FILES['file']['name']usingbasename()instead of trusting the submittedfullpath.fullpathonly as a directory hint for folder uploads, not as the authoritative target filename.realpath()and reject paths outsideFM_ROOT_PATH.Security Impact
This prevents attackers from submitting a crafted
fullpathvalue that causes Tiny File Manager to write an uploaded file with a disallowed extension or outside the intended upload root.Testing
FM_ROOT_PATH..partfiles and renames using the validated target path.