Automated Threat Modeling

Brief Summary: MONAI Label CVE-2026-133968 Path Traversal to Remote Code Execution, Exploited by AI Agents

A brief summary of CVE-2026-133968, a CVSS 9.8 path traversal in MONAI Label through 0.8.5 that allows arbitrary file writes and remote code execution via PUT /datastore/image, exploited in the wild since September 2026. Covers root cause, the upstream fix in PR 1915, and detection guidance.

CVE Analysis

10 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-20

Brief Summary: MONAI Label CVE-2026-133968 Path Traversal to Remote Code Execution, Exploited by AI Agents

Introduction

Operators using autonomous AI agents found a path traversal flaw in MONAI Label, went from mapping its API to writing arbitrary files in about 11 minutes, and eventually ran a Python reverse shell as root on a university server. The bug, CVE-2026-133968 (CVSS 3.1 score 9.8), has been exploited in the wild since September 2026. At the time of writing, the fix exists only on the project's main branch and has not shipped in a packaged release.

MONAI Label is an open-source, server-side medical imaging annotation tool that uses AI and active learning, with integrations for 3D Slicer, OHIF, MITK, QuPath, Digital Slide Archive, CVAT and DICOMWeb. It belongs to Project MONAI, a community-led effort maintained by researchers and engineers at NVIDIA, NIH, King's College London, Mayo Clinic, MSKCC, Stanford, DKFZ and more than 30 other institutions. The reviewed sources give no deployment counts or market share, but the tool's place in academic medical imaging research is the context for the reported campaign against universities.

Technical information

Root cause

The vulnerable entry point is the image parameter of PUT /datastore/image. According to the maintainers' advisory (GHSA-qc22-rmgc-vg94), LocalDatastore.add_image() appends the uploaded file's extension to the caller-supplied image ID, joins it to the datastore image directory, and copies the upload there with shutil.copy(). The resolved path is never checked to be inside the datastore. The advisory's example value is ../../../tmp/x.

The code already normalized the path. Before the patch, add_image() called os.path.realpath() on image_path + image_id + ext. That turned a traversal string into a clean absolute path, but nothing afterwards verified that the result was still under the datastore. Normalization without a boundary check gives you a tidy path to the wrong place.

The pre-patch image write sink looked like this:

dest = os.path.realpath(os.path.join(self._datastore.image_path(), name))

The label upload path, PUT /datastore/label, handled by LocalDatastore.save_label(), had the same problem and did not canonicalize at all. It built its destination from two attacker-influenced values, the label tag and the image ID:

label_path = self._datastore.label_path(label_tag) name = self._filename(image_id, label_ext) dest = os.path.join(label_path, name)

The result is an arbitrary file write to any location the MONAI Label process can write to. The advisory notes this may enable remote code execution or denial of service, and names .ssh/authorized_keys entries, cron files, and overwritten application code or configuration as likely targets.

The CVE record classifies the issue as CWE-24 (path traversal using ../filedir), while the project advisory maps it to CWE-22. Both describe traversal beyond a restricted directory. The published CVSS vector is CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H; NVD notes it has not yet supplied its own assessment.

Why authentication does not fully close the gap

Authentication is off by default (MONAI_LABEL_AUTH_ENABLE=False), so in many deployments the endpoint is reachable by unauthenticated clients. When authentication is enabled, an account with the ANNOTATOR role is sufficient to reach the upload endpoints, which is why the advisory specifically recommends withholding that role from untrusted users.

Attack flow observed in the wild

The Register's reporting and Amazon Threat Intelligence describe the chain the Cairn agents used:

  1. Fingerprint the MONAI Label framework and map its API endpoints.
  2. Identify the upload endpoint's filename parameter and test it for path traversal. The agents reached arbitrary file write about 11 minutes after starting API mapping.
  3. Use the traversal to write a Python reverse shell payload into sitecustomize.py, a file Python imports automatically every time the interpreter starts.
  4. Call a training API endpoint so MONAI Label spawns a new Python process.
  5. The new process imports the planted sitecustomize.py, and the payload opens a reverse shell running as root.

Root execution is not a guaranteed outcome for every deployment. In this case it reflects a service running with root privileges.

