CVE-2024-56522
NoneTCPDF has incorrect comparison
CVSS
—
EPSS
0.6%
Published
Dec 27, 2024
CISA due date
—
Cloudanix analysis
A PDF creation library compared secret values in a way that could let attackers guess them by measuring how long the checks took, risking tampered documents.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- High
- Impact
- Data Exposure
- Component
- Library
- Class
- Cryptographic Weakness
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability permits timing side-channel attacks against TCPDF tag hash verification because loose != comparison is used instead of a constant-time equality function.
Why it matters to the business
Attackers could forge valid tags, undermining the integrity of generated PDF documents and potentially bypassing content or access controls in document workflows.
How an attack unfolds
An attacker sends crafted TCPDF tags with varying hash values, measures response timing differences caused by early-exit loose comparison, recovers a valid hash, and then submits a malicious tag that passes verification.
How to fix it
Upgrade tecnickcom/tcpdf to the revision containing commit d54b97cec33f4f1a5ad81119a82085cad93cec89 or later, which replaces loose comparisons with constant-time functions.
How to confirm the fix worked
Confirm the deployed TCPDF source contains the referenced commit; run targeted unit tests that assert constant-time behavior on tag hash comparisons.
Typical attack path
- Locate applications using vulnerable TCPDF versions for PDF generation
- Send probe requests containing TCPDF tags with guessed or mutated hashes
- Measure server response timing to perform statistical timing analysis
- Recover a correct tag hash and craft a malicious but accepted tag
- Inject the forged tag to alter document content or bypass validation
How to detect it
Inspect application and web server logs for repeated TCPDF tag processing with unusual timing patterns or high volumes of validation attempts; correlate with PDF output anomalies.
What your security team should do
- Immediately update all instances of tecnickcom/tcpdf to the fixed commit
- Audit codebases for direct use of unserializeTCPDFtag and similar tag handling
- Add runtime monitoring for anomalous timing or validation failures in PDF generation paths
The record
An issue was discovered in TCPDF before 6.8.0. unserializeTCPDFtag uses != (aka loose comparison) and does not use a constant-time function to compare TCPDF tag hashes.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | tecnickcom/tcpdf | 0 | 6.8.0 |
| Debian:11 | tcpdf | 0 | No fix |
| Debian:12 | tcpdf | 0 | No fix |
| Debian:13 | tcpdf | 0 | 6.8.0+dfsg-1 |
| Mageia:9 | php-tcpdf | 0 | 6.5.0-1.3.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: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-51058 TCPDF Local File Inclusion vulnerability 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