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
- Severity
- Critical
- CVE
- CVE-2026-47117
- Category
- web
- Affected product
- 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
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-47117
- https://www.cve.org/CVERecord?id=CVE-2026-47117
- https://www.vulncheck.com/advisories/openmed-remote-code-execution-via-pii-model-loading
- https://github.com/maziyarpanahi/openmed/releases/tag/v1.5.2
- https://github.com/maziyarpanahi/openmed/commit/98724f65df98d7518b9006e6356740aa36c2f224
- https://github.com/maziyarpanahi/openmed/pull/59
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-10-11 (upstream commit 51828c7, “Updated README”); the runner and model fixture were last changed on 2026-08-15 in commit d9318fb |
| Author / Researcher | Sai Teja Erukude (GitHub: SaiTeja-Erukude), discoverer and reporter; coordinated disclosure through VulnCheck |
| CVE / Advisory | CVE-2026-47117 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.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 |
| Status | PoC (working lab demonstration of code execution through a marker file; not a weaponized shell) |
| Tags | RCE, Python, FastAPI, Hugging Face, Transformers, remote model loading, untrusted code, CWE-94, unauthenticated |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | OpenMed (Python medical NLP library and FastAPI REST service) |
| Versions Affected | All versions before 1.5.2; the archived PoC was built and documented against 1.4.0 |
| Language / Platform | Python 3.10+, FastAPI/Uvicorn, PyTorch and Hugging Face Transformers; Linux and macOS |
| Authentication Required | No |
| Network Access Required | Yes — 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:
- User-controlled model routing.
POST /pii/extractandPOST /pii/deidentifypass the request-bodymodel_nametovalidate_model_name()and then to the PII dispatcher.validate_model_name()explicitly allows an existing local path as well as anyorg/modelHub-style name, and the dispatcher’s_looks_like_privacy_filter_identifier()returns true for any normalized identifier containing the substringprivacy-filter. There is no allowlist of first-party repositories. A value such asattacker/foo-privacy-filter-baris therefore accepted and routed to the privacy-filter pipeline. - Remote code trust on the model repository.
PrivacyFilterTorchPipeline.__init__inopenmed/torch/privacy_filter.pydefaultstrust_remote_code=Trueand forwards it to bothAutoTokenizer.from_pretrained()andAutoModelForTokenClassification.from_pretrained(). Transformers then honours theauto_mapentries inconfig.jsonandtokenizer_config.jsonand 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.
| |
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
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, httpxSetup Steps
| |
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
Install the vulnerable package — creates the OpenMed 1.4.0 environment.
Shell script1 2python3 -m venv .venv && . .venv/bin/activate pip install -r requirements.txtRegenerate the model checkpoint — the omitted binary fixture is recreated from
generate_bin.py.Shell script1(cd foo-privacy-filter-bar && python generate_bin.py)Confirm the marker is absent — establishes the before state.
Shell script1rm -f marker.txtSend the malicious model identifier —
run_poc.pycreates the real OpenMed app withcreate_app()and posts to/pii/extractwithmodel_nameset to the localfoo-privacy-filter-bardirectory. It also prints the routing decision for a Hub-style name,attacker/foo-privacy-filter-bar.Shell script1python run_poc.pyRead the proof — the marker is written by the
auto_mapmodules duringfrom_pretrained().Shell script1cat marker.txtOptional machine-readable evidence — exits 0 only when routing, HTTP 200 and both imports succeed.
Shell script1python run_poc.py --json
Exploit Code
See
run_poc.pyfor the full runner andfoo-privacy-filter-bar/for the malicious model fixture.upstream-README.mdandupstream-exploit-walkthrough.mdpreserve the researcher’s own description.
The model’s config.json points Transformers at attacker-controlled classes:
| |
Those modules run at import time, before the endpoint performs inference:
| |
The request that reaches the vulnerable loader is a single unauthenticated POST:
| |
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
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_codeWith --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
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 timeSIEM / IDS Rule (example):
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
| Action | Detail |
|---|---|
| Patch | Upgrade 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. |
| Workaround | Do 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 Hardening | If 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.binis a 1.6 KB binary checkpoint and was omitted under the archive’s no-binaries policy.foo-privacy-filter-bar/generate_bin.pyrecreates the equivalent file; step 2 above is required beforerun_poc.pycan return HTTP 200. - The upstream 15.5 MB
Openmed 1.4.0 RCE PoC.mkvscreen recording was excluded as media larger than 2 MB. run_poc.pyuses FastAPITestClientand 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 isrun_poc.py. The preserved upstream documents are otherwise unmodified. - The PoC was not executed while preparing this archive entry.
| |