ZIP path traversal risk in BundleImportService #168
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: MEDIUM
Location
lib/Service/BundleImportService.php:325Description
When extracting ZIP files,
$zip->getNameIndex($i)returns the filename as stored in the ZIP, which could contain path traversal sequences (e.g.,../../etc/passwd). Whilebasename()is used to strip directories (line 335), thebasename()call happens after the hidden file checks but the content is read from the original index, not the basename. The actual risk is low because the content is only used as CSV data, not written to disk.Recommendation
Add explicit path traversal validation: reject entries containing
..or absolute paths.