CVE-2024-3247
Executive Summary
CVE-2024-3247 is a denial-of-service vulnerability in Xpdf versions 4.05 and earlier. The flaw resides in the PDF object stream parser, where a crafted PDF containing a circular reference between objects triggers infinite recursion. This leads to a stack overflow and application crash. The vulnerability has a low CVSS score of 2.9 due to the requirement for user interaction (opening a malicious PDF) and the limited impact (availability only). No public proof-of-concept or patch is currently available.
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: 2.9 (Low)
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
- Attack Vector: Local (AV:L) – The attacker must deliver the malicious PDF to the victim.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: Required (UI:R) – Victim must open the file.
- Scope: Unchanged (S:U) – Impact is confined to the vulnerable component.
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: Low (A:L) – Application crash, but no data loss.
Threat Level: Low. Exploitation requires user interaction and results only in a denial of service. No data theft or system compromise is possible.
Deep Dive & Mechanics
The vulnerability is a classic stack overflow caused by infinite recursion. PDF files can contain object streams, which are compressed containers for multiple PDF objects. Each object can reference other objects via indirect references (e.g., 3 0 R). The Xpdf parser, when resolving an object stream, recursively follows these references. If a circular reference exists (e.g., Object A references Object B, which references Object A), the parser enters an infinite loop, consuming stack space until a stack overflow occurs.
The vulnerable code is in the ObjectStream::parse function (or similar) in Xpdf's source. The parser does not maintain a visited-object set to detect cycles. This is a common pattern in CVE-674 (Uncontrolled Recursion).
Vulnerable vs. Patched Code
Vulnerable Code (Xpdf 4.05):
// Simplified representation
Object* ObjectStream::getObject(int objNum) {
// No cycle detection
Object* obj = readObjectFromStream(objNum);
if (obj->isRef()) {
return getObject(obj->getRefNum()); // Recursive call without check
}
return obj;
}
Patched Code (Hypothetical):
// Patched version with cycle detection
Object* ObjectStream::getObject(int objNum, std::set<int>& visited) {
if (visited.find(objNum) != visited.end()) {
error(errSyntaxError, -1, "Circular reference detected in object stream");
return nullptr;
}
visited.insert(objNum);
Object* obj = readObjectFromStream(objNum);
if (obj->isRef()) {
return getObject(obj->getRefNum(), visited);
}
return obj;
}
The patch adds a visited set to track already-resolved object numbers. If a reference is encountered that is already in the set, the parser returns an error instead of recursing.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Xpdf 4.05 or earlier installed on a Linux/Windows system.
- Ability to deliver a crafted PDF to the victim (e.g., via email, download).
Exploitation Steps:
- Create a malicious PDF with a circular reference in an object stream. This can be done manually by editing a PDF binary or using a tool like
pdf-parser.pyfrom Didier Stevens. - The PDF must contain an object stream (type
ObjStm) where one object references another, which in turn references the first. - Deliver the PDF to the victim.
- When the victim opens the PDF with
xpdf,pdftotext, orpdfinfo, the application will crash due to stack overflow.
Example Crafted PDF Structure (Hex):
%PDF-1.4
1 0 obj
<< /Type /ObjStm /N 2 /First 4 >>
stream
2 0 obj
<< /Type /ObjStm /N 2 /First 4 >>
stream
3 0 obj
3 0 R
endstream
endobj
3 0 obj
2 0 R
endstream
endobj
trailer
<< /Root 1 0 R >>
%%EOF
Note: This is a simplified example. Actual exploitation requires precise binary editing.
Blue Team
Detection:
- Monitor for crashes of Xpdf processes (
xpdf,pdftotext,pdfinfo). - Use file integrity monitoring to detect unexpected PDF files.
- Implement network filtering to block PDF downloads from untrusted sources.
Mitigation:
- Restrict execution of Xpdf to trusted users only.
- Use application whitelisting to prevent untrusted PDF viewers.
- Consider using a sandboxed PDF viewer.
Indicators of Compromise (IOCs)
- File Hashes: No known malicious samples yet.
- Process Behavior: Xpdf process crashes with a stack overflow error.
- Network: No network indicators (local vulnerability).
- File Artifacts: PDF files with object streams containing circular references.
Detection Engineering
YARA Rule
rule CVE_2024_3247_Xpdf_StackOverflow {
meta:
description = "Detects PDF files with potential circular references in object streams"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-3247"
strings:
$objstm = "ObjStm"
$ref_pattern = /(\d+ \d+ R)/
condition:
$objstm and #ref_pattern > 5
}
Sigma Rule
title: Xpdf Stack Overflow via Circular Object Reference
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects Xpdf crashes caused by CVE-2024-3247
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith: '\xpdf.exe'
CommandLine|contains: '*.pdf'
condition: selection
falsepositives:
- Legitimate large PDFs
level: low
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-3247 Xpdf PDF Download"; flow:to_server,established; content:"|25 50 44 46|"; http_client_body; depth:4; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Upgrade: No official patch available. Monitor Xpdf website for updates.
- Workaround: Use alternative PDF viewers (e.g., MuPDF, Evince) until a patch is released.
- Compile from Source: Apply the hypothetical patch above to Xpdf source code and recompile.
- Network Controls: Block PDF downloads from untrusted sources.
- User Training: Educate users not to open PDFs from unknown senders.
Valters IT
Securing Digital Frontiers