Campaign context

The CVE record states exploitation in the wild began in September 2026. According to The Register's account of Amazon's findings, a campaign targeting universities in East Asia outside Mainland China began on September 8, and Amazon located a publicly hosted Cairn server associated with it on September 10. The agents adapted for nearly a full day without human direction, though a human operator later supplied a proxy, tunneled through another vulnerable MONAI Label server, to reach a second university network. Amazon CISO CJ Moses characterized the operators as suspected Chinese spies, citing Simplified Chinese prompts and script timestamps set to China Standard Time. No specific threat group was named, and these are reported indicators rather than conclusive attribution. Amazon notified the MONAI Label maintainers, who produced the fix and advisory.

Patch information

The upstream fix is Project-MONAI/MONAILabel pull request #1915, titled "fix: confine datastore write paths". It was merged into main on October 19, 2026 as merge commit 113527bf638585ee5de6a1839b985829331ea272. Both NVD and the advisory point to this PR.

There is no packaged release with the fix yet. The advisory lists the vulnerable range as <= 0.8.5 with no patched version and says the fix "will be included in the next MONAI Label release." The GitHub releases list still shows 0.8.5 as the newest tag, and the reviewed changelog does not identify a release containing the fix. For now, the fix exists only in source on main.

Layer 1: containment in the datastore (monailabel/datastore/local.py)

A new helper resolves both the destination and the allowed base, then requires the destination to sit inside the base:

@staticmethod def _confine_path(dest: str, allowed_base: str) -> str: dest = os.path.realpath(dest) allowed_base = os.path.realpath(allowed_base) try: inside = os.path.commonpath([dest, allowed_base]) == allowed_base except ValueError: # e.g. Windows paths on different drives have no common path inside = False if not inside: raise ValueError(f"Invalid path: {dest!r} is not inside {allowed_base!r}") return dest

The helper makes three design choices:

  • realpath on both sides: resolving both paths removes .. segments and follows symlinks, so the comparison is between real locations on disk rather than the strings the caller sent.
  • commonpath instead of startswith: a naive prefix check would accept /data/studies_evil as inside /data/studies. commonpath compares whole path components, so that sibling directory is rejected.
  • Fail closed on Windows: commonpath raises ValueError for paths on different drives, and the helper treats that as outside instead of letting the exception bypass the check.

The image write sink now uses the helper:

dest = self._confine_path(os.path.join(self._datastore.image_path(), name), self._datastore.image_path())

save_label() is checked twice: the label tag directory must be inside the labels root, and the final file must be inside that tag directory:

label_path = self._datastore.label_path(label_tag) labels_root = self._datastore.label_path(None) label_path = self._confine_path(label_path, labels_root) name = self._filename(image_id, label_ext) dest = self._confine_path(os.path.join(label_path, name), label_path)

Both the tag and the image ID are attacker-influenced, so checking only the final path against the labels root would still let a crafted tag redirect the write into a different label subtree.

Layer 2: input normalization at the HTTP edge (monailabel/endpoints/datastore.py)

The PUT /datastore/image handler now reduces the image ID to a plain file name:

if image: image_id = os.path.basename(image_id) if not image_id or image_id in (".", "..") or image_id.startswith("."): raise HTTPException(status_code=400, detail="Invalid image ID")

Directory components are discarded, and empty, ., .. or dot-prefixed (hidden file) names are rejected with HTTP 400. The datastore-level check remains the authoritative control, since it also protects paths that do not pass through this endpoint, such as save_label() behind PUT /datastore/label.

Regression tests and backporting notes

The PR adds tests/unit/datastore/test_local_datastore_path_confinement.py, which verifies that:

  • an image ID like ../../other raises ValueError and creates no file outside the image directory;
  • a traversing label tag like ../../labels/final/other is rejected;
  • a traversing image ID used during save_label() is rejected;
  • normal IDs and tags still save to the expected locations.

Only local.py, endpoints/datastore.py and the new test file are security relevant. The PR touches 11 files in total. The remaining changes fix CI problems that were already failing on main, including dropping Python 3.9 from the CI matrices, declaring missing dependencies such as SimpleITK, pyOpenSSL>=26.0.0 and huggingface_hub, an MD5 hash_type fix for dataset downloads, and a MONAI 1.6 NibabelWriter workaround. Teams backporting only the security fix to an older install can focus on the three security-relevant files.

