CRITICAL🇵🇱 Wersja polska

CVE-2021-3838

CVSS 9.8v3.1pub. 2024-11-15upd. 2024-11-19

DomPDF before version 2.0.0 is vulnerable to PHAR deserialization due to a lack of checking on the protocol before passing it into the file_get_contents() function. An attacker who can upload files of any type to the server can pass in the phar:// protocol to unserialize the uploaded file and instantiate arbitrary PHP objects. This can lead to remote code execution, especially when DOMPdf is used with frameworks with documented POP chains like Laravel or vulnerable developer code.

🤖 AI Analysis
How it works

The application does not verify the protocol passed to the file_get_contents() function, which allows an attacker to substitute a URI with a phar:// prefix. If the attacker is able to upload a file of any type to the server (e.g., through an upload form), they can prepare a PHAR archive containing serialized PHP objects. Passing a phar:// path to the vulnerable function causes automatic deserialization of the archive metadata and instantiation of arbitrary PHP classes available in the application. Combined with existing POP (Property-Oriented Programming) chains, arbitrary code execution on the server side is possible.

Impact

An attacker can gain full control over the server through remote code execution (RCE), and can also compromise the confidentiality, integrity, and availability of data processed by the application.

Mitigation & patch

DomPDF should be updated to version 2.0.0 or newer, which includes protocol verification before passing values to file_get_contents(). The fix is available in commit 99aeec1efec9213e87098d42eb09439e7ee0bb6a. Additionally, it is recommended to restrict file upload capabilities to authenticated and authorized users only, and to validate file extensions and MIME types of uploaded files.

Who is affected

DomPDF in versions before 2.0.0 (dompdf/dompdf project).

Analysis generated by Claude AI (Anthropic) based on NVD data. Always verify with vendor.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Dompdf Project Dompdf

    APP
    Dompdf Project
    < 2.0.0
🔵
CHECK WITH VENDOR
No clear patch data available. Check vendor references.
Tags
RCEDeserialization
CWE
References

Related vulnerabilities

CVE-2021-3902CRITICAL9.8PL ✓same product

XXE w parserze SVG biblioteki dompdf umożliwia SSRF i PHAR deserialization

CVE-2023-24813CRITICAL10.0PL ✓same product

Dompdf: bypass ochrony URL przez rozbieżność parsera atrybutów SVG

CVE-2023-23924CRITICAL10.0PL ✓same product

Dompdf: pominięcie walidacji URI w SVG prowadzące do RCE

CVE-2022-28368CRITICAL9.8PL ✓same product

Dompdf 1.2.1 — RCE przez plik .php w dyrektywie @font-face CSS

CVE-2022-41343HIGH7.5same product

registerFont in FontMetrics.php in Dompdf before 2.0.1 allows remote file inclusion because a URI validation f...