CVE-2024-2971
Executive Summary
CVE-2024-2971 is a low-severity (CVSS 2.9) out-of-bounds array write vulnerability in Xpdf 4.05 and earlier. The flaw is triggered by a specially crafted PDF file containing an indirect reference with a negative object number. This can cause a write operation beyond the allocated array bounds, potentially leading to a denial of service (application crash) or, in specific memory configurations, arbitrary code execution. The vulnerability is local in nature, requiring user interaction to open the malicious PDF. No public exploit code or active exploitation has been observed, and the vendor has not released a patch.
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
Supply Chain & Package Security
Xpdf is a widely used open-source PDF viewer and toolkit, often integrated into Linux distributions and other software as a dependency. The lack of a patch for this vulnerability poses a supply chain risk. Organizations using Xpdf as a library or component in their products should assess their exposure and consider alternative PDF processing libraries until a fix is available.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
- Base Score: 2.9 (Low)
- Attack Vector: Local (AV:L) – The attacker must have local access to the system.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: Required (UI:R) – The victim must open the malicious PDF.
- Scope: Unchanged (S:U) – The vulnerability does not affect other components.
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: Low (A:L) – The primary impact is a denial of service.
Threat Level: Low. The vulnerability requires local access and user interaction, and no public exploit exists. However, the lack of a patch means that any system running Xpdf 4.05 or earlier is potentially vulnerable.
Deep Dive & Mechanics
The vulnerability resides in Xpdf's PDF parser, specifically in the handling of indirect references. In PDF syntax, an indirect reference is used to refer to an object by its object number and generation number (e.g., 3 0 R). The parser reads the object number and uses it as an index into an array of objects.
The flaw occurs when the object number is a negative integer. The parser does not validate that the object number is non-negative before using it as an array index. This leads to an out-of-bounds write, as the negative index accesses memory before the start of the allocated array.
Technical Walkthrough:
- A malicious PDF is crafted with an indirect reference like
-1 0 R. - Xpdf's parser reads the object number
-1. - The parser uses
-1as an index into an array of object pointers. - This results in a write to memory at
array_base - sizeof(pointer), corrupting adjacent memory. - The corruption can lead to a crash (denial of service) or, if carefully controlled, arbitrary code execution.
The vulnerability is classified as CWE-787 (Out-of-bounds Write). The root cause is a missing bounds check on the object number before array access.
Vulnerable vs. Patched Code
Since no patch is available, a comparison is not possible. However, the vulnerable code pattern can be described:
Vulnerable Code (Conceptual):
// In Xpdf's PDF parser (xpdf-4.05)
Object* xrefTable[MAX_OBJECTS];
int objNum = readObjectNumber(); // Reads -1 from malicious PDF
// No bounds check on objNum
xrefTable[objNum] = newObject(); // Out-of-bounds write
Patched Code (Hypothetical):
Object* xrefTable[MAX_OBJECTS];
int objNum = readObjectNumber();
if (objNum < 0 || objNum >= MAX_OBJECTS) {
// Handle error: invalid object number
error("Invalid object number: %d", objNum);
return;
}
xrefTable[objNum] = newObject();
The fix would involve adding a validation check to ensure the object number is within the valid range (0 to MAX_OBJECTS-1) before using it as an array index.
Exploitation & Lab Setup
Red Team (Exploitation)
No public exploit code is available. However, a proof-of-concept can be crafted:
- Create a Malicious PDF: Use a PDF manipulation library (e.g.,
pdf-parser.pyfrom Didier Stevens) to create a PDF with an indirect reference containing a negative object number. - Trigger the Vulnerability: Open the malicious PDF with Xpdf 4.05.
- Observe Crash: The application should crash due to the out-of-bounds write.
Example PDF Structure (Conceptual):
%PDF-1.4
1 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj
3 0 obj
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >>
endobj
xref
0 4
0000000000 65535 f
0000000009 00000 n
0000000058 00000 n
0000000115 00000 n
trailer
<< /Size 4 /Root 1 0 R >>
startxref
190
%%EOF
The malicious reference would be inserted as -1 0 R in place of a valid object reference.
Blue Team (Detection & Defense)
- Monitor for Crashes: Monitor application logs for crashes of Xpdf or any application using the Xpdf library.
- File Scanning: Use file scanning tools to detect PDFs with negative object numbers in indirect references.
- Sandboxing: Open PDFs in a sandboxed environment to prevent system-wide impact.
- User Awareness: Train users to avoid opening PDFs from untrusted sources.
Indicators of Compromise (IOCs)
- File Hashes: (No specific hashes available, but any PDF with a negative object number in an indirect reference is suspicious.)
- Network Indicators: None (local vulnerability).
- System Indicators:
- Xpdf process crash logs.
- Memory corruption errors in system logs.
- Unexpected termination of Xpdf or related processes.
Detection Engineering
YARA Rule
rule CVE_2024_2971_Xpdf_Negative_Object_Number {
meta:
description = "Detects PDF files with negative object numbers in indirect references"
author = "Valters IT"
date = "2024-10-27"
reference = "CVE-2024-2971"
severity = "low"
strings:
$negative_ref = /-\d+\s+\d+\s+R/
condition:
$negative_ref
}
Sigma Rule
title: CVE-2024-2971 Xpdf Negative Object Number Exploit Attempt
id: xpdf-cve-2024-2971
status: experimental
description: Detects attempts to exploit CVE-2024-2971 by opening a PDF with a negative object number in Xpdf.
author: Valters IT
date: 2024/10/27
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-2971
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/xpdf'
CommandLine|contains: '.pdf'
condition: selection
falsepositives:
- Legitimate PDFs with negative object numbers (unlikely)
level: low
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-2971 Xpdf Negative Object Number PDF Download"; flow:to_client; file.name:/.*\.pdf/; file.content:"/-\d+\s+\d+\s+R/"; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
- Patch: No official patch is available. Monitor the Xpdf website (https://www.xpdfreader.com/) for updates.
- Mitigation:
- Upgrade: Consider upgrading to a newer version of Xpdf if available, or switch to an alternative PDF viewer (e.g., Evince, Okular, MuPDF).
- Input Validation: If using Xpdf as a library, implement input validation to reject PDFs with negative object numbers.
- Sandboxing: Run Xpdf in a restricted environment (e.g., Docker container, seccomp) to limit the impact of a crash.
- User Education: Advise users not to open PDFs from untrusted sources.
Valters IT Signature: This report is prepared by Valters IT, an elite DevSecOps and Cyber Threat Intelligence team. For further inquiries, contact [valters@example.com].
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.