/

CVE-2026-49972

Severity:

HIGH RISK

(8.8)

File Upload RCE (CWE-434) in Laravel-Mediable

CVE-2026-49972

Deferred

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution via uploaded files

Severity:

HIGH RISK

(8.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

Laravel-Mediable before 7.0.0 contains a file upload flaw that lets attackers upload double-extension files like shell.php.jpg which bypass validation checks.

On web servers misconfigured to execute any filename containing .php as PHP, these stored files can be interpreted as executable code, enabling remote code execution by unauthenticated users.

Affected context

This vulnerability arises in applications using Laravel-Mediable for handling media uploads, particularly where web servers (Apache or nginx) are configured to treat any path containing .php as executable PHP.

It is most relevant when:

  • The application allows anonymous or low-trust file uploads
  • MIME type, extension, and aggregate type validation rely primarily on the outer extension
  • Uploaded files are stored in web-accessible directories under the application's domain

Exploit preconditions

  • Attack surface: Public or internal file upload endpoints that rely on Laravel-Mediable prior to version 7.0.0.
  • Required access: Ability to submit file uploads (often unauthenticated or minimally authenticated).
  • Trigger point: Uploading a file with a double extension (e.g., shell.php.jpg) such that the inner .php is preserved in the stored filename.
  • Why exploitation is possible: PATHINFO-based filename extraction retains the inner .php segment, and on misconfigured servers that execute any file whose path contains .php, the stored file is treated as PHP code while passing normal validation rules based on the outer extension and MIME type.

Why this happens

The core bug is an unrestricted file upload pattern where validation focuses on the apparent file type rather than the actual execution behavior of the hosting environment.

Laravel-Mediable relies on PATHINFO filename extraction, which preserves inner extensions in double-extension names, and treats the outer extension and MIME type as authoritative for validation.

This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, because the system allows files that can be interpreted as executable code to be stored in locations where the web server may execute them, without fully accounting for server-side rules that trigger on embedded .php segments.

Potential impact

  • Remote execution of arbitrary PHP code on the application server
  • Complete compromise of the affected web application and its data
  • Lateral movement within the hosting environment or network
  • Defacement of sites or injection of malicious content
  • Installation of backdoors, web shells, or malware
  • Exfiltration or tampering with sensitive user data and credentials

General mitigation guidance

Effective mitigation typically involves constraining what can be uploaded and where it can be stored, while minimizing exposure to server-side execution rules.

Common defensive patterns include:

  • Ensuring uploaded content is stored outside web-accessible and executable directories, served via indirection or dedicated media handling.
  • Normalizing and regenerating filenames on upload, ignoring user-supplied names and stripping any embedded executable extensions or special characters.
  • Implementing strict allowlists for file types based on both MIME type and vetted extensions, combined with server-side verification of content when feasible.
  • Configuring the web server to avoid executing scripts purely based on partial matches in filenames (e.g., paths that merely contain .php), and limiting script execution to known, controlled directories.
  • Applying least-privilege principles to the application and file storage so that even if a file is misclassified, the execution context has minimal permissions.

How teams detect issues like this

High-level detection approaches include:

  • Static analysis and code review to identify upload flows that:
  • Trust user-supplied filenames or extensions
  • Store files directly under web-accessible paths
  • Rely solely on MIME or outer extension checks for validation
  • Security-focused review of Laravel-Mediable integration, ensuring filename normalization and storage paths are explicitly configured to avoid executable locations.
  • Logging and monitoring of file upload endpoints, including:
  • Alerts for uploads containing multiple dots or suspicious inner extensions like .php, .phtml, .phar, or similar.
  • Anomaly detection on requests to uploaded media paths that return executable responses (e.g., unexpected PHP execution).
  • Policy enforcement through CI/CD pipelines, where automated tools flag risky upload patterns and configuration files that enable broad script execution based on filename segments.

Sources

SourceLink
github.comgithub.com/plank/laravel-mediable/commit/49e3583bed13423611b3391f89e6b002571eed73
github.comgithub.com/plank/laravel-mediable/releases/tag/7.0.0
vulncheck.comvulncheck.com/advisories/laravel-mediable-file-upload-rce-via-extension-bypass

Frequently asked

questions

It is broadly exploitable wherever untrusted users can upload files and the application uses vulnerable Laravel-Mediable behavior combined with a web server that executes any file whose path contains .php. In such setups, exploitation can often be performed remotely and without authentication.

The attacker typically needs access only to a file upload endpoint, which may be publicly accessible. They do not need prior knowledge of the codebase, but they must be able to submit a crafted double-extension file (e.g., shell.php.jpg) that is accepted and stored by the application.

The safest fix pattern is to decouple uploads from executable paths by storing media outside web-executable directories, regenerate safe filenames rather than using user-supplied names, and enforce strict server-side allowlists for extensions. Additionally, adjust web server configuration so that script execution is restricted to specific, controlled locations rather than any file containing .php.

Preventing similar issues requires a combination of secure design and review: treat all uploaded content as untrusted, ensure that files cannot be executed from their storage paths, enforce conservative validation on file types and names, and include upload flows in threat modeling and security code review. Automated checks in CI/CD for risky upload patterns and misconfigured server rules can further reduce the likelihood of recurrence.

Find out what's already
exploitable in your codebase.