AI Security

MONAI Label CVE-2026-133968: Why an Arbitrary File Write Is a Root Shell in a Python Service

Dark cyberpunk illustration of a narrow machine corridor at night with one floor panel lifted aside, amber light rising through the gap into a cyan lattice of data traces overhead.

The payload was a file named sitecustomize.py. Python imports that file automatically every time an interpreter starts, before any application code runs, so writing it schedules execution. The agents that wrote it had been given one instruction in plain language: obtain shell access. They fingerprinted the application, mapped its API, found an upload endpoint that took a filename as a parameter, and tested that parameter for path traversal. Eleven minutes after they started mapping, they could write files anywhere the server process could write. In a later session they dropped a Python reverse shell into the startup hook, called a training endpoint to spawn a fresh interpreter, and caught a shell running as root.

CISA added the vulnerability those agents found, CVE-2026-133968 in MONAI Label, to the Known Exploited Vulnerabilities catalog on November 23, 2026, with a federal remediation deadline of November 26 under BOD 26-04. Amazon Threat Intelligence published the investigation four days earlier, and CJ Moses wrote it up in a post titled "Chinese-nexus actor's Cairn AI agents found a zero-day on their own". Every outlet that covered it led with the same thing: the machine found the bug by itself.

That framing buries the part a defender can use. The bug was a missing path check, the kind that appears in a first-week code review. What the agents changed was the price of looking for it.

Who runs MONAI Label, and who can stop reading

MONAI Label is an open-source annotation server from Project MONAI. Radiology research groups, imaging labs and university hospitals run it so a clinician can draw on a scan in 3D Slicer, OHIF or CVAT while a model learns from the corrections. It listens on port 8000 and, per the project's own advisory, ships with authentication disabled.

If you do not operate a MONAI Label server, this CVE is not yours. There is no client-side exposure: running 3D Slicer or viewing studies in OHIF does not put you in scope, and nothing in a PACS or a DICOM modality is affected by this bug. Close the tab on the CVE and read the third section, which is about a triage habit that applies to every Python service you run.

If you do operate one, the awkward part is who owns it. A MONAI Label server is research infrastructure. It gets stood up by a postdoc or a data-science team on a GPU box, it does not carry patient care, and it almost never appears in the clinical asset inventory that drives a hospital's patching cycle. The two universities in Amazon's report were reachable from the internet. That combination, a GPU server on a university network with an unauthenticated API and no asset owner, is the whole story of how this got exploited in September and stayed quiet until November.

The agents did not invent anything

Project MONAI's advisory, GHSA-qc22-rmgc-vg94, describes the defect in two sentences of plain code reading. LocalDatastore.add_image() took the client-supplied image ID, appended a file extension, joined the result to the image directory, and wrote the upload with shutil.copy(). The resolved path was never checked to be inside the datastore. An ID of ../../../tmp/x therefore writes to /tmp. PUT /datastore/label had the same shape through save_label(), which builds its destination from the image ID and the label tag. CWE-22. NVD scores it CVSS v3.1 9.8 and dates in-the-wild exploitation to September 2026.

Read the rest of Amazon's report and the agents look less like researchers and more like a process that never gets bored. The campaign's longest operation targeted a Redis instance that allowed access without authentication: 16 hours and 148 sequential actions working through replication abuse to load unauthorized code, a scripting-sandbox escape, configuration-file writes and memory corruption, plus a Log4Shell attempt against a service on the same host. When those failed, the agents mapped the internal Docker network through an SSRF in a co-located Qdrant instance and sprayed credentials at PostgreSQL, SSH and several other services. Nothing worked. A separate operation spent more than six hours on a university GPU server, assembled roughly 80 real usernames from faculty directories, lab websites, archived pages and academic papers, and tried more than 30,000 credential combinations against SSH, an admin dashboard, a network storage device, a VPN and the campus portal. It never found a working login.

Two failures and one success in about 48 hours. The success came against the target with the ordinary, unreviewed bug. I read that as the forecast worth planning around: agentic tooling is poor at defeating a control that actually holds and excellent at exhausting the list of things nobody checked. Gambit Security documented a separate financially motivated operator chaining the same framework against online retailers at roughly 25 dollars per target, which tells you the cost curve is already low enough for commodity crime. The variable that decides your outcome is how much software you run that no one has ever looked at.

Why a file write is a shell in a Python service

The step most coverage skipped is the one worth internalizing. Python's site module runs during interpreter startup and imports three things if it finds them: sitecustomize.py, usercustomize.py, and every .pth file in a site directory whose line begins with import. None of that requires an attacker to touch application code, a cron entry, a systemd unit or a shell profile. A single write into a site-packages directory is execution on the next interpreter start, at the privilege of whatever account starts it.

In this case the attacker also controlled the clock. MONAI Label exposes a training endpoint that spawns a new Python process on request, so the agents picked the moment the payload ran. The Docker image, like many research containers, runs as root, and the shell came back as root. We wrote up the same primitive from the other direction last week when a compromised PyPI release used a .pth startup hook to mint Azure tokens without ever being imported. Same mechanism, different delivery.

