Summary
A server-side code injection flaw in the Yamcs Java expression algorithm engine allowed dynamically compiled user-controlled algorithm text to execute with full server privileges.
An authenticated user with mission database editing rights could replace algorithm definitions via the REST API and inject arbitrary Java code, leading to remote code execution on the host.
Affected context
This vulnerability appears in Yamcs deployments that:
- Enable the Java expression-based algorithm execution engine (
JavaExprAlgorithmExecutionFactory) - Allow authenticated users to modify mission database algorithms through the REST API
- Compile and execute supplied algorithm text on the server without sandboxing or strict restrictions
It is most relevant in environments where mission database editing privileges are granted to operators, integrators, or automation services.
Exploit preconditions
- Attack surface: Yamcs mission database REST API for algorithm management
- Required access: Authenticated account with the
ChangeMissionDatabaseor equivalent algorithm-editing privilege - Trigger point: Updating or overriding an existing algorithm's expression text so that it is recompiled and evaluated by the Java expression engine
- Why exploitation is possible: The engine passes user-controlled algorithm text directly into the Janino compiler and executes the resulting bytecode without a security manager, sandbox, or restrictive execution policy, allowing use of sensitive Java APIs.
Why this happens
The core issue is direct evaluation of user-controlled code within the server process, mapping to CWE-94: Improper Control of Generation of Code.
The algorithm execution factory uses Janino to compile and run Java expressions derived from mission database entries; these expressions are treated as trusted code even when supplied or edited by users with operational privileges.
Without sandboxing, whitelisting, or restriction of accessible classes and methods, the compiled code can invoke arbitrary Java APIs (for example, process execution, file I/O, or networking), effectively turning algorithm configuration into an execution primitive.
Potential impact
- Remote execution of arbitrary commands on the underlying operating system
- Reading, modifying, or deleting mission data and configuration stored on the server
- Pivoting to other internal services or infrastructure reachable from the Yamcs host
- Disruption of mission control operations by altering or disabling critical algorithms
- Planting backdoors or persistence mechanisms within the application environment
General mitigation guidance
Effective mitigation focuses on reducing trust in dynamically provided algorithm logic and constraining its execution environment:
- Replace general-purpose code execution with a restricted, domain-specific expression language that cannot access arbitrary Java classes or the filesystem.
- Enforce strict whitelists of callable functions, classes, and packages when compiling user-supplied expressions, and deny access to system-level APIs such as
java.lang.Runtimeand reflection. - Run algorithm evaluation in a hardened sandbox or separate process with minimal privileges, isolating it from the core server.
- Apply least-privilege principles to mission database editing roles, granting algorithm modification rights only where strictly necessary.
- Introduce configuration controls so that dynamic algorithm editing is disabled by default and must be consciously enabled under controlled conditions.
How teams detect issues like this
Potential detection and assurance approaches include:
- Static analysis and manual code review to flag any use of dynamic compilers, interpreters, or reflection acting on user-controlled inputs.
- Security review checklists that explicitly question whether configuration-driven logic is being compiled or evaluated as code.
- Runtime monitoring of algorithm updates via the mission database API, with alerting on unusual or high-risk changes (for example, expressions referencing
java.langor other sensitive packages). - Policy-based controls in CI/CD pipelines that prevent introduction of new dynamic evaluation paths without formal security approval.
- Use of automated security testing tools to attempt injection of benign test payloads into algorithm fields and observe execution behavior in non-production environments.

