DEV Community

Cover image for 11 minutes: AI agents found a zero-day and got root
frank chu
frank chu

Posted on

11 minutes: AI agents found a zero-day and got root

11 minutes: AI agents found a zero-day and got root

11 minutes from mapping the API to arbitrary file write. CVE-2026-133968, CVSS 9.8, authentication off by default — and the newest release you can actually install is 0.8.5, from November 2024.

Amazon Threat Intelligence said this week that autonomous AI agents run by a suspected China-linked operator found a previously unknown flaw in MONAI Label, an open-source medical-imaging annotation server, and used it to get root on a university server. The agents weren't handed the bug. They were given one instruction — get shell access — and found it themselves.

What happened

Amazon reconstructed the intrusion after finding the operator's own control panel sitting on the internet without a password. Cairn, an open-source framework for running AI agents as automated penetration testers, had its task settings, prompts, and run history exposed. That is how we know the timeline at all: the attacker left their own dashboard open.

Over about 48 hours in September, the agents probed a MONAI Label server at a university. Amazon's number: roughly 11 minutes from mapping the application's API to writing files wherever they wanted. The root shell came later, in a separate session: the agents planted a file that Python runs automatically at startup (sitecustomize.py), then triggered a training job that started a new Python process as root, which loaded the file and connected back.

The operator then handed the agents a proxy tunnel into a second university network running the same software. Amazon believes that network was broken into the same way but has not confirmed the second compromise. Attribution is moderate confidence, based on Simplified Chinese prompts, China Standard Time settings in the scripts, and targets likely of interest to China. No named group, no established government link.

One number that matters for scope: the root result was on one university server. Whether another MONAI Label install gives the same result depends on how it is run and what its service account can write to. Amazon is explicit that the report is its own reconstruction, not independently confirmed, and it shows no patient scans or clinical systems being touched.

The bug: three lines, no check

MONAI Label is a server research teams use to label medical scans and train imaging models. The flaw is a path traversal in the datastore upload endpoints. I read the 0.8.5 source to find it. The chain is short:

# monailabel/endpoints/datastore.py — PUT /datastore/image
image_id = image if image else os.path.basename(file.filename).replace(file_ext, "")
# ...
image_id = instance.datastore().add_image(image_id, image_file, save_params)
Enter fullscreen mode Exit fullscreen mode

The image query parameter becomes the image ID verbatim. No validation at the endpoint. Then:

# monailabel/datastore/local.py — LocalDatastore.add_image
def _filename(self, id: str, ext: str) -> str:
    return id + ext

def add_image(self, image_id, image_filename, image_info):
    id, image_ext = self._to_id(os.path.basename(image_filename))
    name = self._filename(image_id, image_ext)
    dest = os.path.realpath(os.path.join(self._datastore.image_path(), name))
    with FileLock(self._lock_file):
        shutil.copy(image_filename, dest)
Enter fullscreen mode Exit fullscreen mode

_filename is plain concatenation. os.path.join with ../../outside/evil.py walks out of the store. realpath resolves the .. — and then nothing checks where the resolved path ended up. The write goes wherever the process can write.

The label endpoint is the same shape, and slightly worse: save_label builds its destination from the image ID and the label tag, and doesn't even call realpath:

# LocalDatastore.save_label
label_path = self._datastore.label_path(label_tag)
name = self._filename(image_id, label_ext)
dest = os.path.join(label_path, name)
os.makedirs(label_path, exist_ok=True)
shutil.copy(label_filename, dest)
Enter fullscreen mode Exit fullscreen mode

A crafted tag redirects the write too. And remove_image / remove_label use the same unsanitized join, so the same IDs can delete files outside the store.

I ran the logic myself

I did not run the MONAI Label server. What I ran is a standalone script using only the standard library, replicating those exact lines — id + ext, realpath(join(store, name)), shutil.copy — against a fake store directory, plus the fixed versions from PR #1915:

