Security

Resolved but never checked: MONAI Label path traversal to root shell (CVE-2026-133968)

Artem Safonov
Artem Safonov , Threat Analyst
Resolved but never checked: MONAI Label path traversal to root shell (CVE-2026-133968)
Cover © Anonhaven

One unchecked query parameter gave attackers a root shell on a university server running MONAI Label. The path traversal flaw, CVE-2026-133968, carries a CVSS score of 9.8 and affects every release up to 0.8.5. Version 0.8.6, published on November 22, 2026, fixes it.

Install 0.8.8, not 0.8.6. Two security releases followed on November 25, 2026. They come with four more advisories that cover 0.8.6, three of them rated critical.

Exploitation needs no account on a default install. MONAI Label ships with authentication switched off, and its launcher listens on all network interfaces. Where authentication is enabled, the attacker needs the ANNOTATOR role, according to the project's security advisory.

The bug sits in PUT /datastore/image, the route that uploads a scan. Its optional image parameter becomes part of a file path on the server. The code even resolved that path with os.path.realpath(), then wrote to wherever the result pointed.

Exploited since September 2026

CISA added CVE-2026-133968 to its Known Exploited Vulnerabilities catalog on November 23, 2026. The CVE record says attackers have exploited the flaw in the wild since September 2026. A MONAI Label server on 0.8.5 or older that untrusted networks could reach needs both an upgrade to 0.8.8 and a file review.

What MONAI Label does and how widely it is installed

MONAI Label is an open-source server for labeling medical images, built on FastAPI. Clients such as 3D Slicer and OHIF connect to it, upload scans and start model training. Project MONAI publishes the code under the Apache 2.0 license.

The install base is small. The GitHub repository had 917 stars and 281 forks on November 24, 2026. Docker Hub shows more than 10,000 pulls of the official image, and PyPI counted 1,956 downloads over the past month.

The upload handler trusts the image parameter

The route handler api_add_image() passes each request to a function named add_image(). Line 71 of that function holds the first mistake.

def add_image(
    background_tasks: BackgroundTasks,
    image: Optional[str] = None,
    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}

File monailabel/endpoints/datastore.py, lines 61 to 83, at commit 0b1ee41, the parent of the fix. View on GitHub.

Line 71 treats two inputs differently. If the client omits image, the ID comes from the uploaded filename, and os.path.basename() strips any directories. If the client supplies image, the value goes through untouched. The developers guarded the fallback and left the main input open.

Line 69 hands the caller a second lever, judging by the code. It takes the extension from the filename in the multipart upload, which the client sets as well. Line 72 gives that suffix to a temporary file. LocalDatastore._to_id() later reads the extension back from the temporary name through file_ext() in monailabel/utils/others/generic.py. That function drops only suffixes longer than ten characters, so .py survives. A caller therefore picks both the directory and the suffix of the file that lands on disk.

realpath() cleans the path and compares it with nothing

LocalDatastore.add_image() receives that ID and builds the destination.

    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)
        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)

File monailabel/datastore/local.py, lines 434 to 445, same parent commit. The 0.8.5 release tag carries identical code at these lines. View on GitHub.

Line 440 glues the ID and the extension together. Line 441 joins that name onto the image directory and calls os.path.realpath(), which collapses each ../ into a clean absolute path. Line 445 then copies the upload there with shutil.copy().

Resolving a path is half of a traversal check. The other half compares the resolved path with the directory it must stay inside, and that comparison never happens. The advisory gives ../../../tmp/x as an example value and says the upload lands anywhere the server process can write.

An anonymous client is the admin by default

The upload route declares a role check through the RBAC dependency. On a default install that check returns before it compares anything.

DEFAULT_USER = User(
    username="admin",
    email="admin@monailabel.com",
    name="UNK",
    roles=[
        settings.MONAI_LABEL_AUTH_ROLE_ADMIN,
        settings.MONAI_LABEL_AUTH_ROLE_REVIEWER,
        settings.MONAI_LABEL_AUTH_ROLE_ANNOTATOR,
        settings.MONAI_LABEL_AUTH_ROLE_USER,
    ],
)


