# Python Pickle/Shelve Extended Deserialization

> Detects extended use of pickle, shelve, and marshal for deserializing untrusted data beyond basic patterns.

- Skill: `zakirkun/python-pickle-shelve-extended-deserialization` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/python-pickle-shelve-extended-deserialization`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/python-pickle-shelve-extended-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/python-pickle-shelve-extended-deserialization

---


# Python Pickle Extended Deserialization

## Overview
Beyond basic `pickle.loads()`, Python has several other insecure deserialization mechanisms:
- `shelve` (backed by pickle)
- `marshal.loads()` (bytecode deserialization)
- `pickletools`
- HTTP APIs passing pickled data in cookies or request bodies

## Remediation
- Replace with `json`, `msgpack`, or `protobuf`
- If using shelve/pickle for caching, ensure data source is trusted and server-controlled
- Never accept serialized Python objects from HTTP clients

