/

CVE-2026-55554

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-20) in Dompdf Chroot Validation Checks

CVE-2026-55554

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-20

Impact:

Unauthorized Local File Read

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path validation flaw in Dompdf can allow rendered HTML controlled by an attacker to bypass the configured chroot boundary through ambiguous path-prefix matching. When an application renders attacker-influenced HTML and permits local file access, the issue may expose sensitive files outside the intended directory.

Affected context

The vulnerability occurs in Dompdf deployments that use local-resource access during HTML-to-PDF rendering and rely on the chroot validation performed by validateLocalUri(). It becomes risky when an attacker can influence rendered HTML or referenced local resources, and the configured chroot path has sibling directories sharing the same textual prefix.

Exploit preconditions

  • Attack surface: HTML-to-PDF rendering with local URI or file access enabled
  • Required access: Ability to supply or influence HTML content processed by Dompdf
  • Trigger point: Local resource resolution and chroot validation
  • Why exploitation is possible: Normalized paths are compared using a string-prefix check, allowing paths in similarly prefixed sibling directories to appear inside the permitted chroot

Why this happens

The underlying bug is an insufficient boundary check during filesystem path validation. After path normalization removes the trailing directory separator from the configured chroot, a simple strpos() prefix comparison treats directories such as /var/www2 as if they were descendants of /var/www. This reflects CWE-20: Improper Input Validation, because the validation logic does not correctly enforce the intended directory relationship.

Potential impact

  • Sensitive local files may be disclosed through generated documents
  • Application configuration or credential material could be exposed
  • Private source code or deployment data may be read
  • Further compromise could become possible if exposed files contain secrets or privileged information

General mitigation guidance

Mitigation generally focuses on enforcing canonical directory boundaries rather than relying on raw string prefixes.

Common defensive patterns include:

  • Resolve both the requested path and permitted root using canonical filesystem APIs
  • Require the resolved path to equal the root or begin with the root followed by a directory separator
  • Restrict local-resource access when it is not required for document generation
  • Treat rendered HTML and resource references as untrusted input
  • Run PDF generation with least-privilege filesystem permissions and isolated service identities
  • Avoid placing secrets or sensitive files within readable application directories

These controls reduce exposure even if an attacker can influence document content.

How teams detect issues like this

Organizations can look for:

  • Static analysis findings involving raw prefix comparisons for filesystem authorization
  • Code review signals such as strpos() or equivalent checks used without path-boundary validation
  • Tests covering sibling directories, relative paths, symlinks, and canonicalization edge cases
  • Policy checks requiring canonical path comparison before local file access
  • Application logs showing unexpected local resource references during PDF generation

Automated security review tools may help identify path-validation patterns, but filesystem-boundary tests remain important.

Sources

SourceLink
github.comgithub.com/dompdf/dompdf/releases/tag/v3.1.6
github.comgithub.com/dompdf/dompdf/security/advisories/GHSA-wvh6-f5jh-8gw4

Frequently asked

questions

It may be exploitable through a web-facing application if an attacker can submit or influence HTML that the application renders with Dompdf. The exact scope depends on how the application exposes document-generation functionality.

The attacker generally needs the ability to provide input that affects rendered HTML or local resource references. Direct operating-system access is not necessarily required when a reachable application performs the rendering.

Enforce canonical path-boundary checks that distinguish a permitted directory from similarly prefixed sibling directories, and disable local-resource access when it is unnecessary.

Treat file paths as authorization-sensitive data, test canonicalization and boundary cases, apply least-privilege filesystem permissions, and include path-validation rules in code review and automated analysis.

Find out what's already
exploitable in your codebase.