CVE-2026-49359
### Summary `pontedilana/php-weasyprint` fetches the content of option values server-side via `file_get_contents()` when the value looks like a URL, without restricting the URL scheme. The `attachment` option of `Pdf` is the reachable sink: any value that passes `isOptionUrl()` (`filter_var(..., FILTER_VALIDATE_URL)`) is downloaded by the PHP process and embedded into the generated PDF. Because `FILTER_VALIDATE_URL` accepts `http`, `https`, `ftp`, `file` and PHP stream wrappers such as `php://`, an attacker who can influence the `attachment` value reaches both a **Server-Side Request Forgery** primitive (e.g. internal HTTP endpoints, cloud metadata) and a **local file disclosure** primitive (`file://`, `php://filter/...`), with the fetched bytes exfiltrated as a PDF attachment. This is the same class of issue KnpLabs/snappy patched for its `xsl-style-sheet` option in [GHSA-c5fp-p67m-gq56](https://github.com/KnpLabs/snappy/security/advisories/GHSA-c5fp-p67m-gq56). The library is documented as a one-to-one substitute for KnpLabs/snappy and shares the same code shape. ### Affected versions `pontedilana/php-weasyprint` versions `<= 2.5.1`. Patched in: `2.6.0`. ### Privilege required Any caller that can influence the `attachment` option value handed to `Pdf::generate()` / `Pdf::getOutput()` / `setOption('attachment', ...)`. Typical reach paths: a value sourced from a request parameter, a per-tenant configuration row, or any user-controllable field that flows into the attachment list. ### Vulnerable code `src/Pdf.php` — `isOptionUrl()` accepts any well-formed URL regardless of scheme: ```php protected function isOptionUrl($option): bool { return false !== \filter_var($option, \FILTER_VALIDATE_URL); } ``` `src/Pdf.php` — `handleArrayOptions()` fetches the URL content for the `attachment` option: ```php $fetchUrlContent = 'attachment' === $option && $this->isOptionUrl($item); if ($saveToTempFile || $fetchUrlContent) { $fileContent = $fetchUrlContent ? \f
Properties
- severity
- medium
- summary
- PhpWeasyPrint vulnerable to SSRF and local file disclosure via the attachment option
- epss_score
- 0.00422
- cvss_score
- 6.5
- ghsa_published
- 2026-06-26T22:11:40Z
- source_url
- https://github.com/advisories/GHSA-x8g9-h984-pc36
- ghsa_updated
- 2026-06-26T22:11:43Z
- ghsa_id
- GHSA-x8g9-h984-pc36
- cve_id
- CVE-2026-49359
- cvss_vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- is_ghsa_only
- false
- epss_percentile
- 0.34846
Related Entities (5)
ENRICHED_BY (1)
HAS_WEAKNESS (1)
REPORTED_BY (1)
VULNERABLE_TO (1)
AFFECTS (1)
Explore deeper with Ninja Signal's threat intelligence graph