=============================================================================================================================================
| # Title : mPDF v8.1.0 Multiple Vulnerabilities |
| # Author : indoushka |
| # Tested on : windows 11 Fr(Pro) / browser : Mozilla firefox 147.0.1 (64 bits) |
| # Vendor : https://github.com/mpdf/mpdf |
=============================================================================================================================================
[+] References:
[+] Summary: mPDF v8.1.0 is vulnerable to multiple security issues related to unsafe handling of external resources, file paths, and image content during HTML-to-PDF rendering.
When untrusted or partially trusted HTML input is processed, attackers may exploit insufficient validation to trigger SSRF, local file disclosure, or denial of service conditions.
The library allows fetching of external resources (images, SVG, CSS) without strict protocol, IP range, or size restrictions.
Additionally, file access functions may be abused to read arbitrary local files when input validation is not enforced by the application.
[+] Technical Details :
1. Server-Side Request Forgery (SSRF)
mPDF fetches external resources referenced in HTML (e.g.
) without enforcing restrictions on:
localhost / 127.0.0.1
Internal IP ranges (10.0.0.0/8, 192.168.0.0/16, 169.254.0.0/16)
Cloud metadata endpoints
This allows attackers to force the server to issue internal network requests.
[+] Impact :Internal service enumeration, metadata leakage, sensitive data exposure.
2. Local File Inclusion / Arbitrary File Read
Improper validation of file paths may allow attackers to reference local files using traversal sequences or absolute paths.
Example payload:
../../../../etc/passwd
[+] Impact : Disclosure of sensitive system or application files.
3. Stream Wrapper Abuse
Partial wrapper validation exists, but alternative PHP stream wrappers may still be accessible depending on configuration, such as:
zip://
glob://
compress.zlib://
expect:// (where enabled)
[+] Impact: Bypass of security controls, unexpected file access behavior.
4. Denial of Service (Memory Exhaustion)
mPDF processes images using in-memory operations without enforcing:
Maximum file size
Maximum image dimensions
Attackers may supply:
Extremely large images
Image-based zip bombs (PNG)
[+] Impact : Memory exhaustion, application crash, request timeout.
5. Image Parsing Risks (GD / ImageMagick)
The library relies heavily on PHP image processing functions historically affected by:
Heap overflows
Integer overflows
Risk increases when running on outdated PHP or GD versions.
6. SVG External Resource Injection
SVG images may contain: