Summary
UniSharp Laravel File Manager v2.0.0-alpha7 and v2.0 contain an arbitrary file upload vulnerability that allows authenticated users to upload executable files via the upload endpoint.
By sending crafted multipart form data and abusing the type=Files parameter, an attacker can upload PHP code and then invoke it via the working directory path, leading to remote code execution on the server.
Affected context
This vulnerability appears in Laravel applications that embed UniSharp Laravel File Manager v2.0.0-alpha7 or v2.0 and expose its upload functionality to authenticated users.
The issue is relevant where:
- The file manager's upload endpoint is reachable from user-controllable contexts (e.g., admin panels, media managers, or embedded editors).
- Server-side validation of file type and content is weak or relies primarily on client-provided parameters, such as the
typefield. - Uploaded files are stored in a web-accessible directory where PHP or other scripts can be executed by the web server.
Exploit preconditions
- Attack surface: HTTP(S) upload endpoint provided by UniSharp Laravel File Manager.
- Required access: Valid authenticated session with permissions to access the file upload feature.
- Trigger point: Submission of crafted multipart/form-data to the upload route, setting
type=Files(or similar) to bypass intended media-type restrictions. - Why exploitation is possible: The server-side logic trusts the
typeparameter and performs insufficient validation on uploaded content and extensions, allowing executable PHP files to be stored in a directory that is executed by the PHP runtime when accessed via HTTP.
Why this happens
The underlying issue aligns with CWE-434: Unrestricted Upload of File with Dangerous Type.
The upload handler allows users to upload files with minimal server-controlled restrictions, relying on weak checks such as the type parameter and potentially superficial validation (e.g., extension or MIME checks that can be spoofed).
Because the application stores uploads under a web-accessible path where PHP execution is enabled, an attacker can upload a script file and later call it via the web server, effectively turning an upload feature into a code deployment and execution mechanism.
Potential impact
- Remote execution of arbitrary PHP code on the application server.
- Full compromise of the Laravel application, including reading or modifying application configuration and data.
- Pivoting to the underlying operating system to install backdoors or conduct lateral movement.
- Tampering with stored files, defacing hosted content, or exfiltrating sensitive assets.
- Using the compromised server as a platform for further attacks or malware distribution.
General mitigation guidance
Effective mitigation centers on strictly controlling what can be uploaded and how uploads are stored and served:
- Enforce an allowlist of safe file types on the server side (e.g., specific image formats) and validate by extension, MIME type, and, where feasible, file signatures.
- Reject any file that could be interpreted as executable by the web server, including PHP, CGI, script files, and combinations like polyglots.
- Store uploaded files outside of web-executable directories, and serve them via controlled download endpoints rather than direct filesystem paths.
- Disable script execution in upload directories at the web server level (e.g., specific vhost or directory configuration).
- Apply least-privilege filesystem permissions so that the application can write uploads but not modify critical code paths or configuration files.
- Treat all configurable parameters (such as
type) as untrusted hints, not authoritative indicators of safety.
How teams detect issues like this
Detection often involves combining code-level analysis with runtime monitoring:
- Static analysis and code review:
- Look for upload handlers that accept arbitrary file extensions or rely on client-provided parameters (like
type) for validation. - Identify storage paths that are directly web-accessible and mapped to script-executing directories.
- Flag any logic that lacks server-side allowlisted type checks or content inspection before saving files.
- Configuration and policy checks:
- Periodically scan webroot directories for unexpected script files under upload paths.
- Enforce infrastructure policies that forbid script execution in upload directories.
- Runtime monitoring:
- Monitor logs for direct HTTP requests to uploaded files with executable extensions.
- Use WAF or application firewalls to identify suspicious upload patterns, such as uploads of PHP files where only images are expected.
Automated SAST/DAST tools and CI-integrated security checks can help catch these patterns early, but should be supplemented with targeted manual review of file upload components.

