Summary
A command-line argument injection flaw in ART's Kubeflow evaluation script allows arbitrary Python code execution via the --clip_values and --input_shape parameters.
When an attacker can influence these arguments through pipeline configuration or automation, the use of eval() on untrusted strings can lead to full code execution on the host running the robustness evaluation.
Affected context
This vulnerability arises in environments where ART's Kubeflow component uses the robustness_evaluation_fgsm_pytorch.py script as part of machine learning evaluation pipelines.
It is most relevant when command-line parameters are sourced from external configuration, pipeline orchestration systems, or automated scripts that may be modified or influenced by users or other services.
The risk increases in shared or multi-tenant ML platforms, CI/CD setups, or automated evaluation workflows where argument values are constructed dynamically without strict validation or sanitization.
Exploit preconditions
- Attack surface: CLI invocation of robustness_evaluation_fgsm_pytorch.py within Kubeflow or similar pipeline contexts
- Required access: Ability to control or modify values passed to --clip_values and/or --input_shape (e.g., pipeline spec, config files, job parameters, or automation scripts)
- Trigger point: Script startup when it parses these arguments and calls eval() on the provided string values
- Why exploitation is possible: The script directly evaluates attacker-controlled strings as Python expressions, enabling arbitrary code execution instead of constrained argument parsing
Why this happens
The core issue is the use of eval() to interpret command-line argument values, treating unvalidated user input as executable Python code.
This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where data intended to configure behavior is instead executed, and to CWE-88: Argument Injection or Modification, since the malicious payload is delivered through command-line arguments.
Conceptually, the script blurs the boundary between configuration and code: it assumes argument values are safe expressions, allowing an attacker to embed function calls, imports, or other logic that runs with the script's privileges.
Potential impact
- Arbitrary Python code execution in the context of the ART evaluation environment
- Reading, modifying, or deleting local files accessible to the evaluation process
- Exfiltration of ML models, training data, or pipeline secrets
- Installation of backdoors or persistence mechanisms on the host
- Lateral movement to other services reachable from the compromised environment
General mitigation guidance
Mitigation centers on eliminating dynamic code evaluation for configuration inputs and enforcing strict parsing of arguments.
Recommended design patterns include:
- Replace eval() with structured parsing (e.g., literal_eval, dedicated argument types, or custom parsing functions that treat input as data, not code)
- Define explicit schemas and expected types for command-line arguments and validate against them before use
- Treat pipeline configuration and CLI parameters as untrusted inputs, even when produced by automation, and sanitize or normalize values accordingly
- Run evaluation components with least privilege, limiting filesystem access, network reachability, and available credentials so that any compromise has constrained impact
- Prefer secure-by-default argument handling APIs that prevent arbitrary expression evaluation and avoid reflection-based shortcuts in production scripts
How teams detect issues like this
Effective detection relies on combining static analysis, code review, and configuration governance:
- Use static analysis rules to flag eval(), exec(), and similar dynamic execution constructs, especially in argument-parsing or configuration-handling code paths
- During code review, treat any use of generic evaluation or reflection in CLI scripts as a high-risk pattern and require explicit justification or refactoring
- Implement security policies in CI/CD that block merges when dangerous APIs appear in new or modified code, or when argument parsing bypasses validation
- Review pipeline and Kubeflow configurations for user-controllable parameters that are later transformed into code or expressions
- Employ automated configuration scanning to detect suspicious payloads or anomalous argument values in stored pipeline specs and job templates

