Skip to main content
Vulnerability Database/CVE-2026-100842

CVE-2026-100842: Project-monai Monai RCE Vulnerability

CVE-2026-100842 is an eval injection vulnerability in Project-monai Monai that enables remote code execution through bundle metadata manipulation. This post covers the technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-100842 Overview

CVE-2026-100842 is an eval injection vulnerability in Medical Open Network for AI (MONAI) versions through 1.6.0. The flaw resides in _get_fake_spatial_shape() within monai/bundle/scripts.py. The function validates shape expressions using an Abstract Syntax Tree (AST) walker that only inspects ast.Name nodes, allowing only p or n, before passing the string to eval(). Expressions built from constants, attributes, subscripts, or calls contain no ast.Name nodes and bypass the allowlist. An attacker who controls bundle metadata reaching the verify_net_in_out CLI flow can escape the eval sandbox via object introspection chains and execute arbitrary code.

Critical Impact

Attackers who influence MONAI bundle metadata can achieve arbitrary code execution through Python object introspection chains in a non-default verification flow.

Affected Products

  • Project-MONAI MONAI versions through 1.6.0
  • monai/bundle/scripts.py module (_get_fake_spatial_shape() function)
  • Bundle verify_net_in_out CLI workflow

Discovery Timeline

  • 2026-09-27 - CVE-2026-100842 published to the National Vulnerability Database
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-100842

Vulnerability Analysis

The vulnerability is classified as [CWE-95] Improper Neutralization of Directives in Dynamically Evaluated Code (Eval Injection). MONAI's _get_fake_spatial_shape() function accepts shape expressions from bundle metadata and evaluates them with Python's eval(). Developers attempted to constrain input by walking the AST and permitting only identifiers named p or n.

The allowlist operates exclusively on ast.Name nodes. Python expressions can perform meaningful computation without any name references by chaining constants with attribute access, subscripts, and calls. Attackers reach built-in types and global namespaces through dunder attributes such as __class__, __bases__, __subclasses__, and __globals__, producing code execution primitives inside the evaluated string.

The shape value originates from bundle metadata consumed by _get_real_input_data and verify_net_in_out. An operator running bundle verification against untrusted bundle content triggers the sink. Exploitation requires local access and user interaction with a crafted bundle, which constrains the attack surface but does not eliminate the risk in shared research and ML operations environments.

Root Cause

The root cause is an incomplete validation routine. The AST walker inspects only one node type (ast.Name) rather than enumerating every node class and rejecting unexpected constructs. Any expression that avoids bare identifiers passes the check unchallenged. Passing attacker-controllable strings to eval() under a partial allowlist is unsafe by design.

Attack Vector

An attacker crafts a MONAI bundle whose metadata contains a shape expression such as (1).__class__.__bases__[0].__subclasses__() or int.__class__.__init__.__globals__. These expressions contain only constants, attribute access, subscripts, and calls, so the AST allowlist accepts them. When a victim invokes the verify_net_in_out CLI flow against the bundle, MONAI passes the expression to eval(), traversing the introspection chain to locate dangerous classes or module globals and achieve code execution in the Python process.

See the Vulncheck Advisory for MONAI for the complete technical breakdown.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-100842

Indicators of Compromise

  • Bundle metadata files containing shape expressions with dunder attributes such as __class__, __bases__, __subclasses__, __globals__, or __builtins__.
  • MONAI processes spawning unexpected child processes (shells, interpreters, network utilities) during verify_net_in_out invocations.
  • Python processes loading unexpected modules such as os, subprocess, or socket during bundle verification.

Detection Strategies

  • Scan MONAI bundle metadata for shape fields containing attribute chains, subscripts, or function calls rather than simple numeric expressions.
  • Monitor command lines invoking the monai.bundle CLI with verify_net_in_out against bundles sourced from untrusted repositories.
  • Alert on Python interpreters running under MONAI contexts that execute os.system, subprocess.Popen, or network syscalls uncharacteristic of normal inference workloads.

Monitoring Recommendations

  • Collect process-execution and file-access telemetry from workstations and servers used for MONAI bundle verification.
  • Audit bundle download sources and track provenance of bundles consumed in verification pipelines.
  • Capture stderr and stdout from MONAI CLI invocations and forward to a central log store for anomaly review.

How to Mitigate CVE-2026-100842

Immediate Actions Required

  • Avoid running verify_net_in_out against bundles originating from untrusted sources until a patched release is installed.
  • Inventory hosts and container images running MONAI 1.6.0 or earlier and restrict their ability to consume external bundles.
  • Execute bundle verification inside isolated sandboxes or ephemeral containers with no network egress and minimal filesystem access.

Patch Information

Refer to the GitHub Security Advisory GHSA-h89g-r5pc-wxfm for upstream remediation guidance and fixed version information from the Project-MONAI maintainers.

Workarounds

  • Treat all third-party MONAI bundles as untrusted code and review metadata before verification.
  • Run MONAI tooling under a dedicated low-privilege user account that cannot modify production assets.
  • Apply operating-system allowlisting to prevent Python processes spawned by MONAI from launching shells or arbitrary binaries.
bash
# Configuration example: run MONAI bundle verification in an isolated container
docker run --rm \
  --network=none \
  --read-only \
  --user 65534:65534 \
  -v "$(pwd)/bundle:/bundle:ro" \
  projectmonai/monai:latest \
  python -m monai.bundle verify_net_in_out /bundle

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.