CVE-2026-49358 Details
Description
PhpWeasyPrint is a PHP library allowing PDF generation from a URL or an HTML page. Prior to version 2.6.0, `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. PhpWeasyPrint version 2.6.0 contains a patch for the issue.
A vulnerability in PhpWeasyPrint versions prior to 2.6.0 allows for arbitrary file deletion. The issue arises because the `temporaryFiles` property in the `AbstractGenerator` class is public, enabling any code with a reference to a generator instance to inject paths that are then deleted during the script's shutdown process. The `removeTemporaryFiles()` method, called from the destructor and a registered shutdown function, lacks a proper path verification, leading to potential misuse. This vulnerability mirrors a similar issue in the KnpLabs/snappy library, which has been addressed in their version 1.7.2.
Users can update to PhpWeasyPrint version 2.6.0 or later, where this vulnerability has been patched. The update can be obtained through Composer.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
Volerion
Assessed Jun 19, 2026CISA-ADP
Assessed Jun 23, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/pontedilana/php-weasyprint/security/advisories/GHSA-5g9f-cwwg-4p8g | CISA-ADP | AdvisoryExploitRemedyVendor |
| https://github.com/KnpLabs/snappy/security/advisories/GHSA-87qc-37cw-84h4 | [email protected] | AdvisoryNot Applicable |
| https://github.com/pontedilana/php-weasyprint/commit/6d328ffd3bcb800c7c2e8a594b1bff0c099c9391 | [email protected] | Source CodeVendor |
| https://github.com/pontedilana/php-weasyprint/releases/tag/2.6.0 | [email protected] | Release NotesVendor |
| https://github.com/pontedilana/php-weasyprint/security/advisories/GHSA-5g9f-cwwg-4p8g | [email protected] | AdvisoryExploitRemedyVendor |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-73 | External Control of File Name or Path | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| Pontedilana PhpWeasyPrint | <= 2.5.1 (semver) |
CPE
Remediation
| |
Change History
2 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 23, 2026 | CVE Modified | CISA-ADP |
| Jun 19, 2026 | New CVE Received | [email protected] |
Volerion