Moderate Vulnerability in TCPDF: Incorrect Comparison in unserializeTCPDFtag
Summary
GHSA-w95c-7994-ghpr: TCPDF has incorrect comparison. Affects tecnickcom/tcpdf versions < 6.8.0. Fixed in 6.8.0. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
TCPDF is an open-source PHP library that enables the generation of PDF documents directly from PHP scripts. It is widely used for creating dynamic PDF files in web applications. The library supports various features such as text, images, and graphics, 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 issues due to improper comparison methods.
Vulnerability Detail
The vulnerability arises from the use of loose comparison (using !=) 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 unexpected behavior or security breaches. The issue is classified under CWE-697, indicating a problem with incorrect comparison logic that could be leveraged in various attack scenarios.
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, developers can implement additional validation checks before using the unserializeTCPDFtag function to ensure that the input data is sanitized and does not lead to unintended consequences. However, the best approach is to update to the latest version.
Conclusion
In summary, the TCPDF library has a moderate vulnerability related to incorrect comparison logic in the unserializeTCPDFtag function. It is crucial for developers using this library to update to version 6.8.0 or later to ensure the security of their applications. Temporary workarounds can be implemented, but the best practice is to apply the patch as soon as possible.
See every vulnerability recorded for tecnickcom/tcpdf →
FAQ
The vulnerability involves incorrect comparison logic in the unserializeTCPDFtag function, which could lead to security issues.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.
The risks include unexpected behavior in the application and potential security breaches due to improper handling of TCPDF tag hashes.
Yes, the vulnerability has been patched in TCPDF version 6.8.0 and later.
If immediate updating is not possible, implement additional validation checks as a temporary workaround to mitigate risks.
Related vulnerabilities
Recent vulnerabilities recorded for tecnickcom/tcpdf.