Here is the position I will defend: in a Python service, arbitrary file write should be triaged as remote code execution with a scheduling delay, and the delay is set by whatever endpoint forks a worker. A CVSS worksheet will often land a file write at integrity-high and availability-low, and a busy team reading that line will put it behind the authentication bypasses. For an application whose runtime imports files out of a writable directory at every start, that ordering is wrong. Score the write by what the interpreter does with it.

What 0.8.6 fixes, and the second traversal with no CVE

The fixed release is MONAI Label 0.8.6, published November 22, 2026. Its notes open with "This is a security release. All MONAI Label server deployments should upgrade." A number of write-ups published before that date state there is no patched release; they were accurate when written and are stale now. Anything on 0.8.5 or older is affected.

The release closes two path traversals, and only one of them has a CVE:

  • The datastore upload endpoints (CVE-2026-133968). PR #1915 makes both write paths reject destinations outside the datastore directories, reduces the ID on /datastore/image to its basename, and returns HTTP 400 for empty or dot-prefixed IDs.
  • Session upload. The session endpoint extracted tar archives without validating member names, and used session IDs as paths without validation. No CVE was assigned, the same versions are affected, and a rejected session archive now returns HTTP 400.

Budget for the upgrade rather than assuming it is a version bump. 0.8.6 drops Python 3.9 and 3.10 and requires 3.11 or newer, moves the Docker image to Ubuntu 24.04 with Python 3.12, and shifts DICOM SEG export to highdicom with pydicom 3.x. On a GPU box with a pinned CUDA and torch build, that is a rebuild, and the rebuild is where research servers stall for a month.

For the window before you get there, the advisory lists workarounds that are worth applying permanently: set MONAI_LABEL_AUTH_ENABLE=True and withhold the ANNOTATOR role from untrusted users, because with authentication on that role is still sufficient to exploit the bug; keep the server off untrusted networks; and run it as an unprivileged account whose write access stops at the datastore directory. That last one would have turned a root shell into a shell as a user who cannot write a startup hook.

Hunt the write, then the interpreter

A version check answers "am I vulnerable." It does not answer "was I used," and exploitation started in September. Run both.

# 1. Version. 0.8.6 is the fix; 0.8.5 and older are affected.
pip show monailabel 2>/dev/null | awk '/^Version/{print "monailabel", $2}'

# 2. Enumerate the three Python startup hooks on every path the
#    interpreter will search. Compare the list against a clean install.
python3 -c 'import sys, glob, os, time
for d in sys.path:
    for pat in ("sitecustomize.py", "usercustomize.py", "*.pth"):
        for f in glob.glob(os.path.join(d, pat)):
            print(time.strftime("%Y-%m-%d", time.gmtime(os.path.getmtime(f))), f)'

# 3. Any startup hook written since the campaign window opened.
find / -xdev -newermt "2026-09-01" \
     \( -name sitecustomize.py -o -name usercustomize.py -o -name '*.pth' \) \
     -print 2>/dev/null

# 4. Files that landed outside the datastore. Traversal lands them in the
#    parent directories, so walk up from MONAI_LABEL_APP_DIR.
find "${MONAI_LABEL_APP_DIR:-/opt/monailabel}/.." -xdev -maxdepth 2 \
     -newermt "2026-09-01" -type f -print 2>/dev/null

Then the request side. The vulnerable ID arrives as a query parameter, so it is in the request line of any reverse proxy or access log you kept, and you can both hunt it and block it with the same string match.

# Traversal attempts against the two vulnerable endpoints.
grep -E 'PUT /datastore/(image|label)' access.log \
  | grep -Ei '\.\./|%2e%2e|%252e|\.\.%2f'

# Amazon published two addresses seen in records dated September 8-10, 2026.
grep -E '142\.4\.98\.145|142\.4\.107\.34' access.log auth.log

# nginx, in the server block in front of MONAI Label. Reject the pattern
# at the edge until the server itself is on 0.8.6.
location ~ ^/datastore/(image|label)$ {
    if ($args ~* "(\.\./|%2e%2e|%252e)") { return 400; }
    proxy_pass http://127.0.0.1:8000;
}

If the grep finds nothing, check how long you keep those logs before you call it clean. September 8 is more than two months back, and a research GPU host is not usually shipping its nginx logs anywhere with that retention.

Read the startup hooks before you trust the upgrade

Upgrading to 0.8.6 shuts the door. It tells you nothing about whether someone walked through it in September, and it will not remove a payload already sitting in site-packages, because the fix is in the write path, not in the interpreter. Work in this order: confirm the running version, enumerate the startup hooks and .pth files and diff them against a clean install of the same release, sweep the datastore's parent directories for files that should not exist, and then rebuild. If the box answered on port 8000 from the internet with authentication off at any point since September, treat it as suspect rather than patched, and rotate whatever credentials that host could reach.

The wider move has nothing to do with medical imaging. Go find the research and AI infrastructure in your own estate that has no asset owner: the inference gateway a platform team stood up once, the vector database on a spare VM, the labeling server somebody containerized for a pilot. Those are the systems that get an unauthenticated port and no patch cycle, and they are exactly what an agent running for 16 hours without a break is good at finding. We help organizations inventory and assess that layer before somebody else enumerates it.

Not sure what AI and research infrastructure you have exposed?

We inventory and assess the inference gateways, labeling servers and research GPU hosts that sit outside the normal patch cycle, and we tell you which ones answer from the internet. Book a session to walk your environment with us.