critical

CVE

CVE-2026-133968

CWE

CWE-22, CWE-24, CWE-73

Affected Surface

  • PyPI `monailabel` 0.8.5 and earlier (all published releases); the fix from PR #1915 (commit `113527bf6385`) is only on the `main` branch
  • MONAI Label servers in the default configuration (`MONAI_LABEL_AUTH_ENABLE=False`), reachable by any network client; with authentication on, any user with the annotator role
  • 3D Slicer, OHIF and other viewer integrations that talk to a MONAI Label server, and research GPU hosts that run it as root or with write access to their Python environment

TL;DR

MONAI Label is a FastAPI server that research teams run next to 3D Slicer or OHIF to label medical scans and train segmentation models. Its PUT /datastore/image endpoint takes an image query parameter, uses it as the file name, and copies the upload there without checking that the result stays inside the datastore. PUT /datastore/label has the same problem with the image ID and label tag. Authentication is disabled by default, so anyone who can reach the port can write files wherever the server process can.

This one has been used in real attacks. Amazon Threat Intelligence found an unauthenticated Cairn instance (Cairn is an open-source framework that runs AI agents as penetration testers) used by an operator it ties to China with moderate confidence. Over about 48 hours from 8 September 2026 the agents went after university networks in East Asia. Against a MONAI Label server they found the traversal with no prior advisory to work from, went from mapping the API to writing files in about 11 minutes, and in a later session wrote a Python reverse shell to sitecustomize.py, then called a training endpoint so a fresh Python process would load it. The shell came back as root. Amazon believes the operator used the same bug to break into a second university and run a tunnel through it.

The maintainers merged a fix on 19 October and published the advisory on 18 November. NVD published CVE-2026-133968 on 20 November with CVSS 9.8. There is still no release: monailabel 0.8.5, uploaded to PyPI on 25 November 2024, is the newest version.

What to do now:

  1. Find MONAI Label servers (pip show monailabel, monailabel start_server in process lists or unit files, port scans of research VLANs) and take any that face untrusted networks offline or behind a VPN.
  2. Turn on authentication (MONAI_LABEL_AUTH_ENABLE=True) and give the annotator role only to people you trust. Annotators can still exploit the bug.
  3. Run the server as an unprivileged user that can’t write to its own Python environment, application code, ~/.ssh or cron directories.
  4. Check for sitecustomize.py, usercustomize.py and unexpected .pth files in every Python environment the server uses, and look in your logs for the two Amazon IP addresses below.
  5. Don’t wait for Dependabot. On 21 November the GitHub Advisory Database only had an unreviewed entry (GHSA-2f43-rwqm-6h67) with no package attached, so dependency scanners keyed on it won’t flag monailabel.

Affected packages and projects

