Summary
Sharp's generic download endpoint authorizes the requesting user only against a referenced Sharp entity, but then allows the storage disk and path to be supplied directly via request parameters.
Under these conditions, an authenticated user who can view one valid record may download other unrelated files from configured Laravel Storage disks, leading to unauthorized data disclosure.
Affected context
This vulnerability appears in Laravel applications that embed the Sharp content management framework and expose its generic download endpoint.
It is relevant when:
- Sharp entities provide downloadable assets or attachments
- The download route is protected only by entity-level access checks
- The underlying storage disk name and file path can be influenced by request parameters
The weakness is constrained to the roots of configured Laravel Storage disks and does not, by itself, provide arbitrary host filesystem access.
Exploit preconditions
- Attack surface: HTTP(S) interface of a Laravel application using Sharp's generic download endpoint
- Required access: Valid authenticated Sharp user account with permission to view at least one entity instance that exposes the download route
- Trigger point: Crafted download requests that reference a legitimate entity instance for authorization while specifying arbitrary disk and path parameters pointing to other stored objects
- Why exploitation is possible: The authorization logic is coupled only to the entity instance, but the file retrieval logic trusts caller-controlled disk/path parameters that are not bound or constrained to the authorized entity's actual storage object
Why this happens
The core issue is an authorization mismatch between the object being authorized and the object ultimately accessed.
The endpoint verifies that the user can access a specific Sharp entity instance but then reads the file disk and path directly from request parameters, without enforcing that the retrieved file belongs to that entity.
This aligns with CWE-639: Insecure Direct Object Reference (IDOR), where user-controllable identifiers (in this case, disk and path) are not properly constrained, enabling access to additional objects that pass through the same endpoint.
Potential impact
- Authenticated users may download files associated with other entities they are not authorized to view
- Sensitive business documents, exports, or media stored on configured Laravel Storage disks could be exposed
- Leakage of configuration-like artifacts, logs, or internal reference data stored within those disks
- Expansion of an attacker's knowledge of internal object structure and storage layout, aiding further attacks
General mitigation guidance
Effective mitigation focuses on strictly binding file access to the object that was actually authorized.
Common defensive patterns include:
- Resolving storage disks and paths exclusively from server-side metadata associated with the authorized entity, ignoring client-supplied disk/path parameters
- Implementing per-entity or per-tenant scoping rules so that download endpoints can only serve files that belong to the authorized record
- Centralizing file-download logic behind a service that enforces consistent access control decisions and object binding
- Applying least-privilege design to storage layout, using separate disks or directories per context or role to compartmentalize potential exposure
- Avoiding generic "passthrough" endpoints that proxy arbitrary disk/path combinations without explicit, object-level permission checks
How teams detect issues like this
Detection can rely on both code-centric and behavior-centric approaches:
- Static analysis and code review:
- Flag endpoints that accept disk, path, or similar identifiers directly from user input and use them to read files
- Look for authorization checks that validate only an entity ID but then operate on separately provided resource identifiers
- Review any "generic download" or "file proxy" controllers for missing binding between authorized entities and retrieved files
- Runtime and log analysis:
- Monitor download requests for patterns where a single authenticated user accesses many distinct paths or unexpected directories
- Correlate entity IDs used for authorization with the resolved storage paths to spot mismatched object access
- Policy and tooling:
- Enforce secure controller patterns via internal guidelines and automated pull request checks
- Use application security testing tools that simulate IDOR-style manipulation of file-related parameters

