/

CVE-2025-63705

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in npm node-ts-ocr package

CVE-2025-63705

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(8.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

The node-ts-ocr 1.0.15 package contains an OS command injection vulnerability in its invokeImageOcr function. If attacker-controlled data reaches the function without adequate validation, an attacker may cause unintended operating system commands to execute with the application's privileges.

Affected context

The vulnerability occurs in applications that use node-ts-ocr 1.0.15 and expose the invokeImageOcr function to data that is not fully trusted. Risk depends on whether image-processing inputs, file paths, or related arguments can be influenced by external users or other compromised components before they are incorporated into an operating-system command.

Exploit preconditions

  • Attack surface: The application's use of the node-ts-ocr invokeImageOcr function
  • Required access: Ability to influence one or more values passed to the function, directly or through an exposed application workflow
  • Trigger point: Construction or execution of the operating-system command used for OCR processing
  • Why exploitation is possible: Insufficient separation between data and command syntax may allow crafted input to alter the command executed by the host

Why this happens

The underlying bug is the unsafe construction or invocation of an operating-system command using data that may be controlled by an attacker. When input is concatenated into a shell command or passed through an unsafe execution path without strict validation and argument separation, command syntax can be interpreted as executable instructions. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute arbitrary commands with the application's operating-system privileges.
  • Sensitive files, environment variables, or credentials could be accessed.
  • The application or host could be modified, disrupted, or used for further compromise.
  • Downstream systems and data could be affected if the process has network or service permissions.

General mitigation guidance

Mitigation generally focuses on removing shell interpretation and reducing trust in values supplied to command-execution APIs.

Common defensive patterns include:

  • Prefer library or native APIs for OCR processing instead of invoking a shell.
  • Use execution interfaces that pass a fixed executable and separate argument arrays.
  • Apply strict allowlist validation to file paths, formats, and other input values.
  • Avoid deriving executable names, flags, or command fragments from external input.
  • Run OCR processing with least-privilege operating-system and filesystem permissions.
  • Isolate processing workloads and restrict their network access where practical.

How teams detect issues like this

Organizations commonly look for command-injection risks through:

  • Static analysis rules for shell execution APIs, string concatenation, and template interpolation near process-spawning code.
  • Code review checks for user-controlled values passed to child_process, shell wrappers, or command-building helpers.
  • Runtime monitoring for unexpected child processes, shell interpreters, or unusual command arguments originating from the OCR service.
  • Dependency and policy checks that flag vulnerable package versions and prohibit unsafe command execution patterns.

Automated security review tools can help identify likely data flows from request or file inputs into process execution.

Sources

SourceLink
gist.github.comgist.github.com/6en6ar/a2ac44da0f4e580190be3e66cfbb9a4a
npmjs.comnpmjs.com/package/node-ts-ocr

Frequently asked

questions

Exploitability depends on how the package is integrated. It may be remotely exploitable when an internet-facing workflow allows external input to reach invokeImageOcr without effective validation.

The attacker generally needs a way to influence an input consumed by the vulnerable function. This could occur through an application request, uploaded file metadata, or another connected data source.

Avoid shell-based command construction, use fixed executables with separately passed arguments, and strictly validate values that must reach the OCR process.

Minimize operating-system command execution, enforce input trust boundaries, apply least privilege, and use static analysis and dependency policies during development.

Find out what's already
exploitable in your codebase.