MONAI Label CVE-2026-133968 Path Traversal RCE Lab

– min read

This one hit CISA KEV the same day it went public, and the root cause is as trivial as they come: missing basename() on a user-supplied parameter. CVE-2026-133968 is an unauthenticated path traversal in MONAI Label, a medical AI annotation server. CVSS 9.8, active exploitation since September 2026.


NVD | Fix PR #1915 | CISA KEV


CVE-2026-133968 Overview

MONAI Label is an open-source platform for building medical AI annotation pipelines. The /datastore/image endpoint accepts file uploads and saves them to a local directory. In version 0.8.5 and earlier, the image query parameter (which becomes the saved filename) is concatenated into the file path without any normalization, allowing directory traversal.


VersionStatusCVSSAuth
< 0.8.6Vulnerable9.8 (Critical)None (disabled by default)
>= 0.8.6Fixed–Optional (unchanged)


MONAI Label architecture diagram showing vulnerable LocalDatastore.add_image

Technical Deep Dive

The vulnerable endpoint lives in monailabel/endpoints/datastore.py. The api_add_image() function receives the image query parameter and passes it directly to LocalDatastore.add_image() with no normalization:

# monailabel 0.8.5  --  vulnerable path construction
image_id = image if image else os.path.basename(file.filename).replace(file_ext, "")
#     ^^^^^^^^^^^^^^^^^^^^^^^^^^
#     NO basename() call  --  attacker controls the whole path!

# Inside LocalDatastore.add_image():
name = self._filename(image_id, image_ext)  # image_id + ".nii.gz"
dest = os.path.realpath(os.path.join(images_dir, name))
shutil.copy(image_filename, dest)            # writes outside the datastore


Because the image parameter goes straight into path resolution, ../../../tmp/exploit resolves to /tmp/exploit.txt — completely outside the datastore directory.


Root Cause Analysis

The fix (merged in PR #1915 on 19 October 2026) introduces two guards:

# FIX applied in PR #1915 (0.8.6)
def add_image(self, image_id, ...):
    # Normalize caller-supplied image ID to a plain file name
    image_id = os.path.basename(image_id)
    if not image_id or image_id in ('.', '..') or image_id.startswith('.'):
        raise HTTPException(400, detail="Invalid image ID")
    name = self._filename(image_id, ext)
    dest = os.path.realpath(os.path.join(self._img(), name))
    # Uses commonpath to confine:
    dest = self._confine_path(dest, self._img())
    with FileLock(self._lock_file):
        shutil.copy(image_filename, dest)


The _confine_path() method uses os.path.commonpath() to verify the resolved destination stays within the allowed directory. Both checks were applied to add_image() and save_label() — the tag parameter was also vulnerable to traversal.


Lab Reproduction

I reproduced the vulnerability using the exact path-building logic from the 0.8.5 source. The script creates a temporary datastore, then attempts to write a file using ../../../tmp/pwn as the image ID:

import os, shutil, tempfile

class ReproD5:
    def __init__(self, ds_path):
        self._dp = ds_path
        os.makedirs(self._img(), exist_ok=True)
    def _img(self):
        return os.path.join(self._dp, "images")
    def add_vuln(self, image_id, src, ext):
        name = image_id + ext
        dest = os.path.realpath(os.path.join(self._img(), name))
        os.makedirs(os.path.dirname(dest), exist_ok=True)
        shutil.copy(src, dest)
        return dest

td = tempfile.mkdtemp(prefix='cve-')
r = ReproD5(td)
r.add_vuln('../../../tmp/pwn', canary.name, '.txt')


The output confirms the file escaped the datastore:

=== TRAVERSAL: ../../../tmp/pwn ===
  dest=/tmp/pwn.txt
  inside images dir? NO -- TRAVERSAL!
  *** CONFIRMED ARBITRARY WRITE TO /tmp/pwn.txt ***
  content: CVE-2026-133968: written via path traversal

=== FIXED (0.8.6): same attempt ===
  image_id -> pwn
  dest=/tmp/cve-.../images/pwn.txt
  inside images dir? YES


I verified this on the actual 0.8.5 source code — the vulnerable dest = realpath(join(images_dir, image_id + ext)) is unmodified from the released package.


Detection and Defence

The most reliable detection signal is the image parameter containing ../ sequences, visible in web server access logs. The table below lists signals for each monitoring layer.


LayerSignal
Web server logsPUT /datastore/image with `image` param containing ../ or ..\
Filesystem auditFiles created outside the datastore/images/ directory
API anomaly`image` parameter containing path separators or `..`
SIEM / WAFRegex: `/(datastore/image|datastore/label).*image.*[.].[/\]`
Sigma ruleEvent ID 11 (FileCreate) for paths outside datastore on server drive
CrowdSec / nginxBlock `PUT /datastore/image?image=.*\.\..*`


Mitigation

The only complete fix is upgrading to MONAI Label 0.8.6 or later.


MeasureAction
UpgradeMONAI Label >= 0.8.6 (released Oct 2026)
WorkaroundDisable internet access to /datastore/* endpoints
Auth enableSet MONAI_LABEL_AUTH_ENABLE=True in config and configure RBAC
IDSDeploy Sigma rule monitoring for datastore API path traversal patterns


Related posts on this blog: Apache Roller CVE-2026-129448 RCE Lab (another KEV-labelled path traversal), Report Unpatched CVEs on Debian Servers with OSV.dev, and Nginx Access Log Analysis with Bash and Python for log-based detection tooling.


If you expose MONAI Label to the internet (which CISA’s KEV entry confirms people do), upgrade immediately. CVE-2026-133968 was published 20 November, added to KEV on 23 November. Your patch deadline is 26 November. Restrict /datastore/ endpoints with a reverse proxy rule in the meantime.

Mohamad ZulfahmyCybersecurity · OffSec · Entrepreneur
About me ↗
ON THIS PAGE
On this page