Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
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 applicationsUpgrade phenx/php-svg-lib
to version 0.5.1 or higher.
phenx/php-svg-lib is a library to read, parse and export to PDF SVG files.
Affected versions of this package are vulnerable to External Control of System or Configuration Setting due to improper sanitization of the href
attribute from the <use>
tag when it is merged with an <image>
tag. An attacker can cause an unsafe file read that may lead to PHAR Deserialization vulnerability in PHP versions prior to 8 by manipulating the href
attribute.
Systems utilizing php-svg-lib can implement input validation using logic similar to the following:
$parser = xml_parser_create("utf-8"); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler( $parser, function ($parser, $name, $attributes) { if (strtolower($name) === "image" || strtolower($name) === "use") { $attributes = array_change_key_case($attributes, CASE_LOWER); $urls = []; $urls[] = $attributes["xlink:href"] ?? ""; $urls[] = $attributes["href"] ?? ""; foreach ($urls as $url) { if (!empty($url)) { // perform validation here } } }
// include other tag/attribute validation }, false
);
if (($fp = fopen($url, "r")) !== false) { while ($line = fread($fp, 8192)) { xml_parse($parser, $line, false); } fclose($fp); xml_parse($parser, "", true); } xml_parser_free($parser);
<svg width="200" height="200"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image id="phar:///poc.phar" xlink:href="file:///existing/safe/image.png" />
<use href="phar:///poc.phar" width="500" height="500"/>
</svg>