External Control of File Name or Path Affecting phenx/php-svg-lib package, versions <0.5.2


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th percentile)

Do your applications use this vulnerable package?

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 applications
  • Snyk IDSNYK-PHP-PHENXPHPSVGLIB-6262046
  • published23 Feb 2024
  • disclosed21 Feb 2024
  • creditUnknown

Introduced: 21 Feb 2024

CVE-2024-25117  (opens in a new tab)
CWE-73  (opens in a new tab)

How to fix?

Upgrade phenx/php-svg-lib to version 0.5.2 or higher.

Overview

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 File Name or Path due to insufficient validation of the font-family attribute in SVG inline styles. Specifically, the library does not adequately verify that the font-family does not contain a PHAR URL. Additionally, the library fails to check if external references are permitted, which could lead to the bypass of restrictions or remote code execution in projects utilizing this library, should they not rigorously revalidate the fontName passed by the library.

PoC

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
    <text x="20" y="35" style="color:red;font-family:phar:///path/to/whatever.phar/blaklis;">My</text>
</svg>

CVSS Scores

version 3.1