Summary
A command injection vulnerability in the che-machine-exec service allows user-controlled username and namespace values to influence a shell command without adequate escaping. When authentication is disabled and the service is network-reachable, an attacker may execute arbitrary commands in containers the service is configured to access.
A command injection vulnerability in the che-machine-exec service allows user-controlled username and namespace values to influence a shell command without adequate escaping. When authentication is disabled and the service is network-reachable, an attacker may execute arbitrary commands in containers the service is configured to access.
Affected context
The issue may affect deployments where che-machine-exec exposes the /exec/init or /exec/config JSON endpoints and incorporates their username or namespace fields into shell commands. Risk is substantially higher when authentication is disabled, the service is reachable over the network, and its runtime identity can access one or more containers.
The issue may affect deployments where che-machine-exec exposes the /exec/init or /exec/config JSON endpoints and incorporates their username or namespace fields into shell commands. Risk is substantially higher when authentication is disabled, the service is reachable over the network, and its runtime identity can access one or more containers.
Exploit preconditions
- Attack surface: Network-accessible
/exec/initand/exec/configJSON endpoints - Required access: Ability to submit requests when authentication is disabled or otherwise bypassed
- Trigger point: Processing of user-controlled username or namespace values during shell command construction
- Why exploitation is possible: Input is concatenated into a
sh -ccommand without escaping or safe argument handling, allowing shell syntax to alter command execution
- Attack surface: Network-accessible
/exec/initand/exec/configJSON endpoints - Required access: Ability to submit requests when authentication is disabled or otherwise bypassed
- Trigger point: Processing of user-controlled username or namespace values during shell command construction
- Why exploitation is possible: Input is concatenated into a
sh -ccommand without escaping or safe argument handling, allowing shell syntax to alter command execution
Why this happens
The vulnerability results from constructing a shell command by concatenating untrusted request fields into a quoted command string. Double quotes alone do not make shell input safe, because shell interpretation can still recognize command-substitution and other metacharacter behavior.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where externally controlled data reaches a command interpreter without reliable separation between data and executable syntax.
The vulnerability results from constructing a shell command by concatenating untrusted request fields into a quoted command string. Double quotes alone do not make shell input safe, because shell interpretation can still recognize command-substitution and other metacharacter behavior.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where externally controlled data reaches a command interpreter without reliable separation between data and executable syntax.
Potential impact
- Remote execution of arbitrary commands in accessible containers
- Compromise of containerized workloads and their data
- Theft or modification of service credentials and application secrets
- Lateral movement to other reachable services or workloads
- Disruption, data destruction, or unauthorized changes to managed environments
- Remote execution of arbitrary commands in accessible containers
- Compromise of containerized workloads and their data
- Theft or modification of service credentials and application secrets
- Lateral movement to other reachable services or workloads
- Disruption, data destruction, or unauthorized changes to managed environments
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from request-processing paths and reducing the trust placed in endpoint input.
Common defensive patterns include:
- Prefer direct process or container APIs that pass arguments separately instead of invoking
sh -c - Apply strict allowlists and schema validation to username and namespace fields
- Treat all endpoint values as untrusted, regardless of authentication state
- Keep authentication and authorization enabled by default, with explicit policy checks for each operation
- Run the service with the minimum container and host permissions required
- Restrict which containers, namespaces, filesystems, and network destinations the service can access
- Use isolation, read-only settings, and controlled service identities where operationally feasible
Mitigation generally focuses on removing shell interpretation from request-processing paths and reducing the trust placed in endpoint input.
Common defensive patterns include:
- Prefer direct process or container APIs that pass arguments separately instead of invoking
sh -c - Apply strict allowlists and schema validation to username and namespace fields
- Treat all endpoint values as untrusted, regardless of authentication state
- Keep authentication and authorization enabled by default, with explicit policy checks for each operation
- Run the service with the minimum container and host permissions required
- Restrict which containers, namespaces, filesystems, and network destinations the service can access
- Use isolation, read-only settings, and controlled service identities where operationally feasible
How teams detect issues like this
Detection approaches may include:
- Static analysis rules that identify string concatenation or interpolation into shell execution APIs
- Code review checks for
sh -c, shell wrappers, and quoted user-controlled values - Policy enforcement that prohibits shell execution when direct argument-based APIs are available
- Tests using benign metacharacter handling cases to verify that input remains data rather than executable syntax
- Runtime monitoring for unusual command execution, container access, or requests to execution endpoints
- Automated security review tools that flag command construction from HTTP or JSON fields
Detection approaches may include:
- Static analysis rules that identify string concatenation or interpolation into shell execution APIs
- Code review checks for
sh -c, shell wrappers, and quoted user-controlled values - Policy enforcement that prohibits shell execution when direct argument-based APIs are available
- Tests using benign metacharacter handling cases to verify that input remains data rather than executable syntax
- Runtime monitoring for unusual command execution, container access, or requests to execution endpoints
- Automated security review tools that flag command construction from HTTP or JSON fields
Sources
| Source | Link |
|---|---|
| github. | github.com/ |
| gitlab. | gitlab.eclipse.org/ |
| gitlab. | gitlab.eclipse.org/ |

