CVE-2024-21547: Spatie/browsershot Path Traversal Vulnerability
HIGHCVE-2024-21547 is a HIGH (CVSS 7.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Spatie/browsershot libraries in the Packagist ecosystem. The issue involves spatie browsershot directory traversal vulnerability. Remediation is available by upgrading affected packages to version 5.0.2.
CVE-2024-21547 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2024-21547
To remediate this vulnerability, upgrade all affected Spatie/browsershot dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade spatie/browsershot to 5.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for spatie/browsershot
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-21547, inspect your project dependencies for Spatie/browsershot:
inspect dependencies for spatie/browsershot
Analyze the terminal output to locate any version of Spatie/browsershot in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Spatie/browsershot, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-21547 Affected Spatie/browsershot Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
spatie/browsershot
|
Packagist |
< 5.0.2
|
5.0.2
|
References
Frequently Asked Questions
What is CVE-2024-21547?
Which Spatie/browsershot versions are affected?
What version fixes CVE-2024-21547?
Is spatie/browsershot affected?
What is the CVSS score of CVE-2024-21547?
What CWE is associated with CVE-2024-21547?
How can I check Packagist dependencies for CVE-2024-21547?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v528-6rq9-h6gw",
"modified" : "2024-12-18T15:48:22Z",
"published" : "2024-12-18T06:30:49Z",
"aliases" : [ "CVE-2024-21547" ],
"summary" : "Spatie Browsershot Directory Traversal vulnerability",
"details" : "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 /.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "spatie/browsershot"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21547"
}, {
"type" : "WEB",
"url" : "https://github.com/spatie/browsershot/commit/dfc3635b83dd980e5c39f8f8c73e87723b99ca01"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/chuajianshen/baa71db588cfc038fb5d65624a47be81"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/spatie/browsershot"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-PHP-SPATIEBROWSERSHOT-8501858"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-18T15:48:22Z",
"nvd_published_at" : "2024-12-18T06:15:23Z"
}
}