High severity8.6OSV Advisory· Published Feb 5, 2025· Updated Apr 29, 2026
CVE-2025-1026
CVE-2025-1026
Description
Versions of the package spatie/browsershot before 5.0.5 are vulnerable to Improper Input Validation due to improper URL validation through the setUrl method, which results in a Local File Inclusion allowing the attacker to read sensitive files. Note: This is a bypass of the fix for CVE-2024-21549.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
spatie/browsershotPackagist | < 5.0.5 | 5.0.5 |
Affected products
1- Range: 0.1.0, 0.1.1, 0.1.2, …
Patches
2e32739745068validate url
3 files changed · +16 −1
src/Browsershot.php+5 −1 modified@@ -69,7 +69,7 @@ class Browsershot protected ImageManipulations $imageManipulations; protected array $unsafeProtocols = [ - 'file:,', + 'file:', 'file:/', 'file://', 'file:\\', @@ -268,6 +268,10 @@ public function setUrl(string $url): static { $url = trim($url); + if (filter_var($url, FILTER_VALIDATE_URL) === false ){ + throw FileUrlNotAllowed::urlCannotBeParsed($url); + } + foreach ($this->unsafeProtocols as $unsupportedProtocol) { if (str_starts_with(strtolower($url), $unsupportedProtocol)) { throw FileUrlNotAllowed::make();
src/Exceptions/FileUrlNotAllowed.php+5 −0 modified@@ -10,4 +10,9 @@ public static function make(): static { return new static('An URL is not allow to start with file:// or file:/'); } + + public static function urlCannotBeParsed(string $url): static + { + return new static("The given URL `{$url}` is not a valid URL"); + } }
tests/BrowsershotTest.php+6 −0 modified@@ -59,11 +59,17 @@ 'File://test', 'file:/test', 'file:\test', + 'file:', 'file:\\test', 'view-source', 'View-Source', ]); +it('will not allow a malformed file url with too many slashes', function () { + Browsershot::url('fil + e:///test'); +})->throws(FileUrlNotAllowed::class); + it('will not allow a file url that has leading spaces', function () { Browsershot::url(' file://test'); })->throws(FileUrlNotAllowed::class);
c0fa14c2386dVulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- github.com/advisories/GHSA-f2q5-6mx7-q9qqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-1026ghsaADVISORY
- gist.github.com/chuajianshen/6291920112fcf1543fa7b43862112be6nvdWEB
- gist.github.com/mrdgef/54a8783408220c67c1b859df38a52d65nvdWEB
- github.com/spatie/browsershot/commit/e3273974506865a24fbb5b65b534d8d4b8dfbf72nvdWEB
- github.com/spatie/browsershot/pull/908nvdWEB
- security.snyk.io/vuln/SNYK-PHP-SPATIEBROWSERSHOT-8533024nvdWEB
News mentions
0No linked articles in our index yet.