web-deserialization

A security-testing guide for insecure deserialization, a flaw where an application turns attacker-controlled data back into objects without checking it safely. In some web applications, this can lead to running code on the server.

In plain words
What is it for?
Use it during authorized testing of Java, PHP, .NET, Python, or Node web applications that process serialized data.
Why use it?
It helps identify unsafe handling of serialized cookies, tokens, uploads, or request data and determine whether the flaw has serious impact.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/s0ld13rr/pentestcode/deserialization
Any agent
npx skills add s0ld13rr/pentestcode --skill deserialization
Clone the repo
git clone --depth 1 https://github.com/s0ld13rr/pentestcode

Made for: Claude Code, Codex.

Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00098 $0.00718
Opus 5 $0.00049 $0.00359
Sonnet 5 $0.00020 $0.00144
Haiku 4.5 $0.00010 $0.00072

Measured 2d ago against content hash b6bf5f825c0e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

web-deserialization scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

# Python — pickle __reduce__ → os.system('id') ; Node — node-serialize _$$ND_FUNC$$_ IIFE
skills/web/deserialization/SKILL.md · 38 lines

How it starts

The opening of the file, as written. The whole thing — 38 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Insecure Deserialization → RCE

When this fires

Attacker-controlled data is deserialized: cookies/tokens/hidden fields that decode to a serialized object, __VIEWSTATE, RMI/HTTP-invoker/message-queue bodies, or a known deser-CVE stack (see web-framework-rce for the CVE map).

Decide — fingerprint the format FIRST

  • base64 rO0AB... or raw hex AC ED 00 05Java (ObjectInputStream).
  • O:8:"ClassName":...PHP (unserialize()).
  • __VIEWSTATE / AAEAAAD....NET (BinaryFormatter/LosFormatter).
  • python pickle opcodes (\x80\x04, c__builtin__) → Python.
  • {"rce":"_$$ND_FUNC$$_..."}Node (node-serialize).

Exploit → PROVE IMPACT (gadget chains)

# Java — ysoserial (pick a gadget matching the classpath: CommonsCollections1-7, URLDNS to test reachability first):
java -jar ysoserial.jar CommonsCollections6 'id' | base64 -w0        # place in the sink
#   iterate gadgets: URLDNS/JRMPClient to confirm deser happens, then CC/Spring/Hibernate for RCE
# PHP — phpggc (find the framework's gadget: Laravel/Symfony/Monolog/Guzzle):
phpggc Monolog/RCE1 system id
# .NET — ysoserial.net -g TypeConfuseDelegate -f BinaryFormatter -c "cmd /c ..."
# Python — pickle __reduce__ → os.system('id')  ;  Node — node-serialize _$$ND_FUNC$$_ IIFE

Proof required: id/uname (RCE). If the classpath is unknown, confirm deserialization first with a benign OOB gadget (Java URLDNS → your listener), then find the working RCE gadget; log each attempted gadget via record_vector attempt: so you don't re-try dead chains.

Tooling

ysoserial (Java), phpggc (PHP), ysoserial.net (.NET), gadgetinspector for custom classpaths; nuclei -tags deserialization.

False positives / pitfalls

  • Signed/encrypted blobs (HMAC'd cookies, encrypted VIEWSTATE) → you need the key first (leaked/weak/default) — see web-auth-bypass-idor for key recovery; don't brute blindly.
  • Gadget must match the LIBRARIES on the classpath — a failed CC1 doesn't mean not-vulnerable; iterate the gadget set.
  • Length/type validation before deser → may need to satisfy a wrapper.

Read the full file on GitHub · 38 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 38 lines · 98 tokens per session scan A b6bf5f825c0e

Subscribe to this mod's changes

web-deserialization is a skill published in the GitHub repository s0ld13rr/pentestcode (566 stars, last pushed 11d ago), licensed MIT. It adds 98 tokens to every session and 718 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.