$ uv run python
Python 3.10.18 (main, Sep 2 2025, 14:19:37) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.load("!!python/object/apply:os.system ['echo PWNED']", Loader=yaml.Loader)
PWNED
0
>>>
Summary
Loading untrusted YAML with
yaml.Loaderoryaml.unsafe_loadaccepts!!python/object/applypayloads that invoke arbitrary Python functions and OS commands.poc:
Traceback:
Suggested Fix
yaml.Loaderatyaml.SafeLoaderby default. (Just like what was recommended in Remove Loader alias to UnsafeLoader and enhance security #851)!!python/object/*tags behind explicit opt-in. (At least block os.system)