Summary
elecV2 elecV2P up to version 3.8.3 contains an OS command injection vulnerability in the /rpc pm2run function, allowing user-supplied data to be incorporated into system-level commands.
A remote attacker who can reach this endpoint may execute arbitrary commands on the host running elecV2P, leading to full compromise of the underlying system or container.
Affected context
The vulnerability exists in deployments of elecV2P (up to 3.8.3) that expose the /rpc interface where pm2run is reachable over a network.
It typically arises when user-controlled or remotely supplied parameters are passed into OS-level process control logic (e.g., pm2 or shell commands) without sufficient validation, sanitization, or argument handling.
Any environment where elecV2P has elevated privileges or broad filesystem/network access increases the risk and potential blast radius.
Exploit preconditions
- Attack surface: Network-accessible /rpc endpoint exposing pm2run functionality.
- Required access: Ability to send crafted HTTP (or RPC) requests to the vulnerable endpoint; authentication requirements, if present, may limit who can trigger the flaw but do not inherently prevent exploitation.
- Trigger point: Invocation of the pm2run function with attacker-controlled input that is subsequently used to construct or invoke OS commands.
- Why exploitation is possible: Input parameters are incorporated into command strings or process invocation arguments without robust validation, escaping, or use of safe APIs, enabling an attacker to inject additional command fragments.
Why this happens
This vulnerability stems from constructing OS commands using untrusted input, then executing them via shell- or system-level APIs.
Instead of treating user data as opaque arguments, the pm2run logic appears to concatenate or interpolate request parameters into command lines, falling into the pattern described by CWE-78 (Improper Neutralization of Special Elements used in an OS Command).
When applications rely on shell parsing, metacharacters and control operators (such as separators, pipes, or redirection symbols) can alter command behavior, allowing execution of unintended operations.
The underlying bug class is the failure to enforce strict separation between command logic and user data, and to avoid shell interpretation when interacting with the operating system.
Potential impact
- Remote execution of arbitrary OS commands under the privileges of the elecV2P process.
- Reading, modifying, or deleting application and system files accessible to the service account.
- Pivoting to other systems via the compromised host's network connectivity.
- Installing backdoors, cryptominers, or other persistent malware.
- Disrupting service availability through process manipulation or resource exhaustion.
General mitigation guidance
Effective mitigation focuses on eliminating command injection paths and narrowing trust boundaries around process control:
- Refactor code to use parameterized, non-shell process execution APIs (e.g., explicit argument arrays) instead of building command strings.
- Restrict and validate all parameters that influence OS-level actions, using strict whitelisting of allowed values and rejecting unexpected input.
- Implement a fixed set of allowed operations for pm2run (or equivalent), avoiding free-form command specification by clients.
- Run elecV2P with the least privileges necessary, using confined service accounts, containers, or sandboxes to limit the impact of a compromise.
- Limit network exposure of the /rpc endpoint through authentication, access control lists, and reverse proxies so that only trusted callers can reach the interface.
How teams detect issues like this
Detection commonly involves both code-centric analysis and runtime monitoring:
- Static analysis: Configure SAST or linters to flag uses of shell-invoking APIs (e.g.,
exec,spawnwith shell, or similar system calls) that incorporate request parameters, especially in /rpc and pm2run-related code paths. - Code review: Examine the pm2run implementation and related routing logic for string concatenation or template-based command construction, and verify that all inputs are strictly validated and not passed through a shell.
- Policy enforcement: Enforce internal coding standards that prohibit shell command construction from user-controlled data, and add pre-merge checks for violations.
- Runtime monitoring: Analyze process invocation logs and command histories for anomalous arguments, unexpected utilities being launched, or patterns indicative of command chaining.

