CVE-2025-1022 Browsershot Path Traversal
Attackers can read arbitrary local files by bypassing input validation in the setHtml function of the spatie/browsershot library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-1022?
CVE-2025-1022 is a high-severity path traversal vulnerability in spatie/browsershot, published on 5 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Versions of the package spatie/browsershot before 5.0.5 are vulnerable to Improper Input Validation in the setHtml function, invoked by Browsershot::html(), which can be bypassed by omitting the slashes in the file URI (e.g., file:../../../../etc/passwd). This is due to missing validations of the user input that should be blocking file URI schemes (e.g., file:// and file:/) in the HTML content. **Note:** Further analysis has identified additional proof-of-concept exploits leveraging the vulnerable function. Developers using this package should ensure proper input validation to mitigate potential risks, as the issue remains unaddressed.
Weakness: CWE-20
Which versions are affected by CVE-2025-1022?
2 open source packages ship an affected version, including spatie/browsershot.
| Package | Affected | Fixed in |
|---|---|---|
spatie/browsershot Packagist | All versions | 5.0.5 |
spatie/browsershot Packagist | All versions | 5.0.5 |
How do I fix CVE-2025-1022?
Upgrade spatie/browsershot to 5.0.5 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2025-1022 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-1022 exists.
Sources
Also known as GHSA-j2gw-r24m-j2qw.