# Hostile Inference: Exploiting Docker Model Runner for Container Escapes

Unauthenticated argument injection in Docker Model Runner's _configure endpoint lets a stock container pass llama-server flags, achieving host file read/write and RCE via Docker Extensions.

- Payout: Research
- Severity: high
- Program: Docker
- Write-up by: Nitesh Surana
- Disclosed: 2026-11-18
- CVE: CVE-2026-28400
- Write-up quality: 9/10
- Original: https://www.thezdi.com/blog/2026/11/17/hostile-inference-exploiting-docker-model-runner-for-container-escapes
- Library page: https://bugbountylibrary.com/r/blog%3Athezdi-com-blog-2026-11-17-hostile-inference-exploiting-docker-model-runner-for-container-escapes
- Tags: area:os domain:desktop impact:data-leak impact:rce kind:research platform:research sev:high tech:docker tech:llm technique:chained technique:source-review vuln:command-injection vuln:path-traversal vuln:sandbox-escape

**Target:** Docker Model Runner REST API (model-runner.docker.internal) and llama-server host process
**Root cause:** The /engines/_configure endpoint appends attacker-supplied runtime-flags/raw-runtime-flags as llama-server command-line arguments without validation, and llama-server runs on the host (outside the VM) under a permissive Seatbelt profile (macOS) or a Job Object with no filesystem restrictions (Windows).
**Steps:**
1. From a default container, POST to `http://model-runner.docker.internal/engines/_configure` with JSON body containing `runtime-flags` (or `raw-runtime-flags`) set to llama-server flags such as `--log-file <path>` or `--grammar-file <path>`, plus the target `model`.
2. Trigger the runner spawn via `/v1/chat/completions` (or `/v1/embeddings`) for that model so the persisted flags are appended to llama-server's argv.
3. On Windows, leak the username first: point `--log-file` at a UNC path to an attacker SMB server, or pass an invalid argument and read the username from llama-server's error log.
4. Use `--grammar-file`/`--chat-template-file` to read host files (Docker Desktop logs, extension names); use `--log-file` to overwrite files under the permitted Data tree (macOS) or any user-writable path (Windows).
5. Pull a crafted GGUF via `/models/create` whose `general.name` metadata is a JS payload, or use `--verbose`/`--override-kv` to inject content into logs.
6. Point `--log-file` at an installed extension's `index.html` and run inference so the log (with JS payload) overwrites it.
7. When the user opens the extension, the renderer executes the injected JS, calling `ddClient.docker.cli.exec` to create a helper container mounting the VM root at /hostOS and write an executable into the extension's host/ dir, then `ddClient.extension.host.cli.exec` to run it on the host.
**How found:** Asked whether a stock container could reach the host; audited DMR's _configure handler and traced runtime-flags into llama-server argv, then enumerated llama-server file-operation flags (--grammar-file, --chat-template-file, --log-file) and checked which paths the Seatbelt profile and Windows Job Object actually permit. Noticed Job Objects impose no filesystem restrictions and that the Seatbelt profile allows the Data subtree, then hunted for a partially-controlled write sink (GGUF metadata/logging) and a predictable host execution path (Docker Extensions).
**Exploitation:** A stock container with default privileges calls the unauthenticated DMR API to inject llama-server flags; the host-side llama-server then reads/writes host files. Attacker-controlled GGUF metadata or --verbose/--override-kv content pollutes logs, which are written over a Docker Extension's index.html. When the user opens the extension, injected JS uses the Extensions SDK to drop and execute a binary on the host with the Docker Desktop user's privileges.
**Escalation:** Chained argument injection -> host file read/write -> log-content control -> extension asset overwrite -> renderer JS execution -> ddClient host CLI exec for full host RCE. Separately, a single ddClient call plus replacing ~/.docker/bin/inference/com.docker.llama-server with a script and invoking `open -a` escapes the Seatbelt sandbox via launchservicesd (ZDI-26-451); and toggling onlyMarketPlaceExtensions via /run/host-services/backend.sock /app/settings re-enables arbitrary extension install from a compromised WSL2 VM (ZDI-26-258).
**Insight:** When a host-side helper process is launched with attacker-influenced argv, enumerate its file-I/O flags and map them against the actual sandbox policy rather than assuming the sandbox is equivalent across OSes; a permissive `(allow default)` Seatbelt profile plus a writable Data subtree turns a log-file flag into an asset-overwrite primitive, and predictable extension asset paths make the final hop to code execution.

