CVE-2024-56522: TCPDF Incorrect Comparison Vulnerability

tecnickcom/tcpdf Updated 02 Oct 2025

Summary

27/12/2024
Yes i
High
7.5

CVE-2024-56522: TCPDF has incorrect comparison. Affects tecnickcom/tcpdf versions < 6.8.0. Fixed in 6.8.0. How to fix ↓

Also tracked for

The same CVE-2024-56522 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

TCPDF is a popular open-source PHP library used for generating PDF documents. It provides a wide range of features, including support for various fonts, images, and colors, making it a versatile tool for developers. However, prior to version 6.8.0, TCPDF contained a vulnerability related to the unserializeTCPDFtag function, which could lead to security risks due to improper comparison methods.

Vulnerability Detail

The vulnerability arises from the use of loose comparison (!=) in the unserializeTCPDFtag function, which does not utilize a constant-time function for comparing TCPDF tag hashes. This can potentially allow an attacker to exploit the comparison logic, leading to unauthorized access or manipulation of PDF content. The issue is classified under CWE-697, indicating a potential weakness in the comparison logic that could be exploited in various ways.

How To Fix

Minimum fixed version

6.8.0

This is the first release that contains the fix.

composer require tecnickcom/tcpdf:6.8.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can implement additional validation checks in your code to ensure that the comparisons made in the unserializeTCPDFtag function are secure. However, the best solution is to update to the latest version of TCPDF.

Conclusion

In summary, CVE-2024-56522 is a moderate severity vulnerability in TCPDF that arises from improper comparison logic. It is crucial for users of TCPDF to update to version 6.8.0 or later to mitigate the risks associated with this vulnerability. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for tecnickcom/tcpdf →

Share this vulnerability

FAQ

CVE-2024-56522 is a vulnerability in TCPDF that involves incorrect comparison logic in the unserializeTCPDFtag function, which can lead to security issues.

You can use Vulert, which monitors open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without needing to sign up.

The risks include potential unauthorized access and manipulation of PDF documents generated by TCPDF, which could compromise sensitive information.

Yes, the vulnerability is fixed in TCPDF version 6.8.0 and later. Updating to this version will resolve the issue.

If an immediate update is not possible, consider implementing additional validation checks in your code as a temporary workaround until you can upgrade.

Related vulnerabilities

Recent vulnerabilities recorded for tecnickcom/tcpdf.

How To Fix

Minimum fixed version

6.8.0

This is the first release that contains the fix.

composer require tecnickcom/tcpdf:6.8.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback