/

CVE-2025-14894

Severity:

CRITICAL RISK

(9.8)

Unrestricted File Upload in Livewire Filemanager for Laravel

CVE-2025-14894

Analyzed

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Livewire Filemanager, a component commonly integrated into Laravel applications, allows file uploads without adequate file type and MIME validation.

Under typical Laravel storage setup, an attacker can upload a malicious PHP file and then execute it via the public /storage/ URL, leading to remote code execution on the server.

Affected context

This vulnerability appears in Laravel applications that embed the Livewire Filemanager component and expose its upload functionality.

It becomes particularly dangerous when the standard Laravel storage symlink (e.g., php artisan storage:link) or equivalent configuration is in place, making files under storage web-accessible.

In such deployments, uploaded files may be placed into directories that the web server can execute as PHP, without being constrained to safe media types.

Exploit preconditions

  • Attack surface: HTTP(S) endpoint(s) providing file upload through Livewire Filemanager.
  • Required access: Ability to access the upload functionality; this might be unauthenticated or weakly protected depending on how the application integrates the component.
  • Trigger point: Submitting an upload request containing a crafted PHP file (e.g., disguised as an image or generic file) that the component accepts without rejecting by extension or MIME type.
  • Why exploitation is possible: The LivewireFilemanagerComponent.php does not enforce robust server-side file type and MIME validation, allowing untrusted input to be stored in executable locations under /storage/, which are then reachable via a publicly accessible URL when common Laravel storage configuration is applied.

Why this happens

The core bug is an unrestricted file upload pattern, where user-supplied files are accepted and stored without adequately constraining their type, extension, or execution properties.

LivewireFilemanagerComponent.php does not apply strict server-side checks (e.g., whitelisting of extensions and MIME types, blocking of executable formats, or safe storage locations) before persisting uploads.

This aligns with CWE-434: Unrestricted Upload of File with Dangerous Type, in which the application treats uploaded content as benign while placing it in a context where it can later be interpreted and executed by the server's runtime (in this case, PHP via the web server).

The absence of layered validation and safe storage semantics enables an attacker to transition from "file write" capability to full code execution.

Potential impact

  • Remote code execution on the application server via uploaded PHP files.
  • Full compromise of the underlying web application and its data.
  • Lateral movement within the hosting environment or network from the compromised server.
  • Installation of web shells, backdoors, or further malware.
  • Exfiltration or tampering of sensitive data stored by the Laravel application.
  • Use of the compromised server as a platform for further attacks (e.g., phishing, spam, or scanning).

General mitigation guidance

Mitigation generally focuses on strictly constraining what files can be uploaded and ensuring uploads are never treated as executable code.

Typical defensive patterns include:

  • Implementing a positive (whitelist) validation policy for file uploads, allowing only specific, non-executable extensions (e.g., .jpg, .png, .pdf) and enforcing consistent MIME type checks on the server side.
  • Storing uploaded files in non-executable directories or storage backends (e.g., object storage or directories not mapped to the web root or PHP engine) so that the web server cannot execute them as code.
  • Normalizing and sanitizing filenames, enforcing fixed extensions rather than trusting client-provided names, and stripping or rejecting potentially dangerous patterns (e.g., multiple extensions, null bytes).
  • Applying defense-in-depth at the web server and PHP configuration level (e.g., disabling PHP execution in upload directories) so that even if a script is uploaded, it cannot run.
  • Using framework-level abstractions for file handling that default to safer storage locations and avoid direct exposure of raw upload paths.

How teams detect issues like this

Effective detection relies on both code-centric and operational monitoring approaches:

  • Static code analysis looking for file upload handlers that:
  • Accept arbitrary file extensions.
  • Lack server-side MIME validation or rely solely on client-side checks.
  • Store uploads under paths that are web-accessible and potentially executable.
  • Security-focused code reviews that flag:
  • Direct use of upload APIs without surrounding validation.
  • Use of /storage or similar directories as public assets when they may receive user-controlled files.
  • Missing checks for disallowed extensions (e.g., .php, .php3, .phtml, .phar).
  • Runtime monitoring and logging for:
  • Requests to uploaded files with script extensions under /storage/ or equivalent public paths.
  • Anomalous PHP execution traces originating from upload directories.
  • Integration of automated security testing tools (e.g., SAST/DAST) in CI pipelines to identify unrestricted upload patterns and attempts to execute uploaded content.

Sources

SourceLink
github.comgithub.com/livewire-filemanager/filemanager
hackingbydoing.wixsite.comhackingbydoing.wixsite.com/hackingbydoing/post/unauthenticated-rce-in-livewire-filemanager
kb.cert.orgkb.cert.org/vuls/id/650657

Frequently asked

questions

Yes. If the upload feature is reachable over the network and not properly restricted, an attacker can exploit this issue remotely by uploading a malicious PHP file and then invoking it via the /storage/ URL.

The attacker needs the ability to reach and use the Livewire Filemanager upload endpoint. In some deployments this may be publicly accessible; in others it may require authentication, but weak authorization or shared accounts can still make exploitation feasible.

The safest approach is to enforce strict server-side whitelisting of allowed file types, store uploads only in non-executable locations, and configure the web server and PHP so that uploaded content cannot be executed as code under any circumstances.

Adopt a standard secure upload guideline: only allow explicitly approved file types, validate using server-side checks, isolate uploads from the execute path, and include upload handlers in regular security code reviews and automated static analysis policies.

Find out what's already
exploitable in your codebase.