CVE-2024-51058
Medium · 6.2TCPDF Local File Inclusion vulnerability
CVSS
6.2
EPSS
0.8%
Published
Nov 26, 2024
CISA due date
—
Cloudanix analysis
A problem in software that creates PDF files could let attackers steal private information from the server by making the software include secret files in the documents it produces.
- Exploitation
- Remote Authenticated
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Data Exposure
- Component
- Library
- Class
- Path Traversal
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability allows reading arbitrary server files through manipulation of the src attribute in img tags processed by the TCPDF library during PDF generation.
Why it matters to the business
Attackers could access sensitive configuration files, credentials, or other data stored on the server, leading to further compromise or data breaches. The library is widely used, increasing potential impact.
How an attack unfolds
An attacker supplies crafted HTML containing an img tag with a src pointing to a local file path like file:///etc/passwd, which TCPDF includes in the generated PDF, exposing the file contents.
How to fix it
Upgrade to the fixed version in commit bfa7d2b6d455ebf72ebe3d48fbd487ee5a1f6f3b of tecnickcom/tcpdf.
How to confirm the fix worked
Verify the library version is updated to include the fix commit, and test that local file paths in img src are no longer included.
Typical attack path
- Identify an application using TCPDF to generate PDFs from user-controlled HTML
- Craft malicious HTML with img src set to local file path
- Trigger PDF generation
- Retrieve the PDF containing the file contents
How to detect it
Look for PDF generation logs or requests that include suspicious image sources pointing to local paths; check generated PDFs for unexpected content from system files.
What your security team should do
- Update TCPDF to the latest fixed version immediately
- Review applications using TCPDF for user-controlled input in PDF generation
- Implement input sanitization for HTML content
- Monitor for unusual PDF generation requests
The record
Local File Inclusion (LFI) vulnerability has been discovered in TCPDF 6.7.5. This vulnerability enables a user to read arbitrary files from the server's file system through <img> src tag, potentially exposing sensitive information.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | tecnickcom/tcpdf | 0 | 6.7.6 |
| Debian:11 | tcpdf | 0 | No fix |
| Debian:12 | tcpdf | 0 | No fix |
| Debian:13 | tcpdf | 0 | 6.7.7+dfsg-1 |
| Debian:14 | tcpdf | 0 | 6.7.7+dfsg-1 |
| Ubuntu:14.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:16.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:18.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:20.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:22.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:24.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:24.10 | tcpdf | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | tcpdf | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | tcpdf | 0 | No fix |
Related vulnerabilities
- CVE-2024-56527 TCPDF missing character escape on error messages Also affects tecnickcom/tcpdf
- CVE-2024-56519 TCPDF lacks SVG sanitization Also affects tecnickcom/tcpdf
- CVE-2024-56521 TCPDF missing certificate validation Also affects tecnickcom/tcpdf
- CVE-2024-56522 TCPDF has incorrect comparison Also affects tecnickcom/tcpdf
- CVE-2024-22640 TCPDF version <=6.6.5 is vulnerable to ReDoS (Regular Expression Denial of Service) if… Also affects tecnickcom/tcpdf
- CVE-2024-32489 TCPDF before 6.7.4 mishandles calls that use HTML syntax. Also affects tecnickcom/tcpdf
- CVE-2024-56520 An issue was discovered in tc-lib-pdf-font before 2.6.4, as used in TCPDF before 6.8.0… Also affects tcpdf
- CVE-2024-22641 TCPDF version 6.6.5 and before is vulnerable to ReDoS (Regular Expression Denial of… Also affects tcpdf