def from_token(token: str):
    if not settings.MONAI_LABEL_AUTH_ENABLE:
        return DEFAULT_USER

File monailabel/endpoints/user/auth.py, lines 67 to 82, same parent commit. View on GitHub.

class RBAC:
    def __init__(self, roles: Union[str, Sequence[str]]):
        self.roles = roles

    async def __call__(self, user: User = Security(get_current_user)):
        if not settings.MONAI_LABEL_AUTH_ENABLE:
            return user

Same file, lines 123 to 129. View on GitHub.

MONAI_LABEL_AUTH_ENABLE defaults to False on line 32 of monailabel/config.py. With the flag off, from_token() returns a built-in user named admin who holds all four roles. RBAC.__call__() then returns that user without looking at the roles.

The command-line launcher completes the picture. monailabel/main.py sets the default host to 0.0.0.0 and the port to 8000 on lines 54 and 55. A server started with stock options accepts uploads from any machine that can route to it.

CISA describes the flaw as unauthenticated, and the CVE record scores it with PR:N, no privileges required. Both hold for stock installs. Sites that turned authentication on are exposed only to accounts with the ANNOTATOR role.

Three conditions stack up in this bug. Authentication is off by default, the launcher binds to 0.0.0.0, and on the server Amazon describes the process ran as root. Changing any one of them would have narrowed the attack.

— AnonHaven Editorial Team

The label route builds missing folders for the caller

PUT /datastore/label repeats the pattern with two inputs, the image ID and the label tag.

        label_path = self._datastore.label_path(label_tag)
        name = self._filename(image_id, label_ext)
        dest = os.path.join(label_path, name)

        with FileLock(self._lock_file):
            logger.debug("Acquired the lock!")
            os.makedirs(label_path, exist_ok=True)
            shutil.copy(label_filename, dest)

File monailabel/datastore/local.py, lines 495 to 502, same parent commit. View on GitHub.

label_path() is a plain os.path.join() on the tag, at lines 77 to 79 of the same file. Here the code skips even the realpath() call. Line 501 runs os.makedirs() on a directory the caller influences, and line 502 copies the upload into it.

One condition limits this second route, judging by the code. save_label() raises ImageNotFoundException at lines 487 to 489 unless the image ID already exists in the datastore index. The image route has no such precondition, and the CVE description names only PUT /datastore/image.

Cairn agents went from API map to file write in 11 minutes

Amazon Threat Intelligence assesses with high confidence that the bug was a zero-day when attackers used it. The team found no matching fix, issue or advisory for the project. On September 10, 2026, its analysts came across a public instance of Cairn, an open-source framework that coordinates AI agents for penetration testing. The operator had left it without authentication, so prompts, project settings and agent output were readable.

Those records showed a campaign of roughly 48 hours that began on September 8. Targets were IP addresses tied to universities in East Asia outside mainland China, and the agents were told to obtain shell access. Amazon attributes the activity, with moderate confidence, to a Chinese-nexus actor.

Two long operations in that campaign failed. One hit a Redis server, the other guessed logins for a GPU server. A server running an open-source medical imaging application went differently, CJ Moses, CISO of Amazon Integrated Security, wrote on November 20. The agents identified the framework, mapped its API and found an upload endpoint with a filename parameter. About 11 minutes passed between the API mapping and arbitrary file writes.

A later session turned the file write into code execution. The agents wrote a Python reverse shell into sitecustomize.py, a file the interpreter imports at startup. They then called a training endpoint, which spawned a fresh Python process. That process loaded the payload and opened a shell running as root.

Amazon's post never names the product. The CVE record supplies the link by describing MONAI Label as exploited in the wild starting in September 2026. The advisory adds that the GitHub account aws-sec-vdp filed the original private report.

