Published Date: December 18, 2024
Package | Affected Versions | Patched Versions | Severity |
---|---|---|---|
📦 spatie/browsershot (Composer) | < 5.0.2 | 5.0.2 | High |
Description
Overview
A high-severity vulnerability has been identified in the
spatie/browsershot
package, specifically in versions prior to 5.0.2
. This issue was reviewed and published to the GitHub Advisory Database 11 hours ago, with an update occurring just one hour ago. The vulnerability allows attackers to exploit improper handling of file paths, enabling unauthorized file access.Affected Package
- Package Name:
spatie/browsershot
- Package Manager: Composer
- Affected Versions:
< 5.0.2
- Patched Version:
5.0.2
Vulnerability Details
The issue lies in how
spatie/browsershot
handles URI normalization in the browser. Specifically, the vulnerability arises from the ability to bypass the file://
URI scheme check using malformed paths like file:\
. This normalization translates \
into /
, which effectively circumvents security mechanisms.As a result, an attacker could use this flaw to read arbitrary files on the server. For example, they might access sensitive configuration files, private keys, or user data stored outside the intended application directories.
Severity
Given the potential for unauthorized access to server files, this vulnerability is classified as high severity.
Patches & Workarounds
Mitigation
To address this issue, users of
spatie/browsershot
should upgrade to version 5.0.2
immediately. This patched version ensures proper handling of URI normalization and prevents the bypass exploit.Steps to Upgrade:
- Open your project’s root directory.
- Run the following Composer command to update the package:
composer require spatie/browsershot:^5.0.2
3. Test your application to ensure compatibility with the updated package version.
Recommendations
- If you cannot upgrade immediately, restrict access to sensitive server files as a temporary mitigation.
- Regularly review and monitor package updates and security advisories to catch vulnerabilities early.
- Consider implementing additional input validation or logging mechanisms to detect and prevent unauthorized file access attempts.