pontedilana/php-weasyprint

CVE-2026-49358

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.

Key facts
CVSS score
3.0
Low
Attack vector
Local
Issuing authority
GitHub Advisory Database
Affected package
pontedilana/php-weasyprint
Fixed in
2.6.0
Disclosed
2026

Summary

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.

Impact

Severity and exposure

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.

Affected versions

composer

  • pontedilana/php-weasyprint (<= 2.5.1)

Security releases

  • pontedilana/php-weasyprint → 2.6.0 (composer)
Kodem intelligence

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

Remediation advice

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.

Frequently asked questions about CVE-2026-49358

What is CVE-2026-49358?

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.

How severe is CVE-2026-49358?

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.

Which versions of pontedilana/php-weasyprint are affected by CVE-2026-49358?

pontedilana/php-weasyprint (composer) versions <= 2.5.1 is affected.

Is there a fix for CVE-2026-49358?

Yes. CVE-2026-49358 is fixed in 2.6.0. Upgrade to this version or later.

Is CVE-2026-49358 exploitable, and should I be worried?

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

What actually determines whether CVE-2026-49358 is exploitable, and how bad it is?

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.

How do I fix CVE-2026-49358?

Upgrade pontedilana/php-weasyprint to 2.6.0 or later.

Stop the waste.
Protect your environment with Kodem.