/

CVE-2026-31228

Severity:

CRITICAL RISK

(9.8)

Code Injection in ART Kubeflow Robustness Evaluation for

CVE-2026-31228

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The Adversarial Robustness Toolbox (ART) Kubeflow component uses Python's eval() on user-supplied strings for LossFn and Optimizer when evaluating PyTorch model robustness.

A crafted parameter value can inject arbitrary Python code, leading to remote code execution and full compromise of the system running the ART evaluation.

Affected context

This vulnerability occurs in deployments that:

  • Use the Adversarial Robustness Toolbox (ART) up to and including version 1.20.1
  • Run the Kubeflow-based robustness evaluation pipelines for PyTorch models
  • Accept or propagate user-controlled strings for the LossFn and Optimizer parameters

The risk is most pronounced in environments where evaluation jobs are triggered by external users, automated workflows, or shared experimentation platforms that allow arbitrary parameter configuration.

Exploit preconditions

  • Attack surface: ART Kubeflow robustness evaluation interface for PyTorch (e.g., pipeline parameters, job specs, APIs, or UI forms that set LossFn and Optimizer).
  • Required access: Ability to submit or influence robustness evaluation jobs such that attacker-controlled strings are used as LossFn and/or Optimizer values.
  • Trigger point: Execution of the robustness evaluation function that calls eval() on these user-supplied strings.
  • Why exploitation is possible: The implementation directly passes unvalidated, unbounded user input into Python's eval(), which executes arbitrary expressions with the process' full interpreter context and privileges.

Why this happens

The core issue is a classic code injection pattern mapped to CWE-94: Improper Control of Generation of Code ('Code Injection').

Instead of mapping user input to a safe, predefined set of loss functions and optimizers, the ART Kubeflow component dynamically evaluates arbitrary strings via eval() to construct these objects at runtime.

Because eval() treats input as executable Python code, any attacker-controlled parameter becomes part of the program itself, allowing execution of OS commands or arbitrary logic with the same privileges as the ART evaluation process.

The absence of strict whitelisting, sandboxing, or context restriction around eval() enables full interpreter access and makes exploitation straightforward wherever user-controlled input flows into these parameters.

Potential impact

  • Execution of arbitrary Python code in the ART evaluation environment
  • Full compromise of the container, pod, or host running the Kubeflow evaluation job
  • Theft or manipulation of model artifacts, training data, or robustness evaluation results
  • Lateral movement within the Kubeflow or Kubernetes cluster, depending on existing permissions and network configuration
  • Use of the compromised environment as a pivot for broader infrastructure attacks or data exfiltration

General mitigation guidance

Effective mitigation focuses on eliminating dynamic code evaluation and strictly constraining how loss functions and optimizers are selected:

  • Replace eval() with explicit mapping tables (e.g., dictionaries) from allowed string identifiers to known-safe LossFn and Optimizer classes or factory functions.
  • Enforce allowlists for all user-configurable algorithm parameters, rejecting any value not in a predefined set of supported options.
  • Separate configuration from code by treating user input purely as data, never as executable expressions, and avoiding APIs that parse or interpret input as code.
  • Run robustness evaluations with least-privilege runtime settings (restricted filesystem access, limited network connectivity, non-root accounts, and minimal Kubernetes RBAC permissions) to reduce blast radius if a flaw reappears.
  • Introduce defense-in-depth controls such as input length limits and strict type validation to reduce unexpected input forms even when using safe selection mechanisms.

How teams detect issues like this

Detection can rely on both code-centric and operational approaches:

  • Static analysis: Configure rules to flag any usage of eval(), exec(), or similar dynamic execution APIs, especially when fed by untrusted or external data flows.
  • Code review: Treat dynamic code evaluation as a high-risk pattern; reviewers should explicitly verify that configuration-driven behavior uses allowlists or factory mappings rather than evaluating raw strings.
  • Policy enforcement: Adopt secure coding standards that prohibit eval() and require justification and sign-off for any dynamic execution constructs; integrate these checks into CI/CD pipelines.
  • Runtime monitoring: Observe Kubeflow and container logs for unusual Python execution patterns, subprocess invocations, or unexpected network/file access from robustness evaluation jobs that could indicate code injection attempts.

Sources

SourceLink
github.comgithub.com/Trusted-AI/adversarial-robustness-toolbox
notion.sonotion.so/CVE-2026-31228-35d1e1393188817f9ab0dc4b1651dfe9
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-31228
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2476522
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-31228.json

Frequently asked

questions

Yes, if an attacker can remotely submit or influence ART Kubeflow robustness evaluation jobs and control the LossFn or Optimizer parameters, they can inject code without direct access to the underlying host.

The attacker needs the ability to create or modify robustness evaluation requests or pipelines that supply custom LossFn and Optimizer values. This may correspond to a Kubeflow user role, an API client, or any upstream system that feeds those parameters.

Remove eval() entirely and replace it with a strict allowlist-based mapping from user-supplied identifiers to known-safe loss and optimizer implementations. Treat user input as opaque identifiers, not as executable code or expressions.

Avoid dynamic code evaluation APIs for handling configuration, enforce secure coding guidelines that ban eval()/exec(), use static analysis to catch violations, and design ML/AI configuration interfaces around enumerated choices or declarative schemas rather than free-form code strings.

Find out what's already
exploitable in your codebase.