Published Date: December 20, 2024
Package | Affected Versions | Patched Versions | Severity |
---|---|---|---|
📦 spatie/browsershot (Composer) | < 5.0.3 | 5.0.3 | High |
Description
spatie/browsershot
package prior to 5.0.3. The vulnerability arises from inadequate validation of URLs passed to the setUrl
method.What’s the problem?
Attackers can exploit this flaw by passing URLs like
view-source:file://
. This sneaky trick can let them read arbitrary local files on the server, potentially exposing sensitive data.Who’s affected?
If you’re using a version of
spatie/browsershot
earlier than 5.0.3, your system is at risk. This is particularly concerning if your application processes user-supplied input for generating screenshots or PDFs.Patches & Workarounds
- Upgrade the package: Update
spatie/browsershot
to version 5.0.3 or later. Run the following command in your project:
- Sanitize inputs: If updating isn’t immediately possible, ensure that any input passed to
setUrl
is rigorously sanitized to block URLs with schemes likeview-source
orfile
. - Test your application: After upgrading or patching, test your application to ensure functionality remains intact and the vulnerability is closed.