We found no published proof of concept from the researchers or the maintainers. The advisory's example string is the only sample in public, and Amazon does not say which training endpoint the agents called.

In another session the operator stepped in, according to Amazon. That person handed the agents a proxy that tunneled into a second university network, and the server behind it ran the same software. Amazon infers the actor had already compromised that machine with the same bug.

Moses drew a conclusion about response times. An agent that exploits a zero-day in minutes finishes, he wrote, "faster than many security operations centers can manually triage an alert."

The patch adds the missing comparison in 31 lines

Rafael Garcia-Dias opened pull request #1915 on October 12, 2026. The project merged it on October 19. The squashed commit 113527b touches 11 files, many of them repairs for a failing CI pipeline and dependency updates. The defensive code is 31 added lines in two files.

diff --git a/monailabel/datastore/local.py b/monailabel/datastore/local.py
index d8b0538aa..aafcb1ca5 100644
--- a/monailabel/datastore/local.py
+++ b/monailabel/datastore/local.py
@@ -228,6 +228,25 @@ def _to_id(self, file: str) -> Tuple[str, str]:
     def _filename(self, id: str, ext: str) -> str:
         return id + ext
 
+    @staticmethod
+    def _confine_path(dest: str, allowed_base: str) -> str:
+        """Resolve ``dest`` and require it to stay inside ``allowed_base``.
+
+        IDs and tags are concatenated into filesystem paths, so the resolved
+        destination is checked before writing. Raises :class:`ValueError` if
+        it is not inside the allowed directory.
+        """
+        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 _to_bytes(self, file):
         return io.BytesIO(pathlib.Path(file).read_bytes())
 
