CVE-2018-3746

9.8 CRITICAL

📋 TL;DR

CVE-2018-3746 is a command injection vulnerability in the pdfinfojs NPM module that allows attackers to execute arbitrary commands on the victim's system by injecting malicious input. This affects any application using vulnerable versions of pdfinfojs, particularly Node.js applications that process user-controlled PDF files.

💻 Affected Systems

Products:
  • pdfinfojs
Versions: <= 0.3.6
Operating Systems: All operating systems running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Any Node.js application using pdfinfojs to process PDF files with user-controlled input is vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise allowing attacker to execute arbitrary commands with application privileges, potentially leading to data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

Remote code execution leading to data exfiltration, lateral movement within the network, or installation of backdoors.

🟢

If Mitigated

Limited impact due to proper input validation, sandboxing, or network segmentation preventing command execution.

🌐 Internet-Facing: HIGH - Applications processing user-uploaded PDF files from the internet are directly exposed to exploitation.
🏢 Internal Only: MEDIUM - Internal applications processing PDFs could be exploited by authenticated users or through other attack vectors.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation is straightforward - attacker needs to provide malicious input to PDF processing functions. Public exploit code exists in HackerOne reports.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.3.7 and later

Vendor Advisory: https://www.npmjs.com/advisories/646

Restart Required: Yes

Instructions:

1. Update pdfinfojs to version 0.3.7 or later using 'npm update pdfinfojs'. 2. Restart your Node.js application. 3. Verify the update with 'npm list pdfinfojs'.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation and sanitization for all PDF file inputs before passing to pdfinfojs functions.

Sandbox Execution

all

Run the Node.js application in a sandboxed environment with limited permissions to restrict command execution impact.

🧯 If You Can't Patch

  • Implement strict input validation to reject any PDF files containing shell metacharacters or suspicious patterns.
  • Isolate the vulnerable application in a network segment with no internet access and minimal internal network permissions.

🔍 How to Verify

Check if Vulnerable:

Check package.json or run 'npm list pdfinfojs' to see if version <= 0.3.6 is installed.

Check Version:

npm list pdfinfojs | grep pdfinfojs

Verify Fix Applied:

Run 'npm list pdfinfojs' and verify version is 0.3.7 or higher. Test PDF processing with known safe files.

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution in application logs
  • PDF processing errors with shell commands in error messages
  • Unexpected child process spawns from Node.js application

Network Indicators:

  • Outbound connections from Node.js application to unexpected destinations
  • Command and control traffic patterns

SIEM Query:

source="application.logs" AND ("pdfinfojs" OR "pdfinfo") AND ("exec" OR "spawn" OR "child_process")

🔗 References

📤 Share & Export