
Intentionally vulnerable Python lab demonstrating unsafe YAML deserialization leading to code execution, with three difficulty levels, exploit scripts, hints, and a patched comparison app.
An intentionally vulnerable, local-only Python lab for learning how unsafe YAML deserialization can become a code-execution path. It includes three difficulty levels, a patched comparison app, exploit scripts, hints, write-ups, and a small scoreboard.
Safety: Run this project only on a disposable local machine or isolated virtual environment. Do not expose the challenge apps to a public network.
| Variant | Focus |
|---|
| Easy | Direct vulnerable endpoint and clear exploit path |
| Medium | Decoy routes and a fake sanitizer |
| Hard | Hidden route, encoded payloads, and multi-stage flag flow |
The project also includes:
yaml.safe_load() comparisonpython3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
pytest -q
python3 challenge_runner.py start --variant easy
Use the variant README files for the intended challenge flow. The apps bind to localhost by default and do not require Docker.
The vulnerable variants intentionally use a Python-object-capable YAML loader on attacker-controlled input:
yaml.load(data, Loader=yaml.Loader)
The comparison implementation uses the safer loader:
yaml.safe_load(data)
Never use yaml.Loader for untrusted YAML in a real application. This lab is
for defensive training and authorized testing only.
Released under the MIT License.