CVE-2024-22640
High · 7.5CVSS
7.5
EPSS
1.3%
Published
Apr 19, 2024
CISA due date
—
Cloudanix analysis
A problem in a common PDF-making tool can let attackers slow down or crash systems that turn web content into documents by feeding it specially made color information.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw permits catastrophic backtracking in a regular expression during color parsing of untrusted HTML, resulting in excessive CPU consumption and potential denial of service.
Why it matters to the business
Services that convert user-supplied HTML into PDFs can become slow or unavailable, interrupting document generation workflows and increasing infrastructure load.
How an attack unfolds
An attacker supplies an HTML document containing a maliciously crafted color value to any application using the vulnerable library version; the color parser's regex engine enters prolonged backtracking, exhausting server resources without authentication or user interaction.
How to fix it
Upgrade TCPDF to the latest version greater than 6.6.5; if immediate upgrade is not possible, implement input sanitization to reject or normalize color values before parsing.
How to confirm the fix worked
Reproduce PDF generation using previously triggering color patterns and confirm processing completes within expected time bounds; review release notes for the resolved color regex.
Typical attack path
- Locate an endpoint or feature that accepts HTML and invokes TCPDF for PDF rendering
- Craft a color attribute containing a string engineered for regex backtracking
- Submit the HTML payload through the normal input channel
- Trigger repeated processing to sustain resource exhaustion
How to detect it
Review application and web server logs for PDF generation requests that exhibit abnormally long execution times or high CPU; correlate with incoming HTML containing unusual color strings.
What your security team should do
- Prioritize upgrade of the TCPDF library across all instances
- Add server-side validation to strip or limit color-related attributes in HTML input
- Enable request timeouts and resource limits on PDF generation processes
- Monitor EPSS and library advisories for any change in exploit maturity
The record
TCPDF version <=6.6.5 is vulnerable to ReDoS (Regular Expression Denial of Service) if parsing an untrusted HTML page with a crafted color.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | tecnickcom/tcpdf | 0 | 6.7.5 |
| Debian:11 | tcpdf | 0 | No fix |
| Debian:12 | tcpdf | 0 | No fix |
| Debian:13 | tcpdf | 0 | 6.7.5+dfsg-1 |
| Debian:14 | tcpdf | 0 | 6.7.5+dfsg-1 |
| Mageia:9 | php-tcpdf | 0 | 6.5.0-1.1.mga9 |
| 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:25.04 | tcpdf | 0 | No fix |
| Ubuntu:25.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-51058 TCPDF Local File Inclusion vulnerability 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