CVE-2024-21547 Spatie Browsershot Directory Traversal vulnerability
An attacker can read arbitrary files on the server by bypassing file:// checks via URI normalization in 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-2024-21547?
CVE-2024-21547 is a high-severity path traversal vulnerability in spatie/browsershot, published on 18 Dec 2024. 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.2 are vulnerable to Directory Traversal due to URI normalisation in the browser where the file:// check can be bypassed with file:\\. An attacker could read any file on the server by exploiting the normalization of \ into /.
Weakness: CWE-22
Which versions are affected by CVE-2024-21547?
2 open source packages ship an affected version, including spatie/browsershot.
| Package | Affected | Fixed in |
|---|---|---|
spatie/browsershot Packagist | All versions | 5.0.2 |
spatie/browsershot Packagist | All versions | 5.0.2 |
How do I fix CVE-2024-21547?
Upgrade spatie/browsershot to 5.0.2 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-21547 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21547 exists.
Sources
Also known as GHSA-v528-6rq9-h6gw.