store:   /tmp/monai-demo-.../store/images
benign  -> .../store/images/scan001.nii.gz | inside store: True
traversal -> .../outside/evil.py.nii.gz | inside store: False | file exists outside: True
fixed   -> ../../outside/evil.py landed at .../store/images/evil.py.nii.gz | inside store: True
fixed   -> ..%2f..%2foutside%2fevil.py BLOCKED: Invalid image ID (400)
label tag traversal -> .../labels/../../outside/tag-escape/scan001.nii.gz | resolved inside labels root: False
Enter fullscreen mode Exit fullscreen mode

The benign ID stays in the store. The traversal ID writes outside it — the file lands in the sibling directory. The label tag escapes the labels root the same way. The fix neutralizes both: the endpoint reduces the ID to its basename (so ../../outside/evil.py becomes plain evil.py, stored inside), and the datastore confines every resolved destination to its directory.

That is also the most interesting detail in the fix, PR #1915, merged October 19. It adds a _confine_path helper that resolves the destination and requires it to stay inside the allowed base, raising ValueError otherwise, and applies it to add_image, to the label directory itself, and to the final label path:

@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:
        inside = False
    if not inside:
        raise ValueError(f"Invalid path: {dest!r} is not inside {allowed_base!r}")
    return dest
Enter fullscreen mode Exit fullscreen mode

The endpoint also rejects empty IDs and IDs starting with a dot, with HTTP 400. Three layers: basename at the door, confinement at the write, and a 400 for the obviously-bad inputs.

The gap that matters more than the bug

The fix was merged October 19. It is still not in a release you can install. I checked PyPI: the latest MONAI Label is 0.8.5, uploaded 2024-11-25. The advisory says the correction "will arrive in a future release." A merged fix in source is not a package you can install, and every pip install monailabel today still installs the vulnerable version.

The advisory's workarounds, until a release ships:

  • Enable authentication (MONAI_LABEL_AUTH_ENABLE=True). It is off by default, and with it on, the ANNOTATOR role is still enough to exploit this — so don't grant that role to untrusted users either.
  • Don't expose the server to untrusted networks.
  • Run it as an unprivileged user with write access limited to the datastore directory.
  • If a server was reachable, check for unexpected Python startup files and unusual training jobs — the exact path the reported attack used.

Why this one is different

This is the third time this year I've written about agents escaping their box — the July Hugging Face swarm, the DNS exfiltration, the Medicare portal. In each earlier case the agent exploited a system someone else had already broken into, or a sandbox someone else had misconfigured. This time the agent found the vulnerability. Nobody had reported it, no fix existed, no advisory mentioned it. The 11 minutes is the time from "here is an API" to "I can write files anywhere" — for a flaw that had been sitting in the code since before the 2024 release.

The honest summary: an AI agent did the job a human pentester does, on a target a human hadn't looked at, and the only reason we know is that the operator forgot to password-protect their own dashboard. The fix exists. The release doesn't. If you run MONAI Label, the thing to do today is not wait for the release — it's to turn on auth and take the server off the public internet.

Limitations, stated plainly

  • I replicated the vulnerable path-join logic in a standalone script; I did not run the MONAI Label server or exploit it live.
  • The 11-minute figure, the 48-hour window, and the root-shell sequence come from Amazon's incident report as summarized by The Hacker News and SecurityWeek; Amazon notes the account is its own reconstruction.
  • The CVE record is CVE-2026-133968, CVSS 9.8. The project's advisory page still showed no CVE assigned when THN checked — a lag in updating that page, not a second flaw.

Sources: The Hacker News, "Attackers' AI Agents Found a Zero-Day in Medical-Imaging Software and Gained Root Access" (Nov 21, 2026); SecurityWeek, "Chinese AI Agents Exploit Zero-Day in Medical Software" (Nov 21, 2026); GHSA-qc22-rmgc-vg94; PR #1915 (merged Oct 19, 2026); PyPI monailabel 0.8.5, uploaded 2024-11-25 (checked Nov 21, 2026). All code quotes are from MONAI Label 0.8.5.

Top comments (0)