pontedilana/php-weasyprint

CVE-2026-49359

CVE-2026-49359 is a medium-severity server-side request forgery (SSRF) vulnerability in pontedilana/php-weasyprint (composer), affecting versions <= 2.5.1. It is fixed in 2.6.0.

Key facts
CVSS score
6.5
Medium
Attack vector
Network
Issuing authority
GitHub Advisory Database
Affected package
pontedilana/php-weasyprint
Fixed in
2.6.0
Disclosed
2026

Summary

Summary pontedilana/php-weasyprint fetches the content of option values server-side via filegetcontents() 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() (filtervar(..., FILTERVALIDATEURL)) is downloaded by the PHP process and embedded into the generated PDF. Because FILTERVALIDATEURL 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. 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: src/Pdf.php, handleArrayOptions() fetches the URL content for the attachment option: FILTERVALIDATEURL returns truthy for http://, https://, ftp://, file://localhost/..., and php://filter/..., so \filegetcontents() is invoked on attacker-chosen schemes with no allow-list. Proof of concept Impact SSRF: the server fetches arbitrary http(s)/ftp URLs, reaching internal-only services, link-local metadata endpoints, etc. Local file / wrapper disclosure: php://filter/... (and similar) let an attacker read and exfiltrate local file content inside the generated PDF. Affects any consumer that does not fully control the attachment option value. Note: passing a plain local path (e.g. /etc/passwd) or a file:// path that resolves to an existing file is handled as a normal local attachment and is not the issue addressed here, that is the documented local-attachment feature (callers must not pass untrusted input to the option). The fix specifically removes the server-side fetch amplification through non-http(s) schemes. CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N (6.5, Medium), adjust PR/S/A to the consuming application's reachability (e.g. PR:N if the attachment value is reachable from an unauthenticated surface). CWE-918 (Server-Side Request Forgery); secondary CWE-22 (Improper Limitation of a Pathname) for the wrapper-based file read. Suggested fix Restrict the schemes the library will fetch to an allow-list (http, https by default), and treat any other scheme as inline content instead of fetching it: A value with a non-allowed scheme (file://, php://, ftp://, ...) is then never passed to fileget_contents(). Credit Reported upstream to KnpLabs/snappy (GHSA-c5fp-p67m-gq56); identified as applicable to pontedilana/php-weasyprint, which mirrors the same code.

Impact

What is server-side request forgery (SSRF)?

Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside. Typical impact: access to internal metadata services, internal APIs, or cloud credentials.

Severity and exposure

CVE-2026-49359 has a CVSS score of 6.5 (Medium). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.

A fixed version is available (2.6.0). Upgrading removes the vulnerable code path.

Affected versions

composer

  • pontedilana/php-weasyprint (<= 2.5.1)

Security releases

  • pontedilana/php-weasyprint → 2.6.0 (composer)
Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.

Kodem's runtime-powered SCA identifies whether CVE-2026-49359 is reachable in your applications. Explore open-source security for your team.

See if CVE-2026-49359 is reachable in your applications. Get a demo

Already deployed Kodem? See CVE-2026-49359 in your environment

Remediation advice

Upgrade pontedilana/php-weasyprint to 2.6.0 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently asked questions about CVE-2026-49359

What is CVE-2026-49359?

CVE-2026-49359 is a medium-severity server-side request forgery (SSRF) vulnerability in pontedilana/php-weasyprint (composer), affecting versions <= 2.5.1. It is fixed in 2.6.0. Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside.

How severe is CVE-2026-49359?

CVE-2026-49359 has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.

Which versions of pontedilana/php-weasyprint are affected by CVE-2026-49359?

pontedilana/php-weasyprint (composer) versions <= 2.5.1 is affected.

Is there a fix for CVE-2026-49359?

Yes. CVE-2026-49359 is fixed in 2.6.0. Upgrade to this version or later.

Is CVE-2026-49359 exploitable, and should I be worried?

Whether CVE-2026-49359 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo

What actually determines whether CVE-2026-49359 is exploitable, and how bad it is?

Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.

How do I fix CVE-2026-49359?

Upgrade pontedilana/php-weasyprint to 2.6.0 or later.

Stop the waste.
Protect your environment with Kodem.