Summary
A critical code injection vulnerability in Yamcs allows attacker-controlled LIKE patterns to be inserted into Java source code that is compiled by the server. If a user can submit SQL, event, table, or activity searches through an exposed API with the relevant read permissions, crafted pattern data may execute code with the privileges of the Yamcs server process.
Affected context
The vulnerability occurs in Yamcs archive and activity-search functionality when a LIKE expression is transformed into Java source for runtime compilation. It may affect deployments that expose SQL, stream SQL, table-row, event, or activity search APIs to users who have permissions such as ReadTables, ReadEvents, or ReadActivities. Risk depends on API exposure, authorization policy, and the privileges assigned to the Yamcs server process.
Exploit preconditions
- Attack surface: Yamcs archive, stream SQL, table-row, event, or activity-search endpoints
- Required access: Permission to submit or influence a query or search pattern through an exposed API
- Trigger point: Evaluation of a LIKE expression during compiled expression generation
- Why exploitation is possible: The LIKE pattern is inserted into generated Java source without escaping, allowing source syntax to be interpreted during compilation
Why this happens
The underlying bug is failure to apply Java string escaping before embedding a user-influenced LIKE pattern into dynamically compiled source code. Instead of treating the pattern strictly as data, the expression-building logic passes it to a compiler as part of Java source text. This behavior maps to CWE-94: Improper Control of Generation of Code, because untrusted input can alter generated code and cause execution in the server process.
Potential impact
- Arbitrary code may execute with the privileges of the Yamcs server
- Sensitive mission-control data may be disclosed or modified
- Accounts, credentials, or configuration data accessible to the process could be compromised
- The Yamcs instance may be disrupted or used for lateral movement
- Operational integrity and mission workflows could be affected
General mitigation guidance
Mitigation centers on preventing user-controlled data from becoming executable source code.
Common defensive patterns include:
- Escaping or parameterizing all values before they enter generated expressions
- Replacing dynamic source compilation with an interpreter, validated query model, or allowlisted expression engine
- Enforcing strict authorization and least privilege for archive and activity-search APIs
- Limiting the Yamcs process account, filesystem access, network reachability, and secret exposure
- Treating query patterns as data throughout parsing, validation, logging, and execution
- Applying vendor-provided security fixes through the organization's normal patch-management process
How teams detect issues like this
Detection may include static analysis for concatenation of user-controlled values into Java source, compiler inputs, or expression templates. Code review should flag dynamic compilation, string-based query construction, missing escaping helpers, and authorization paths that expose search patterns. Runtime monitoring can look for unexpected compiler activity, anomalous archive queries, unusual child processes, and Yamcs processes accessing sensitive files or network destinations. CI policies can require approved parameterization or escaping utilities for generated expressions, with automated review tools used as an additional signal.

