The vulnerability exists within the unzip functionality of the alexusmai/laravel-file-manager package, specifically in the src/Services/Zip.php file. The analysis of this file reveals that the extractArchive method is responsible for extracting zip files. This method uses PHP's built-in ZipArchive::extractTo function to unpack the archive. However, it fails to sanitize the filenames contained within the zip file before extraction. This allows an attacker to craft a malicious zip archive containing path traversal sequences (e.g., ../../evil.php). When the application processes this archive, the extractTo function will write the malicious file to a location outside of the intended extraction directory, based on the traversal path. This can lead to arbitrary file writes and potentially remote code execution if a web-accessible directory is targeted. The extract method is the public-facing function in the Zip service that calls the vulnerable extractArchive method, making it a critical part of the call stack during exploitation.
Alexusmai\LaravelFileManager\Services\Zip::extractArchivesrc/Services/Zip.php
Alexusmai\LaravelFileManager\Services\Zip::extractsrc/Services/Zip.php
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| alexusmai/laravel-file-manager | composer | <= 3.3.1 |