/

CVE-2026-36044

Severity:

HIGH RISK

(8.8)

OS Command Injection in @pensar/apex smart_enumerate Tool

CVE-2026-36044

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution / OS 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

@pensar/apex versions up to and including 0.0.58 contain an OS command injection vulnerability in the smart_enumerate tool, where shell commands are built by concatenating unsanitized user-controllable values.

Attackers who can influence the extensions array or url parameter can inject shell metacharacters that are interpreted by child_process.exec(), leading to arbitrary command execution with the privileges of the running Node.js process.

Affected context

This vulnerability occurs in Node.js applications that integrate the @pensar/apex package at version 0.0.58 or earlier and use the smart_enumerate tool created by createSmartEnumerateTool().

The issue is present when:

  • The application calls smart_enumerate in response to external input, and
  • The extensions array and/or url parameter can be influenced directly or indirectly by untrusted sources (e.g., HTTP requests, API parameters, or configuration controlled by users),
  • The environment permits child_process.exec() to spawn a shell with sufficient privileges to impact the system or adjacent resources.

Exploit preconditions

  • Attack surface: Any API, CLI entry point, or internal integration that passes attacker-controlled data into smart_enumerate (and thus extensions or url).
  • Required access: Ability to supply or modify extensions and/or url values, such as via HTTP query parameters, JSON bodies, user configuration, or upstream microservices.
  • Trigger point: Invocation of createSmartEnumerateTool() and subsequent execution of the constructed shell command via child_process.exec().
  • Why exploitation is possible: The code assembles a shell command string by direct concatenation of unvalidated parameters and executes it using exec(), which invokes a system shell. Shell metacharacters embedded in the input are interpreted by the shell, enabling command chaining, argument injection, or full command replacement.

Why this happens

The underlying bug class is classic OS command injection.

The createSmartEnumerateTool() function constructs a command line by directly interpolating values from the extensions array and url parameter into a single string that is passed to child_process.exec().

Because exec() runs the command through the system shell, any special characters (such as separators, redirection operators, or command substitution syntax) in these values are treated as additional shell syntax rather than data.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where untrusted input is insufficiently sanitized before being used to construct a command executed by the operating system.

Potential impact

  • Arbitrary OS command execution with the permissions of the Node.js process
  • Reading, modifying, or deleting application data and configuration accessible to the process
  • Installing backdoors, web shells, or persistence mechanisms on the host
  • Pivoting to other internal services or databases reachable from the compromised host
  • Exfiltration of environment variables, including secrets such as API keys and database credentials
  • Service disruption, resource exhaustion, or full application downtime via destructive commands

General mitigation guidance

Effective mitigation focuses on eliminating direct string-based command construction and minimizing shell exposure:

  • Prefer non-shell APIs: Use child_process.execFile(), spawn() with argument arrays, or higher-level libraries that treat each argument as data rather than shell syntax.
  • Apply strict input validation and normalization to extensions and url, enforcing well-defined formats (e.g., whitelisting allowed characters, domains, and file extensions).
  • Use parameterization-like patterns for command arguments, avoiding ad hoc concatenation of user input into command strings.
  • Restrict the capabilities and privileges of the Node.js process using OS-level controls (e.g., least-privilege accounts, constrained containers, reduced file system access).
  • Where shell usage is unavoidable, employ robust escaping routines and limit commands to a minimal, audited set, though redesigning to avoid the shell is generally safer.

How teams detect issues like this

Detection typically combines code-centric and operational approaches:

  • Static analysis rules that flag uses of child_process.exec() (and similar APIs) when arguments are derived from variables or parameters that trace back to request inputs or configuration.
  • Code reviews focusing on:
  • Any use of string concatenation or template literals to form shell commands,
  • Flows where HTTP request data, configuration fields, or database values feed directly into process execution APIs.
  • Secure coding policies that discourage or ban shell-based command execution in application logic, or require explicit security review for such usage.
  • Runtime monitoring and logging to detect anomalous command patterns, unexpected binaries being invoked, or unusual arguments, integrated with alerting systems.
  • Use of automated code scanning tools integrated in CI pipelines to catch OS command injection patterns before deployment.

Sources

SourceLink
gist.github.comgist.github.com/NucleiAv/47e87da08b90ef464fd9b35affe578fb
github.comgithub.com/pensarai/apex/security
npmjs.comnpmjs.com/package/@pensar/apex

Frequently asked

questions

It can be, depending on how the application exposes smart_enumerate. If external users can influence the extensions or url fields (for example via web APIs or configuration panels), an attacker may exploit the vulnerability remotely.

The attacker needs the ability to control or significantly influence the values that populate the extensions array or url parameter. This might be unauthenticated or authenticated access, depending on how the application is designed and which endpoints are protected.

The safest pattern is to refactor the implementation to avoid shell invocation entirely by using argument-based process execution APIs (like execFile or spawn with arrays) and to pass user-controlled values strictly as separate arguments rather than within a shell command string. This should be combined with strict validation of all inputs that can affect command execution.

Adopt secure coding guidelines that prohibit building shell commands from user input, enforce mandatory code review for any process execution logic, and integrate static analysis or SAST tools configured to highlight dangerous uses of child_process.exec() or equivalent APIs. Consistently validate and constrain all untrusted input before it reaches sensitive sinks such as command execution.

Find out what's already
exploitable in your codebase.