Interim mitigations from the advisory

Until a release containing the fix is confirmed:

  • Enable authentication and do not grant the ANNOTATOR role to untrusted users.
  • Do not expose the MONAI Label server to untrusted networks.
  • Run the service as an unprivileged user and limit its write access to the datastore directory.

Detection methods

No vendor-published Sigma, YARA, Snort or Suricata signatures exist for this CVE yet. Because both the bug and the observed attack chain are well documented, each stage can still be monitored.

1. The HTTP request carrying the traversal

In reverse proxy, WAF, load balancer or application access logs, look for:

  • PUT requests to /datastore/image or /datastore/label where the image value or label tag contains ../, its URL-encoded forms, or absolute paths. Legitimate clients send simple image IDs.
  • The requester identity. With authentication off by default, many such requests will be unauthenticated; with authentication on, a traversal request from a valid ANNOTATOR session is still suspicious.
  • Uploads that are not medical images. Since the server appends the uploaded file's extension to the attacker's path, a script extension such as .py reaching a datastore endpoint is a strong lead. This is an inference from the bug's mechanics rather than a published rule.

On builds that include PR #1915, failed attempts leave a trace. A cluster of HTTP 400 responses on /datastore/image from one source is a cheap indicator of probing against a patched server.

2. Machine-speed reconnaissance

Amazon describes the agents fingerprinting the framework, enumerating API endpoints, and testing the upload parameter for traversal, reaching file write in about 11 minutes. Expect a burst of API enumeration from a single source followed quickly by repeated PUT attempts with varying traversal depths. Amazon recommends high-confidence detections wired to automated response, so treat a traversal hit on these endpoints as an automatic block or isolation event rather than a ticket.

3. Host signs: unexpected writes, especially sitecustomize.py

  • Place sitecustomize.py and other Python startup files in the site-packages directories of MONAI Label's environment under file integrity monitoring or auditd and EDR file write rules. Alert on creation or modification, especially by the MONAI Label server process. Helix's Threat Watch guidance also recommends checking for unexpected file writes, changes to sitecustomize.py, and new Python startup files.
  • Alert on any write by the MONAI Label process outside its datastore directory, including .ssh/authorized_keys, cron files, and application code or configuration.

4. Process signs: the trigger and the reverse shell

  • A training API request followed shortly by a newly spawned Python child of the MONAI Label service making an outbound connection to an unfamiliar external host.
  • A shell or interactive process descending from that Python worker.
  • Root-privileged Python workers on MONAI Label hosts that are not expected to run as root.
  • Unusual long-lived outbound sessions and internal scanning or lateral movement originating from the imaging server, given that the actor tunneled through a second vulnerable MONAI Label server in another network.

5. Published indicators

Amazon published two IP addresses appearing in campaign records dated September 8 to 10, 2026:

  • 142[.]4.98.145
  • 142[.]4.107.34

Retrohunt firewall, proxy, NetFlow and web server logs for that window, focusing on MONAI Label and other research or GPU infrastructure. Amazon does not state the role of each address, so a match warrants investigation but does not by itself prove exploitation. Pair any hit with the HTTP, file and process signals above.

Affected systems and versions

  • Product: monailabel (MONAI Label), maintained in the Project-MONAI/MONAILabel repository.
  • Affected versions: all versions through 0.8.5 (advisory range <= 0.8.5).
  • Fixed versions: none released. The fix is on main as of merge commit 113527bf638585ee5de6a1839b985829331ea272 (October 19, 2026). Confirm any future release includes PR #1915 before treating it as fixed.
  • Vulnerable endpoints: PUT /datastore/image (LocalDatastore.add_image()) via the image parameter, and PUT /datastore/label (LocalDatastore.save_label()) via the image ID and label tag.
  • Higher-risk configurations: deployments with authentication disabled (the default, MONAI_LABEL_AUTH_ENABLE=False), servers reachable from untrusted networks, deployments granting ANNOTATOR to untrusted users, and services running as root or with write access beyond the datastore directory.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization