Summary
Evolver's _extractLLM() function constructs a curl command via string concatenation and passes it directly to execSync() without sanitizing user-controlled input.
When the corpus parameter includes shell metacharacters, an attacker can inject arbitrary OS commands that execute with the server's privileges, leading to full remote code execution.
Affected context
This vulnerability appears in Evolver deployments that invoke the _extractLLM() function with a corpus parameter that can be influenced directly or indirectly by an external party.
It is especially relevant where:
- corpus values come from HTTP requests, job definitions, or configuration files not fully controlled by trusted operators
- the server process has network access or sensitive file/system privileges
- shell commands are executed using execSync() (or equivalent) built from raw string concatenation
In such contexts, untrusted corpus data can cross the trust boundary into a shell command, creating an injection sink.
Exploit preconditions
- Attack surface: Application interfaces (e.g., HTTP APIs, task queues, or configuration paths) that ultimately pass attacker-controlled data into the corpus parameter of _extractLLM().
- Required access: Ability to supply or modify corpus content reaching the vulnerable function (often remote and unauthenticated if the API is exposed without strong access controls).
- Trigger point: Invocation of _extractLLM(), which constructs and executes a curl command via execSync() using the unvalidated corpus value.
- Why exploitation is possible: The shell command is composed through naive string concatenation and executed by the system shell, allowing shell metacharacters in corpus (such as
;,|,&&, backticks, or command substitutions) to break out of the intended curl call and execute arbitrary additional commands.
Why this happens
The underlying flaw is a classic OS command injection pattern, mapped to CWE-78.
Instead of treating user-influenced input as inert data, the _extractLLM() function embeds the corpus parameter directly into a shell command string that is passed to execSync().
Shells interpret special characters and control operators, so any unescaped, unvalidated data can alter the command structure.
This design combines:
- dynamic string building of shell commands, and
- execution through an interface that invokes a real shell,
which together create a powerful injection sink whenever external input can reach the corpus parameter.
Potential impact
- Execution of arbitrary shell commands with the permissions of the Evolver server process
- Reading, modifying, or deleting local files accessible to the service account
- Installing backdoors or malware, enabling persistent server compromise
- Exfiltration of model data, API keys, and other secrets from configuration or environment variables
- Lateral movement to other internal systems reachable from the compromised host
- Service disruption, including forced crashes, data corruption, or resource exhaustion
General mitigation guidance
Effective mitigation centers on eliminating direct shell interpretation of untrusted data and applying strict separation between code and data.
General defensive patterns include:
- Replacing shell-based invocation with safe, parameterized process spawning APIs (e.g., execFile/spawn with argument arrays instead of full shell command strings).
- Treating all externally influenced input (including corpus) as untrusted and validating it rigorously against a strict allowlist of expected formats and characters.
- Avoiding concatenation of dynamic input into command lines; where shell usage is unavoidable, applying robust escaping and quoting routines and still performing validation.
- Applying least privilege to the service account running Evolver, reducing file system and network permissions so a successful injection yields minimal access.
- Segmenting the environment so that the process executing external commands is isolated (e.g., containers, restricted namespaces, or chroot-like sandboxes).
These patterns help ensure that even if user input is mishandled, it cannot be interpreted as executable shell syntax.
How teams detect issues like this
Potential detection strategies include:
- Static analysis: Rules that flag use of execSync(), exec(), or similar shell-invoking APIs when arguments are built via string concatenation using external or tainted data. Tools can track data flow from request parameters or configuration into command execution sinks.
- Code review checks: Security-focused reviews that look for:
- shell command construction with
+operators or template literals containing variables - absence of input validation or escaping on parameters injected into command strings
- reliance on generic shell interpreters instead of parameterized process APIs.
- Runtime monitoring: Command-logging and anomaly detection on production systems, watching for unusual command patterns, unexpected arguments, or outbound network calls initiated by the Evolver process.
- Policy enforcement: CI/CD gates that fail builds when banned APIs (like direct execSync with dynamic strings) are introduced, supported by organization-wide secure coding guidelines around command execution.

