/

CVE-2026-33687

Severity:

HIGH RISK

(8.8)

Unrestricted File Upload in Sharp Laravel CMS

CVE-2026-33687

Analyzed

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Arbitrary File Upload with Potential Remote Code Execution

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

Sharp's file upload endpoint in vulnerable versions allows authenticated users to override server-side validation by supplying their own validation_rule parameter, effectively disabling MIME type and extension checks.

When combined with a publicly accessible storage disk, this can enable arbitrary file uploads, including executable PHP files, which may lead to remote code execution or content tampering.

Affected context

This vulnerability appears in Sharp deployments using versions prior to 9.20.0 where:

  • The ApiFormUploadController endpoint is exposed to authenticated users
  • Client-supplied validation_rule parameters are accepted and passed into Laravel's validator
  • Uploaded files are stored on a disk that may be publicly accessible (e.g., web-root–served or CDN-exposed)

Under default private-disk configurations, uploaded PHP files typically cannot be executed directly, but the upload of unsafe file types is still possible.

Exploit preconditions

  • Attack surface: HTTP(S) file upload endpoint handled by ApiFormUploadController
  • Required access: Authenticated access to any Sharp form or feature that uses the upload API
  • Trigger point: Intercepting and modifying the upload request to include validation_rule[]=file or similar client-controlled rules
  • Why exploitation is possible: The server trusts client-controlled validation rules and passes them directly into Laravel's validator, allowing attackers to weaken or remove file-type restrictions and bypass MIME/extension checks.

Why this happens

The core issue is trusting client-controlled validation metadata for security-critical checks.

Instead of defining upload constraints exclusively on the server, the endpoint accepts a validation_rule parameter from the client and feeds it directly into Laravel's validation layer.

This design effectively delegates security policy to the requester, enabling them to choose permissive rules like file that bypass MIME type and extension restrictions.

This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, where an application accepts file uploads without enforcing robust, server-side validation of file content and type.

Potential impact

  • Upload of arbitrary file types, including PHP, shell scripts, or other executable formats
  • Potential remote code execution if uploaded executable files are placed on a publicly served, interpreter-enabled disk
  • Hosting of malicious content (e.g., malware, phishing pages, defacement content) on the affected site or storage
  • Abuse of storage for data exfiltration or staging of further attacks
  • Circumvention of organizational file-type policies and content controls

General mitigation guidance

Effective mitigation focuses on enforcing upload security policies exclusively on the server and isolating uploaded content:

  • Define strict, whitelisted validation rules server-side for each upload endpoint (e.g., allowed MIME types, extensions, and size limits) and ignore any client-supplied validation hints.
  • Treat all client-provided validation or configuration parameters as untrusted and purely advisory, never as authoritative for security decisions.
  • Store uploaded files on private or non-executable storage locations that are not directly served by the web server or interpreter.
  • Separate upload storage from application code directories and disable script execution in upload paths.
  • Apply least-privilege access controls so that uploaded content requires explicit, controlled mechanisms to be accessed or transformed.
  • Where feasible, add secondary checks such as content-type sniffing, magic-byte inspection, or transformation (e.g., re-encoding images) to reduce the risk of disguised file types.

How teams detect issues like this

Organizations can detect and monitor for this class of issue through:

  • Static analysis: Rules that flag use of client-controlled input (e.g., request parameters) being passed into validation or policy APIs without sanitization, especially around upload logic.
  • Code review signals: Upload endpoints where validation rules are constructed from user input, or where server-side whitelists are absent or optional.
  • Configuration and policy checks: Automated reviews of storage configuration to ensure upload disks are private, non-executable, and not mapped under the web root.
  • Runtime monitoring: Logging and alerting on unusual file upload patterns, such as executable extensions, overly large files, or uploads from unusual accounts or IP ranges.
  • Security testing: Regular API-focused penetration tests and fuzzing of upload endpoints, including manipulation of hidden parameters and client-side validation artifacts.

Sources

SourceLink
github.comgithub.com/code16/sharp/pull/714
github.comgithub.com/code16/sharp/releases/tag/v9.20.0
github.comgithub.com/code16/sharp/security/advisories/GHSA-fr76-5637-w3g9
laravel.comlaravel.com/docs/13.x/filesystem

Frequently asked

questions

Yes, if the Sharp admin or content interface is exposed over the internet and an attacker can obtain authenticated access, they can exploit the upload endpoint remotely by modifying requests to bypass file type restrictions.

Not necessarily. The vulnerability affects any authenticated user who can reach the vulnerable upload endpoint. The exact role required depends on how Sharp is configured and which users are allowed to upload files.

The safest approach is to define all upload validation rules strictly on the server and ignore any client-supplied validation parameters. Additionally, store uploaded files on non-executable, private storage that is not directly web-accessible, and serve files through controlled download mechanisms.

Avoid trusting client-controlled data for security decisions, especially for validation rules and access control.

Adopt a server-side whitelist strategy for file uploads, enforce separation between code and content storage, disable execution in upload directories, and include upload logic as a specific focus area in code reviews and automated security testing.

Find out what's already
exploitable in your codebase.