Summary
Yamcs versions prior to 5.12.7 construct a Nashorn ScriptEngine without a ClassFilter, allowing user-supplied JavaScript algorithms to directly access arbitrary Java classes.
An attacker who can override mission database algorithms can execute arbitrary OS commands as the Yamcs process; in default configurations where the guest user is a superuser, this can be done without authentication.
Affected context
The vulnerability appears in Yamcs deployments that:
- Use the Java-based Nashorn ScriptEngine for algorithm evaluation
- Allow algorithm text to be edited through the
MdbOverrideApi.updateAlgorithmendpoint - Construct the ScriptEngine without a restrictive ClassFilter or equivalent sandboxing
- Run the Yamcs process with sufficient OS-level privileges to make command execution meaningful
In default configurations lacking a security.yaml, the built-in guest user is configured as a superuser, which effectively exposes this functionality without authentication.
Exploit preconditions
- Attack surface: HTTP API, specifically the mission database override API (
MdbOverrideApi.updateAlgorithm) - Required access:
- Any user account with
ChangeMissionDatabaseprivilege; or - In default setups without explicit security configuration, unauthenticated access as the
guestuser withsuperuser=true - Trigger point: Uploading or modifying an algorithm definition containing malicious JavaScript that the Nashorn engine evaluates at runtime
- Why exploitation is possible: The Nashorn ScriptEngine is instantiated without a
ClassFilter, so user-controlled script code can callJava.type()and similar mechanisms to reach arbitrary Java classes, including those that provide process execution capabilities.
Why this happens
The core issue is the execution of user-controllable script code in an unsandboxed interpreter context.
Yamcs uses Nashorn to evaluate algorithm logic, but the ScriptEngine is created without a ClassFilter or comparable restriction, directly violating secure scripting principles.
This maps to CWE-94: Improper Control of Generation of Code, because attacker-supplied JavaScript is treated as trusted code and executed with full access to the host JVM.
The absence of sandboxing also aligns with CWE-95 (Improper Neutralization of Directives in Dynamically Evaluated Code) and CWE-470 (Use of Externally-Controlled Input to Select Classes or Code), as the script can dynamically select and invoke powerful Java classes such as java.lang.Runtime.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Yamcs process
- Full compromise of the mission control application and its configuration
- Access to or manipulation of mission data and telemetry streams
- Use of the Yamcs server as a pivot point for lateral movement inside the network
- Deployment of persistent backdoors or malware on the underlying host system
General mitigation guidance
Effective mitigation focuses on eliminating unsandboxed script execution and tightening privilege boundaries:
- Prefer non-scripted, declarative algorithms or precompiled code paths where feasible, to avoid runtime evaluation of user-provided scripts.
- When scripting is required, instantiate script engines with strong sandboxing:
- Apply
ClassFilteror equivalent mechanisms to block access to sensitive Java packages and classes. - Disable or severely restrict APIs like
Java.type()that bridge into arbitrary JVM classes. - Restrict who can modify mission database algorithms by applying least-privilege principles and separating administrative and operational roles.
- Treat algorithm text as untrusted input and validate it against allowlists of permitted functions and APIs.
- Run the Yamcs service under a dedicated OS account with minimal filesystem and process privileges to reduce the blast radius of potential code execution.
How teams detect issues like this
Organizations can detect this class of weakness and its potential exploitation by:
- Reviewing code paths that create script engines and checking for:
- Missing or permissive
ClassFilterimplementations - Unrestricted use of
eval, dynamically evaluated scripts, or host interop features (e.g.,Java.type()). - Applying static analysis rules that flag:
- Instantiation of
ScriptEngine(Nashorn or other engines) without sandboxing controls - Script execution methods where the source code originates from HTTP parameters, configuration overrides, or user-editable fields.
- Incorporating secure coding checklists in code review that require:
- Justification and documentation for each use of dynamic code evaluation
- Explicit mention of sandbox boundaries and permitted APIs for scripts.
- Monitoring runtime logs and telemetry for suspicious algorithm changes and script content patterns, such as references to
java.lang.Runtime,ProcessBuilder, or other high-risk classes. - Using automated SAST/IAST tools that understand Java and common script engines to surface dynamic code evaluation hotspots in CI pipelines.

