The vulnerability exists within the laravel/framework package, specifically in the LocalFilesystemAdapter. The root cause is the improper handling of file paths when generating temporary signed URLs for the local storage driver. The functions temporaryUrl and temporaryUploadUrl constructed these URLs by placing the raw file path directly into a URL's path segment. They failed to encode special characters that have reserved meanings in a URI, such as '?', '#', and '&'.
An attacker could exploit this by crafting a file path containing these characters. When the application generated a signed URL with this malicious path, the resulting URL would be ambiguous. A web server parsing this URL could interpret the special characters as delimiters for the query string or fragment identifier, rather than as part of the file path. This confusion leads to two primary impacts:
- Bypassing Expiration: The
expires parameter, which should be a top-level query parameter for validation, could be hidden within the file path portion of the URL, causing the expiration check to be ignored and allowing the URL to be used indefinitely.
- Resource Misrouting: The server might resolve the request to a different, unintended resource, as the parsed path would be different from the one that was originally signed.
The patch for this vulnerability, seen in commit cba82e4ee16b6cf88c03759e16eb8843316a6b54 and its follow-ups, addresses the issue by applying rawurlencode() to the path before it's included in the signed route. This ensures that any special characters in the path are properly encoded and treated as part of the path, preventing the URL parsing confusion.