CVE-2026-49260: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in pontedilana php-weasyprint
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.
AI Analysis
Technical Summary
CVE-2026-49260 is an OS command injection vulnerability in pontedilana/php-weasyprint versions prior to 2.5.1. The library attempts to sanitize the WeasyPrint binary path by using escapeshellarg() and then verifying its executability with is_executable(). However, escapeshellarg() adds single quotes around the path, causing is_executable() to check a non-existent file with quotes in its name. This results in the safe code path never executing, and the raw binary path string is passed directly to Symfony\Component\Process\Process::fromShellCommandline(), which executes it in a shell context. If the binary path is sourced from configuration, environment variables, or tenant-specific settings, this leads to a shell command injection vulnerability. The issue was patched in version 2.5.1.
Potential Impact
An attacker with high privileges who can influence the binary path configuration can execute arbitrary shell commands on the host system. This can lead to complete compromise of confidentiality, integrity, and availability of the affected system. The vulnerability has a CVSS 3.1 score of 8.2 (high severity), reflecting its potential for significant impact. There are no known exploits in the wild at this time.
Mitigation Recommendations
Upgrade to php-weasyprint version 2.5.1 or later, which contains a patch for this vulnerability. Until upgraded, ensure that the binary path configuration cannot be influenced by untrusted sources. Patch status is not explicitly stated as 'official-fix' but the vendor has released version 2.5.1 containing the fix, so upgrading is the recommended remediation.
CVE-2026-49260: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in pontedilana php-weasyprint
Description
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.
CVSS v3.1
Score 8.2high
Affected software
pkg:composer/pontedilana/php-weasyprintRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-49260 is an OS command injection vulnerability in pontedilana/php-weasyprint versions prior to 2.5.1. The library attempts to sanitize the WeasyPrint binary path by using escapeshellarg() and then verifying its executability with is_executable(). However, escapeshellarg() adds single quotes around the path, causing is_executable() to check a non-existent file with quotes in its name. This results in the safe code path never executing, and the raw binary path string is passed directly to Symfony\Component\Process\Process::fromShellCommandline(), which executes it in a shell context. If the binary path is sourced from configuration, environment variables, or tenant-specific settings, this leads to a shell command injection vulnerability. The issue was patched in version 2.5.1.
Potential Impact
An attacker with high privileges who can influence the binary path configuration can execute arbitrary shell commands on the host system. This can lead to complete compromise of confidentiality, integrity, and availability of the affected system. The vulnerability has a CVSS 3.1 score of 8.2 (high severity), reflecting its potential for significant impact. There are no known exploits in the wild at this time.
Mitigation Recommendations
Upgrade to php-weasyprint version 2.5.1 or later, which contains a patch for this vulnerability. Until upgraded, ensure that the binary path configuration cannot be influenced by untrusted sources. Patch status is not explicitly stated as 'official-fix' but the vendor has released version 2.5.1 containing the fix, so upgrading is the recommended remediation.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-28T14:33:01.179Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a3576cef198dc38c1c38eaf
Added to database: 06/19/2026, 17:05:18 UTC
Last enriched: 06/26/2026, 19:15:37 UTC
Last updated: 08/01/2026, 19:18:00 UTC
Views: 61
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.