@@ -438,7 +457,7 @@ def add_image(self, image_id: str, image_filename: str, image_info: Dict[str, An
 
         logger.info(f"Adding Image: {image_id} => {image_filename}")
         name = self._filename(image_id, image_ext)
-        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())
 
         with FileLock(self._lock_file):
             logger.debug("Acquired the lock!")
@@ -493,8 +512,12 @@ def save_label(self, image_id: str, label_filename: str, label_tag: str, label_i
 
         logger.info(f"Adding Label: {image_id} => {label_tag} => {label_filename}")
         label_path = self._datastore.label_path(label_tag)
+        # Confine the label directory itself as well as the final file path, so
+        # a crafted label tag cannot redirect the write outside the labels dir.
+        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)
 
         with FileLock(self._lock_file):
             logger.debug("Acquired the lock!")

Changes to monailabel/datastore/local.py in commit 113527b, "fix: confine datastore write paths (#1915)". View the commit on GitHub.

The new helper _confine_path() resolves both the destination and the allowed base. It then asks os.path.commonpath() whether the base is their shared ancestor. That function compares whole path components, so a sibling folder such as studies-old cannot pass for studies, as it could under a string prefix test. On Windows, paths on different drives raise ValueError, and the helper treats that as outside.

add_image() now sends its destination through that function. save_label() calls it twice, first on the tag directory against the labels root, then on the final file. Because os.makedirs() runs after both checks, a hostile tag can no longer create folders elsewhere.

diff --git a/monailabel/endpoints/datastore.py b/monailabel/endpoints/datastore.py
index fdd63bb6e..9fa67df88 100644
--- a/monailabel/endpoints/datastore.py
+++ b/monailabel/endpoints/datastore.py
@@ -69,6 +69,12 @@ def add_image(
     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, "")
+    # Normalize a caller-supplied image ID to a plain file name
+    # (no directory components) before it is used to build a path.
+    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")
     image_file = tempfile.NamedTemporaryFile(suffix=file_ext).name
 
     with open(image_file, "wb") as buffer:

Changes to monailabel/endpoints/datastore.py in the same commit.

The endpoint gained a second layer. A supplied image is cut down to its basename, and an empty or dot-prefixed ID gets HTTP 400. The commit ships five unit tests, three traversal attempts and two normal writes.

Garcia-Dias fixed the root cause at the point of writing, not one request shape. Reading the diff, we see no route around the write check.

What release 0.8.6 leaves for operators

Reads and deletes still build paths the old way in the patched file. get_image_uri() on line 298 and remove_image() on line 490 join the ID onto the image directory without confinement. Both require the ID to exist in the index, and the patched upload route can no longer register a traversal ID.

An index poisoned before the upgrade is a different matter. The vulnerable add_image() recorded each uploaded ID in the datastore file, datastore_v2.json by default, at lines 452 and 453. Reading the code, such an entry stays for as long as its target file exists, so it survives the move to 0.8.6. Entries containing ../ are evidence of an attack and should be removed by hand.

Release 0.8.6 closes a second traversal. Pull request #1942 fixed PUT /session/?uncompress=true, which unpacked uploaded tar archives without checking member names. The release notes list it beside the datastore bug. The project published it on November 25 as advisory GHSA-5c65-q9f6-h62q, rated high with a CVSS score of 8.2. GitHub showed no CVE number for it on November 26.

The maintainers do not present 0.8.6 as safe to expose. A notice added to the README in pull request #1940 says MONAI Label "is not intended to be run as an internet-facing application." The same notice mentions known, unpatched security issues and tells users to keep the server on a closed local network.

Security releases 0.8.7 and 0.8.8

MONAI Label 0.8.7 and 0.8.8 both came out on November 25, 2026, less than six hours apart. The project labels each one a security release and tells all server deployments to upgrade. Four of the five advisories published that day concern code that 0.8.6 still ships. The scores in the table are CVSS 3.1, as the project gives them.

Advisory Severity Affected Fixed in Flaw
GHSA-j5c7-p3x5-gw2xCritical, 9.80.6.0 to 0.8.60.8.7Remote code execution through a client-supplied bundle_path in task requests
GHSA-cgpr-79vx-xr5xMedium, 6.5Up to 0.8.60.8.7DICOMweb datastore builds cache paths from unconfined image IDs
GHSA-gfjg-c3x6-24gwCritical, 9.80.7.0 to 0.8.70.8.8Remote code execution through request values in bundle inference and training
GHSA-xhxp-5f3g-gxxxCritical, 9.8Up to 0.8.70.8.8Code execution, file read and missing checks found in a maintainer review
GHSA-5c65-q9f6-h62qHigh, 8.2Up to 0.8.50.8.6Tar path traversal in session upload

The first critical flaw sat in the task endpoints. Requests to /train, /scoring and /batch/infer accepted a bundle_path value, and the server added it to the PYTHONPATH of the task process. In 0.8.7 the path comes only from the registered bundle trainer.

The second ran through the MONAI bundle configuration. Values from a request were copied into it, and a string that starts with $ is evaluated there as Python. Version 0.8.8 treats request values as plain data.

The third critical advisory collects what the maintainers found when they reviewed how request values and backend responses are used. Its list includes POST /reload, which had no role check and now requires the admin role. /proxy/dicom now rejects ../ in the path.

Release 0.8.8 also tightens the upload route analyzed above. According to the release notes, an image ID must be a plain, visible file name and the uploaded file must have an image extension. The default list in the notes does not include .py, the suffix the older code let through.

None of the five advisories carried a CVE number on GitHub on November 26, 2026. Both sets of notes repeat the maintainers' standing warning. Authentication is disabled by default, "so these issues are reachable by any client that can connect to the server."

The fix waited 34 days in the main branch

The fix reached the main branch on October 19 and stayed unreleased for 34 days. The newest tagged release in that period was 0.8.5, released on October 18, 2023. The advisory appeared on November 18, 2026, and said the fix would ship in the next release. MITRE published the CVE record on November 20, the day Amazon's report came out.

Date Event
September 8, 2026 Cairn campaign against East Asian universities begins, per Amazon
September 10, 2026 Amazon Threat Intelligence finds the exposed Cairn instance
October 12, 2026 Pull request #1915 opened
October 19, 2026 Fix merged into main as commit 113527b
November 18, 2026 Advisory GHSA-qc22-rmgc-vg94 published
November 20, 2026 Amazon report and CVE record for CVE-2026-133968 published
November 22, 2026 MONAI Label 0.8.6 released
November 23, 2026 CISA adds the flaw to the KEV catalog
November 25, 2026 MONAI Label 0.8.7 and 0.8.8 released with fixes for further critical flaws
November 26, 2026 CISA deadline for US federal agencies

A public commit titled "fix: confine datastore write paths" points straight at the bug. It shipped with regression tests and sat in view for 30 days ahead of the advisory and 34 days ahead of a release.

— AnonHaven Editorial Team

Affected versions, fixed builds and what to check

Every MONAI Label release up to and including 0.8.5 is vulnerable to CVE-2026-133968, and the fix for it ships in 0.8.6. The version to install is 0.8.8, because 0.8.6 and 0.8.7 carry the critical flaws listed above. Use pip install -U monailabel==0.8.8 or pull projectmonai/monailabel:0.8.8 from Docker Hub. Releases from 0.8.6 onward require Python 3.11 or newer, so older environments need a new interpreter first.

Source installs are fixed from commit 113527b onward. A quick test is to search monailabel/datastore/local.py for _confine_path, which is absent from 0.8.5.

MITRE, the numbering authority for this CVE, scored the flaw 9.8 with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. The project's GitHub advisory rates it critical without a number and files it under CWE-22. The CVE record uses the narrower CWE-24.

Where an upgrade must wait, the advisory lists three mitigations.

  • Set MONAI_LABEL_AUTH_ENABLE=True and keep the ANNOTATOR role away from untrusted users.
  • Keep the server off untrusted networks.
  • Run it as an unprivileged user whose write access ends at the datastore directory.

A patched server may still be a compromised one. The release notes tell operators of exposed 0.8.5 servers to review them for unexpected file changes before returning them to service. CISA's entry requires forensic triage under BOD 26-04 and sets November 26, 2026, as the deadline for federal agencies.

The code and Amazon's report suggest where to look first. The four checks below are our reading, not vendor guidance.

  • Any sitecustomize.py in the Python environment that runs the server.
  • Entries containing ../ in datastore_v2.json.
  • Server log lines beginning Adding Image or Saving Label for Image with path separators in the ID or tag, if INFO logging was on.
  • Traffic to or from 142[.]4.98.145 and 142[.]4.107.34, the addresses Amazon lists for September 8 to 10, 2026.

Sources for this analysis are the MONAI Label advisory GHSA-qc22-rmgc-vg94, the release notes for 0.8.6, 0.8.7 and 0.8.8, pull request #1915, the Amazon Threat Intelligence report and the CISA KEV entry.

Updated on November 26, 2026, to add security releases 0.8.7 and 0.8.8 and to change the upgrade advice from 0.8.6 to 0.8.8.

Table of Contents
  1. Contents are built when the page loads

Have a story? Become a contributor.

We work with independent researchers and cybersecurity professionals. Send us a tip or submit your article for editorial review.

Questions on the topic

What is CVE-2026-133968 in MONAI Label?
CVE-2026-133968 is a path traversal in MONAI Label's PUT /datastore/image endpoint with a CVSS score of 9.8. The image parameter lets a client write an uploaded file anywhere the server process can write, which leads to remote code execution.
Which MONAI Label versions are affected by CVE-2026-133968?
All MONAI Label releases up to and including 0.8.5 are affected. Version 0.8.6, released on November 22, 2026, contains the fix from pull request #1915. Install 0.8.8 instead, because 0.8.6 and 0.8.7 have other critical flaws that were fixed on November 25, 2026.
Does exploiting the MONAI Label path traversal require a login?
Not on a default install, because MONAI Label ships with authentication disabled and treats every client as admin. With authentication enabled, an attacker needs an account with the ANNOTATOR role.