/

CVE-2020-37282

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in office-converter API

CVE-2020-37282

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical OS command injection vulnerability in office-converter allows attacker-controlled file names to influence a shell command used during document conversion. When a crafted file name reaches the conversion functions, commands may execute with the privileges of the Node.js process.

A critical OS command injection vulnerability in office-converter allows attacker-controlled file names to influence a shell command used during document conversion. When a crafted file name reaches the conversion functions, commands may execute with the privileges of the Node.js process.

Affected context

The vulnerability occurs in office-converter deployments through version 1.0.2 when the generatePdf() or generateHtml() functions accept file names that are not strictly constrained before being incorporated into an unoconv command. Risk depends on whether an attacker can influence the file name and whether the application invokes the conversion functionality with a shell-enabled process execution API.

The vulnerability occurs in office-converter deployments through version 1.0.2 when the generatePdf() or generateHtml() functions accept file names that are not strictly constrained before being incorporated into an unoconv command. Risk depends on whether an attacker can influence the file name and whether the application invokes the conversion functionality with a shell-enabled process execution API.

Exploit preconditions

  • Attack surface: The document conversion API exposed by generatePdf() or generateHtml()
  • Required access: Ability to supply or influence the file name passed to a conversion function
  • Trigger point: Construction and execution of the unoconv command
  • Why exploitation is possible: User-controlled file-name data is concatenated into a shell command and executed through Node.js process privileges without adequate command separation or shell metacharacter handling
  • Attack surface: The document conversion API exposed by generatePdf() or generateHtml()
  • Required access: Ability to supply or influence the file name passed to a conversion function
  • Trigger point: Construction and execution of the unoconv command
  • Why exploitation is possible: User-controlled file-name data is concatenated into a shell command and executed through Node.js process privileges without adequate command separation or shell metacharacter handling

Why this happens

The underlying flaw is OS command injection, mapped to CWE-78. The application treats a file name as ordinary data while embedding it directly into a command string executed by a shell-oriented process API. Because the input is not reliably separated from command syntax or constrained to a safe file-name representation, shell interpretation can cause attacker-controlled expressions to be processed as commands.

The underlying flaw is OS command injection, mapped to CWE-78. The application treats a file name as ordinary data while embedding it directly into a command string executed by a shell-oriented process API. Because the input is not reliably separated from command syntax or constrained to a safe file-name representation, shell interpretation can cause attacker-controlled expressions to be processed as commands.

Potential impact

  • An attacker may execute arbitrary operating-system commands
  • The application process could be compromised with its available privileges
  • Sensitive files, environment variables, or credentials may be exposed
  • The host or container could be used for lateral movement
  • Application data may be modified, deleted, or disrupted
  • An attacker may execute arbitrary operating-system commands
  • The application process could be compromised with its available privileges
  • Sensitive files, environment variables, or credentials may be exposed
  • The host or container could be used for lateral movement
  • Application data may be modified, deleted, or disrupted

General mitigation guidance

Mitigation generally focuses on removing shell interpretation from document conversion workflows and reducing trust in file-name input.

Common defensive patterns include:

  • Prefer direct process-spawn APIs that pass arguments separately rather than constructing shell command strings
  • Apply strict allowlist validation for file names and reject path separators, control characters, and shell syntax
  • Generate server-side temporary names instead of accepting client-controlled names where feasible
  • Use fixed executable paths and constrained argument sets for conversion tools
  • Run conversion workers with least privilege, isolated filesystem access, and limited network permissions
  • Avoid exposing conversion operations without appropriate authorization and resource controls

Mitigation generally focuses on removing shell interpretation from document conversion workflows and reducing trust in file-name input.

Common defensive patterns include:

  • Prefer direct process-spawn APIs that pass arguments separately rather than constructing shell command strings
  • Apply strict allowlist validation for file names and reject path separators, control characters, and shell syntax
  • Generate server-side temporary names instead of accepting client-controlled names where feasible
  • Use fixed executable paths and constrained argument sets for conversion tools
  • Run conversion workers with least privilege, isolated filesystem access, and limited network permissions
  • Avoid exposing conversion operations without appropriate authorization and resource controls

How teams detect issues like this

Organizations can identify this class of issue through:

  • Static analysis rules for string concatenation or interpolation passed to shell-enabled process execution APIs
  • Code review checks for user-controlled file names used in command construction
  • Taint analysis tracing request parameters into exec, shell wrappers, or equivalent APIs
  • Runtime monitoring for unexpected child processes, command interpreters, or unusual conversion-tool arguments
  • Policy enforcement requiring argument-separated process execution and centralized input validation
  • Automated security review tools that flag command construction from untrusted data

Organizations can identify this class of issue through:

  • Static analysis rules for string concatenation or interpolation passed to shell-enabled process execution APIs
  • Code review checks for user-controlled file names used in command construction
  • Taint analysis tracing request parameters into exec, shell wrappers, or equivalent APIs
  • Runtime monitoring for unexpected child processes, command interpreters, or unusual conversion-tool arguments
  • Policy enforcement requiring argument-separated process execution and centralized input validation
  • Automated security review tools that flag command construction from untrusted data

Sources

SourceLink
github.comgithub.com/advisories/GHSA-9p64-h5q4-phpm
github.comgithub.com/vworld4u/office-converter/blob/b1ea855d0001dc7a5d66343698634dbc06b72c2d/index.js#L19-L20
github.comgithub.com/vworld4u/office-converter/pull/9
vulncheck.comvulncheck.com/advisories/office-converter-through-1.0.2-os-command-injection-via-filename-in-generatepdf

Frequently asked

questions

It can be remotely exploitable when a network-accessible application allows an attacker to control the file name supplied to the affected conversion functions. The exact scope depends on how the API is exposed and protected.

An attacker needs a way to invoke the conversion functionality and influence the relevant file-name input. Authentication, authorization, and file-processing controls may limit this access.

Avoid shell-based command construction. Use an argument-separated process API, validate file names with a strict allowlist, and use server-generated temporary paths where possible.

Treat file names and other command arguments as untrusted input, prohibit shell interpretation by default, review process-spawning code, and enforce least privilege for conversion workers.

It can be remotely exploitable when a network-accessible application allows an attacker to control the file name supplied to the affected conversion functions. The exact scope depends on how the API is exposed and protected.

An attacker needs a way to invoke the conversion functionality and influence the relevant file-name input. Authentication, authorization, and file-processing controls may limit this access.

Avoid shell-based command construction. Use an argument-separated process API, validate file names with a strict allowlist, and use server-generated temporary paths where possible.

Treat file names and other command arguments as untrusted input, prohibit shell interpretation by default, review process-spawning code, and enforce least privilege for conversion workers.

Find out what's already
exploitable in your codebase.