Unrestricted Upload of File with Dangerous Type in unisharp/laravel-filemanager
This affects the package unisharp/laravel-filemanager prior to version 2.6.2. The upload() function does not sufficiently validate the file type when uploading. An attacker may be able to reproduce the following steps: - Install a package with a web Laravel application. - Navigate to the Upload window - Upload an imag…
As published by the sources
Affected packages
- Affected
<2.6.2Fixed in2.6.2
Derived from the fixed versions above
What to do
Upgrade unisharp/laravel-filemanager to 2.6.2 or later.
composer update unisharp/laravel-filemanager --with-dependencies
To see which version you have installed, run composer show vendor/package. Running composer audit lists the known advisories that match your installed versions.
Quoted from the original advisory
Details
This affects the package unisharp/laravel-filemanager prior to version 2.6.2. The upload() function does not sufficiently validate the file type when uploading.
An attacker may be able to reproduce the following steps:
- Install a package with a web Laravel application.
- Navigate to the Upload window
- Upload an image file, then capture the request
- Edit the request contents with a malicious file (webshell)
- Enter the path of file uploaded on URL
- Remote Code Execution
**Note: Prevention for bad extensions can be done by using a whitelist in the config file(lfm.php). Corresponding document can be found in the here.
References
- Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2021-23814
- Webhttps://github.com/UniSharp/laravel-filemanager/issues/1113#issuecomment-1812092975
- Webhttps://github.com/UniSharp/laravel-filemanager/commit/bd84899ce65a7f193e676dd8444e424fa50f64fa
- Packagehttps://github.com/UniSharp/laravel-filemanager
- Webhttps://github.com/UniSharp/laravel-filemanager/blob/master/src/Controllers/UploadController.php#L26
- Webhttps://github.com/UniSharp/laravel-filemanager/blob/master/src/Controllers/UploadController.php%23L26
- Webhttps://snyk.io/vuln/SNYK-PHP-UNISHARPLARAVELFILEMANAGER-1567199