CVE-2024-56519

7.5 HIGH

📋 TL;DR

This vulnerability in TCPPDF allows cross-site scripting (XSS) attacks via malicious SVG files. Attackers can inject JavaScript through the font-family attribute in SVG content, which executes when the PDF is rendered. Any application using TCPPDF to process user-uploaded SVG files is affected.

💻 Affected Systems

Products:
  • TCPDF
Versions: All versions before 6.8.0
Operating Systems: All platforms running TCPPDF
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when processing SVG content with font-family attributes. Applications not using SVG features may not be affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full account compromise through session hijacking, credential theft, or malware delivery to users viewing malicious PDFs.

🟠

Likely Case

Limited XSS attacks stealing session cookies or performing actions as the victim user within the application context.

🟢

If Mitigated

No impact if SVG processing is disabled or proper input validation/sanitization is implemented.

🌐 Internet-Facing: HIGH - Web applications accepting user SVG uploads and generating PDFs are directly exploitable.
🏢 Internal Only: MEDIUM - Internal systems processing untrusted SVG files remain vulnerable but attack surface is reduced.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user interaction (viewing malicious PDF) but no authentication. Simple SVG file creation needed.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 6.8.0

Vendor Advisory: https://github.com/tecnickcom/TCPDF/commit/c9f41cbb84880bdb4fc3e0a9d287214d1ac4d7f4

Restart Required: No

Instructions:

1. Update TCPDF to version 6.8.0 or later. 2. Replace existing TCPDF files with new version. 3. Test PDF generation functionality.

🔧 Temporary Workarounds

Disable SVG processing

all

Prevent TCPDF from processing SVG content entirely

Configure application to not pass SVG content to TCPPDF

Input validation

all

Sanitize font-family attribute in SVG before processing

Implement regex filtering: preg_replace('/[^a-zA-Z0-9\s,\-]/', '', $fontFamily)

🧯 If You Can't Patch

  • Implement strict Content Security Policy (CSP) headers to mitigate XSS impact
  • Disable user SVG uploads or implement server-side SVG sanitization

🔍 How to Verify

Check if Vulnerable:

Check TCPDF version in code: grep -r 'TCPDF_VERSION' or check composer.json for version <6.8.0

Check Version:

php -r "include('tcpdf.php'); echo TCPDF_VERSION;"

Verify Fix Applied:

Verify version is 6.8.0+: echo TCPDF_VERSION; or check vendor/tecnickcom/tcpdf/tcpdf.php

📡 Detection & Monitoring

Log Indicators:

  • Unusual SVG file uploads
  • PDF generation errors with SVG content
  • Multiple failed SVG processing attempts

Network Indicators:

  • HTTP requests with suspicious SVG content in POST data
  • Unusual PDF download patterns

SIEM Query:

source="web_logs" AND (uri_path="*.svg" OR user_agent LIKE "%TCPDF%") AND status=200

🔗 References

📤 Share & Export