# Unsafe YAML Deserialization

> Detects YAML parsing using unsafe loaders that execute arbitrary Python or Ruby code embedded in YAML.

- Skill: `zakirkun/unsafe-yaml-deserialization` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/unsafe-yaml-deserialization`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/unsafe-yaml-deserialization/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/unsafe-yaml-deserialization

---


# Unsafe YAML Deserialization

## Overview
YAML loaders that support the full YAML specification (including `!!python/object/apply:`) can execute arbitrary code when parsing malicious YAML documents.

Python's `yaml.load()` without `Loader=yaml.SafeLoader` is the most common instance.

Malicious payload:
```yaml
!!python/object/apply:os.system ["id"]
```

## Remediation
- Python: Use `yaml.safe_load()` or `yaml.load(data, Loader=yaml.SafeLoader)`
- Ruby: Use `YAML.safe_load()` instead of `YAML.load()`
- Node.js: `js-yaml` uses `safeLoad` (default safe, but `load()` with `unsafe=true` is dangerous)