EcosystemPackageAffected versionsFixed or safe version
PyPImonailabelAll releases through 0.8.5No release yet; fix is on main from commit 113527bf6385 (PR #1915)
GitHubProject-MONAI/MONAILabelmain before 19 October 2026main at or after 113527bf6385

The advisory was first filed against the main MONAI repository (GHSA-cxx7-378q-5622) by Amazon’s vulnerability disclosure account aws-sec-vdp, then refiled under MONAILabel so the CVE would land on the right project. The monai library itself isn’t affected.

Technical analysis

The vulnerable code

This is add_image() in monailabel/endpoints/datastore.py at 0.8.5:

def add_image(
    background_tasks: BackgroundTasks,
    image: Optional[str] = None,          # query parameter, fully attacker-controlled
    params: str = Form("{}"),
    file: UploadFile = File(...),
    user: Optional[str] = None,
):
    logger.info(f"Image: {image}; File: {file}; params: {params}")
    file_ext = "".join(pathlib.Path(file.filename).suffixes) if file.filename else ".nii.gz"

    image_id = image if image else os.path.basename(file.filename).replace(file_ext, "")
    image_file = tempfile.NamedTemporaryFile(suffix=file_ext).name

    with open(image_file, "wb") as buffer:
        shutil.copyfileobj(file.file, buffer)
        background_tasks.add_task(remove_file, image_file)

    instance: MONAILabelApp = app_instance()
    save_params: Dict[str, Any] = json.loads(params) if params else {}
    if user:
        save_params["user"] = user
    image_id = instance.datastore().add_image(image_id, image_file, save_params)
    return {"image": image_id}
  • When image is set it becomes image_id with no cleaning. Only the fallback path (no image parameter) runs os.path.basename().
  • file_ext comes from the uploaded file name’s suffixes, and the temp file keeps that suffix. The caller picks the extension of the file that ends up on disk, .py included.

The ID then goes to LocalDatastore.add_image() in monailabel/datastore/local.py:

    def add_image(self, image_id: str, image_filename: str, image_info: Dict[str, Any]) -> str:
        id, image_ext = self._to_id(os.path.basename(image_filename))
        if not image_id:
            image_id = id

        logger.info(f"Adding Image: {image_id} => {image_filename}")
        name = self._filename(image_id, image_ext)          # image_id + image_ext
        dest = os.path.realpath(os.path.join(self._datastore.image_path(), name))

        with FileLock(self._lock_file):
            logger.debug("Acquired the lock!")
            shutil.copy(image_filename, dest)               # write happens here
  • os.path.realpath() resolves .. segments but nothing checks the result against the datastore directory, so ../../../x simply resolves to a path outside it.
  • os.path.join() discards the base entirely when the second argument is absolute, so an image value starting with / works too.
  • shutil.copy() writes with the server’s privileges. If the server runs as root, as it did on the university host Amazon describes, that means anywhere on the filesystem.

save_label() (PUT /datastore/label) builds os.path.join(label_path, image_id + ext) the same way, and label_path itself comes from the caller’s label tag, so both fields can traverse.

From file write to root

Amazon’s account of the second session is a textbook Python persistence trick. site.py imports a module called sitecustomize at every interpreter start if one exists on sys.path. Writing an attacker-supplied sitecustomize.py into the server’s site-packages (or any directory on its path) means the next Python process runs it. MONAI Label’s training API starts new Python processes, so the agents called it and caught a reverse shell from the child. No restart needed.

The advisory lists the other obvious targets: overwriting the application’s own code, adding a key to ~/.ssh/authorized_keys, or dropping a cron entry.

The fix

PR #1915 (merged as 113527bf6385 on 19 October) adds a containment check and uses it for both writes:

+    @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
@@ def add_image(self, image_id: str, image_filename: str, image_info: Dict[str, An
-        dest = os.path.realpath(os.path.join(self._datastore.image_path(), name))
+        dest = self._confine_path(os.path.join(self._datastore.image_path(), name), self._datastore.image_path())
@@ def save_label(self, image_id: str, label_filename: str, label_tag: str, label_i
         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 = os.path.join(label_path, name)
+        dest = self._confine_path(os.path.join(label_path, name), label_path)

and rejects bad IDs at the endpoint before they reach the datastore:

     image_id = image if image else os.path.basename(file.filename).replace(file_ext, "")
+    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")

os.path.commonpath() on the resolved paths is the right check here. It handles .., absolute paths and symlinks inside the datastore, and the label directory is confined separately so a crafted tag can’t move the base. The extension is still caller-chosen, but it can only land inside the datastore now.

Same tool, different operator

Cairn showed up in another incident this week. Wiz found that the tooling behind the malicious Microsoft agent-framework PyPI releases identified itself as Cairn. Amazon also cites Gambit Security’s report of a financially motivated group using Cairn against online retailers. Nobody has linked these operators to each other. What they share is an open-source framework that turns “obtain shell access” into a working exploit chain with little human input, which is why an unauthenticated research server with no CVE was found and owned in minutes.

IOCs

Amazon published two addresses seen in the Cairn records from 8 to 10 September 2026:

  • 142[.]4.98[.]145
  • 142[.]4.107[.]34

Host artifacts to look for, based on the technique Amazon describes and the advisory’s own examples:

  • sitecustomize.py or usercustomize.py anywhere on the server’s sys.path, especially one that opens a socket or spawns a shell.
  • New .pth files in site-packages that contain import lines.
  • Files with medical-image or .py extensions outside the datastore directory, owned by the MONAI Label service account.
  • New entries in ~/.ssh/authorized_keys or cron for that account (or root).
  • PUT /datastore/image or PUT /datastore/label requests whose image or tag parameter contains .., %2e%2e or starts with /.

Detection and remediation

Inventory:

# Is it installed, and which version?
pip show monailabel 2>/dev/null | grep -E '^(Name|Version|Location)'
rg -n 'monailabel' --glob '{requirements*.txt,pyproject.toml,poetry.lock,uv.lock,Pipfile.lock,environment.yml}'

# Running servers and who they run as
ps -eo user,pid,args | grep -E 'monailabel (start_server|.*app)' | grep -v grep

# Is authentication on?
env | grep MONAI_LABEL_AUTH_ENABLE; grep -rn 'MONAI_LABEL_AUTH_ENABLE' /etc/systemd /etc/default 2>/dev/null

Look for signs of exploitation:

# Startup hooks in every site-packages the server can see (run with the server's Python)
python - <<'EOF'
import site, sys, pathlib
for d in set(site.getsitepackages() + [site.getusersitepackages()] + sys.path):
    p = pathlib.Path(d)
    if not p.is_dir():
        continue
    for name in ("sitecustomize.py", "usercustomize.py"):
        if (p / name).exists():
            print("HOOK", p / name)
    for pth in p.glob("*.pth"):
        if any(l.startswith("import") for l in pth.read_text(errors="ignore").splitlines()):
            print("PTH ", pth)
EOF

# Traversal attempts in reverse-proxy or uvicorn access logs
grep -E 'PUT /datastore/(image|label)\?[^ ]*(\.\.|%2[eE]%2[eE]|=%2[fF]|=/)' /var/log/nginx/access.log* 2>/dev/null

# Amazon's IOCs
grep -E '142\.4\.98\.145|142\.4\.107\.34' /var/log/nginx/access.log* /var/log/auth.log* 2>/dev/null

Until a release ships:

  • Set MONAI_LABEL_AUTH_ENABLE=True and configure the Keycloak realm, or put the server behind an authenticating reverse proxy that only allows your annotators.
  • Block PUT /datastore/image and PUT /datastore/label at the proxy when the query string contains .., %2e or a leading /. That’s a stopgap, not a fix.
  • Run as a dedicated user whose only writable path is the datastore. A read-only virtualenv stops the sitecustomize.py route.
  • If you build from source, use a commit at or after 113527bf6385, and test it first: main carries almost two years of unreleased changes on top of 0.8.5.

If you find a hook file or IOC hits, treat the host as compromised: rebuild it, and rotate anything the service account could read, such as SSH keys, cloud credentials on the GPU host, Hugging Face or model-registry tokens, PACS/DICOMweb credentials and Keycloak client secrets. Check whether the host was used as a pivot, since Amazon saw the operator tunnel through a second compromised MONAI Label server.

Timeline

  • 2024-11-25: MONAI Label 0.8.5, still the newest release, is uploaded to PyPI.
  • 2026-09-08: The Cairn campaign against East Asian university networks begins and runs for about 48 hours. The agents find and exploit the traversal, and later get a root shell through sitecustomize.py.
  • 2026-09-10: Amazon Threat Intelligence finds the operator’s unauthenticated Cairn server.
  • 2026-10-19: The fix (PR #1915, commit 113527bf6385) is merged to main.
  • 2026-11-18: MONAILabel publishes GHSA-qc22-rmgc-vg94 (critical, no patched version).
  • 2026-11-20: Amazon publishes its report. NVD publishes CVE-2026-133968 (CVSS 9.8), with a description that says it was “exploited in the wild starting in September 2026”. CISA’s SSVC entry on the same record still lists exploitation as “none”. GitHub creates an unreviewed advisory with no package.
  • 2026-11-21: No fixed release on PyPI. No EPSS score yet, and the CVE isn’t in CISA KEV.

From research to remediation

Check whether this pattern exists in your codebase

Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.

References