Skip to main content

PhpWeasyPrint CVE-2026-49358

| EUVDEUVD-2026-38036 LOW
External Control of File Name or Path (CWE-73)
2026-06-19 GitHub_M GHSA-5g9f-cwwg-4p8g
3.0
CVSS 3.1 · Vendor: GitHub_M

Severity by source

Vendor (GitHub_M) PRIMARY
3.0 LOW
AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:L/A:L
vuln.today AI
3.0 LOW

Local code access and high privilege (PR:H) required to reference the generator instance; no confidentiality impact; limited integrity and availability from file deletion only.

3.1 AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:L/A:L
4.0 AV:L/AC:H/AT:P/PR:H/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:L/A:L
Attack Vector
Local
Attack Complexity
High
Privileges Required
High
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

Lifecycle Timeline

3
Patch available
Jun 19, 2026 - 16:01 EUVD
Source Code Evidence Fetched
Jun 19, 2026 - 15:32 vuln.today
Analysis Generated
Jun 19, 2026 - 15:32 vuln.today

DescriptionCVE.org

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.

AnalysisAI

Arbitrary file deletion in PhpWeasyPrint prior to version 2.6.0 allows any code holding a reference to a generator instance to inject arbitrary filesystem paths into the public AbstractGenerator::$temporaryFiles array, which are then passed to unlink() without path-containment validation during script shutdown or object destruction. The vulnerability mirrors a previously disclosed pattern in the related KnpLabs/snappy library (GHSA-87qc-37cw-84h4), and is exploitable by malicious dependencies, plugin code, or any PHP code co-located in the same process with access to the generator object. No public exploit has been identified at time of analysis, and exploitation is substantially constrained by the requirement for high privileges and local code access.

Technical ContextAI

PhpWeasyPrint (cpe:2.3:a:pontedilana:php-weasyprint:*:*:*:*:*:*:*:*) is a PHP wrapper around the WeasyPrint binary used to render PDFs from HTML or URLs. The root cause is CWE-73 (External Control of File Name or Path): the $temporaryFiles property is declared public, and the cleanup routine removeTemporaryFiles() - invoked both from __destruct() and a registered PHP shutdown function - iterates the array and calls unlink() on each entry without first resolving the real path and confirming it resides within the designated temporary directory. PHP's realpath() is the standard mitigation, and the patch in commit 6d328ffd confirms this: it resolves the temporary folder via realpath(), strips trailing separators, and uses strncmp() to enforce a prefix check before any unlink() call is made. The shutdown-function registration means the attack window extends to the full PHP process lifetime, not just object scope.

RemediationAI

The primary fix is to upgrade pontedilana/php-weasyprint to version 2.6.0, which introduces path-containment validation in removeTemporaryFiles() via realpath() and strncmp() prefix enforcement. The patch commit is available at https://github.com/pontedilana/php-weasyprint/commit/6d328ffd3bcb800c7c2e8a594b1bff0c099c9391 and the release at https://github.com/pontedilana/php-weasyprint/releases/tag/2.6.0. If immediate upgrade is not feasible, a compensating control is to audit all Composer dependencies for code that accesses generator instances directly and restrict the visibility surface by wrapping generator usage in a factory pattern that prevents external reference acquisition. Note that changing $temporaryFiles visibility in application code without patching the library does not prevent exploitation by third-party packages that access the property via reflection. There are no known configuration-level workarounds that eliminate the risk without upgrading.

More in PHP

View all
CVE-2012-1823 CRITICAL POC
9.8 May 11

sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not

CVE-2016-1555 CRITICAL POC
9.8 Apr 21

(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear

CVE-2018-11138 CRITICAL POC
9.8 May 31

The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by

CVE-2024-11680 CRITICAL POC
9.8 Nov 26

ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C

CVE-2025-49113 CRITICAL POC
9.9 Jun 02

Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au

CVE-2017-9841 CRITICAL POC
9.8 Jun 27

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c

CVE-2025-0108 HIGH POC
8.8 Feb 12

Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers

CVE-2021-25298 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2021-25296 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2013-4983 CRITICAL POC
10.0 Sep 10

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows

CVE-2023-6553 CRITICAL POC
9.8 Dec 15

The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1

CVE-2024-46506 CRITICAL POC
10.0 May 13

NetAlertX (formerly PiAlert) versions 23.01.14 through 24.x before 24.10.12 allow unauthenticated command injection thro

Share

CVE-2026-49358 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy