CVE-2026-49358 is a low-severity security vulnerability in pontedilana/php-weasyprint (composer), affecting versions <= 2.5.1. It is fixed in 2.6.0.
Summary AbstractGenerator::$temporaryFiles is a public array, and removeTemporaryFiles(), invoked from _destruct() and from a registered shutdown function, calls unlink() on every entry without verifying that the path is contained within the temporary folder. Any code holding a reference to a generator instance can push an arbitrary path into the array and have it deleted on script shutdown. This mirrors the KnpLabs/snappy issue GHSA-87qc-37cw-84h4, patched in snappy 1.7.2. Affected versions pontedilana/php-weasyprint versions <= 2.5.1. Patched in: 2.6.0. Vulnerable code src/AbstractGenerator.php: No path-containment check: whatever path is present in $temporaryFiles at shutdown is unlinked. Proof of concept Impact Arbitrary file deletion bound to script shutdown, scoped to the privileges of the PHP process user. Not directly exploitable on its own (the attacker already needs to influence the property in the same request). The risk is amplification: chained with a separate disclosure bug it enables leak-then-delete-to-cover-tracks, and any deserialization/property-oriented gadget that reaches this property becomes a generic file-delete primitive. CWE-73 (External Control of File Name or Path). Suggested fix Only delete files that actually live inside the temporary folder, comparing canonical (realpath) paths: (The trailing directory separator prevents a sibling folder such as /tmpevil from matching /tmp; strncmp is used instead of strstarts_with to keep PHP 7.4 compatibility.) Credit Reported upstream to KnpLabs/snappy (GHSA-87qc-37cw-84h4); identified as applicable to pontedilana/php-weasyprint, which mirrors the same code.
CVE-2026-49358 has a CVSS score of 3.0 (Low). The vector is requires local access, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.
A fixed version is available (2.6.0). Upgrading removes the vulnerable code path.
composer
pontedilana/php-weasyprint (<= 2.5.1)pontedilana/php-weasyprint → 2.6.0 (composer)Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.
Kodem's runtime-powered SCA identifies whether CVE-2026-49358 is reachable in your applications. Explore open-source security for your team.
See if CVE-2026-49358 is reachable in your applications. Get a demo
Already deployed Kodem? See CVE-2026-49358 in your environment →Upgrade pontedilana/php-weasyprint to 2.6.0 or later to resolve this vulnerability.
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
CVE-2026-49358 is a low-severity security vulnerability in pontedilana/php-weasyprint (composer), affecting versions <= 2.5.1. It is fixed in 2.6.0.
CVE-2026-49358 has a CVSS score of 3.0 (Low). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
pontedilana/php-weasyprint (composer) versions <= 2.5.1 is affected.
Yes. CVE-2026-49358 is fixed in 2.6.0. Upgrade to this version or later.
Whether CVE-2026-49358 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
Upgrade pontedilana/php-weasyprint to 2.6.0 or later.