haryy985/yunkun-console-preview/deserialization-insecure
Claude Code and agent skill by haryy985/yunkun-console-preview
- community
Checking that the SKILL.md file is still in the repository.
Insecure deserialization playbook. Use when Java, PHP, or Python applications deserialize untrusted data via ObjectInputStream, unserialize, pickle, or similar mechanisms that may lead to RCE, file access, or privilege escalation.
Install
npx vskill@latest install haryy985/yunkun-console-preview/deserialization-insecureSKILL.md
SKILL: Insecure Deserialization — Expert Attack Playbook
AI LOAD INSTRUCTION: Expert deserialization techniques across Java, PHP, and Python. Covers gadget chain selection, traffic fingerprinting, tool usage (ysoserial, PHPGGC), Shiro/WebLogic/Commons Collections specifics, Phar deserialization, and Python pickle abuse. Base models often miss the distinction between finding the sink and finding a usable gadget chain.
0. RELATED ROUTING
../../../skills/skill/knowledge-base/jndi-injection-test.mdwhen deserialization leads to JNDI lookup (e.g., post-JDK 8u191 bypass via LDAP → deserialization)../../../references/playbooks/unauth-access.mdwhen the deserialization endpoint is an exposed management service (RMI Registry, T3, AJP)
1. TRAFFIC FINGERPRINTING — IS IT DESERIALIZATION?
Java Serialized Objects
| Indicator | Where to Look | |
|---|---|---|
Hex ac ed 00 05 | Raw binary in request/response body, cookies, POST params | |
Base64 rO0AB | Cookies (rememberMe), hidden form fields, JWT claims | |
Content-Type: application/x-java-serialized-object | HTTP headers | |
| T3/IIOP protocol traffic | WebLogic ports (7001, 7002) |
PHP Serialized Objects
| Indicator | Where to Look | |
|---|---|---|
O:NUMBER:"ClassName" pattern | POST body, cookies, session files | |
a:NUMBER:{ (array) | Same locations | |
phar:// URI usage | File operations accepting user-controlled paths |
Python Pickle
| Indicator | Where to Look | |
|---|---|---|
Hex 80 03 or 80 04 (protocol 3/4) | Binary data in requests, message queues | |
| Base64-encoded binary blob | API params, cookies, Redis values | |
pickle.loads / pickle.load in source | Code review / whitebox |
2. JAVA — GADGET CHAINS AND TOOLS
ysoserial — Primary Tool
URLDNS — Safe Confirmation Probe
URLDNS triggers a DNS lookup without RCE — safe for confirming deserialization without damage:
DNS hit on collaborator = confirmed deserialization. Then escalate to RCE chains.
Commons Collections — The Classic Chain
The vulnerability exists when org.apache.commons.collections (3.x) is on the classpath and the application calls readObject() on untrusted data.
Key classes in the chain: InvokerTransformer → ChainedTransformer → TransformedMap → triggers Runtime.exec() during deserialization.
Apache Shiro — rememberMe Deserialization
Shiro uses AES-CBC to encrypt serialized Java objects in the rememberMe cookie.
Attack flow:
- Detect: response sets
rememberMe=deleteMecookie on invalid session - Generate ysoserial payload (CommonsCollections6 recommended for broad compat)
- AES-CBC encrypt with known key + random IV
- Base64-encode → set as
rememberMecookie value - Send request → server decrypts → deserializes → RCE
DNSLog confirmation (before full RCE): use URLDNS chain → java -jar ysoserial.jar URLDNS "http://xxx.dnslog.cn" → encrypt → set cookie → check DNSLog for hit.
Post-fix (random key): Key may still leak via padding oracle, or another CVE (SHIRO-721).
WebLogic Deserialization
Multiple vectors:
- T3 protocol (port 7001): direct serialized object injection
- XMLDecoder (CVE-2017-10271): XML-based deserialization via
/wls-wsat/CoordinatorPortType - IIOP protocol: alternative to T3
Java RMI Registry
RMI Registry (port 1099) accepts serialized objects by design:
JDK Version Constraints
| JDK Version | Impact | |
|---|---|---|
| < 8u121 | RMI/LDAP remote class loading works | |
| 8u121-8u190 | trustURLCodebase=false for RMI; LDAP still works | |
| >= 8u191 | Both RMI and LDAP remote class loading blocked | |
| >= 8u191 bypass | Use LDAP → return serialized gadget object (not remote class) |
3. PHP — unserialize AND PHAR
Magic Method Chain
PHP deserialization triggers magic methods in order:
Attack: craft a serialized object whose __destruct() or __wakeup() triggers dangerous operations (file write, SQL query, command execution, SSRF).
Serialized Object Format
phpMyAdmin Configuration Injection (Real-World Case)
phpMyAdmin PMA_Config class reads arbitrary files via source property:
PHPGGC — PHP Gadget Chain Generator
Phar Deserialization
Phar archives contain serialized metadata. Any file operation on a phar:// URI triggers deserialization — even when unserialize() is never directly called.
Triggering functions (partial list):
Attack flow:
- Upload a valid file (e.g., JPEG with phar polyglot)
- Trigger file operation:
file_exists("phar://uploads/avatar.jpg") - PHP deserializes phar metadata → gadget chain executes
4. PYTHON — PICKLE
__reduce__ Method
Python's pickle.loads() calls __reduce__() on objects during deserialization, which can return a callable + args:
Analyzing Pickle Opcodes
Common Python Deserialization Sinks
Defensive Bypass: RestrictedUnpickler
Even when RestrictedUnpickler.find_class is used, check if the whitelist is too broad:
If safe_builtins includes eval, exec, or __import__ → still exploitable.
5. DETECTION METHODOLOGY
6. DEFENSE AWARENESS
| Language | Mitigation | |
|---|---|---|
| Java | JEP 290 deserialization filters; whitelist allowed classes; avoid ObjectInputStream on untrusted data; use JSON/Protobuf instead | |
| PHP | Avoid unserialize() on user input; use json_decode() instead; block phar:// in file operations | |
| Python | Use pickle only for trusted data; use json for external input; PyYAML: always use yaml.safe_load() |
7. QUICK REFERENCE — KEY PAYLOADS
8. RUBY DESERIALIZATION
Ruby Marshal
Marshal.loadon untrusted data → RCE- Fingerprint: binary data, no common text header
- Gadget chains exist for various Ruby versions
- Docker verification: hex payload via
[hex_string].pack("H*")
Ruby YAML (YAML.load)
YAML.load(notYAML.safe_load) executes arbitrary Ruby objects- Pre Ruby 2.7.2:
Gem::Requirementchain →git_set: id/git_set: sleep 600 - Ruby 2.x-3.x:
Gem::Installer→TarReader→Kernel#systemchain (longer, multi-step) - Always test:
YAML.load("--- !ruby/object:Gem::Installer\ni: x")for class instantiation check - Payload template:
- Note:
YAML.safe_loadis safe (Ruby 2.1+);Psych.safe_loadalso safe
9. .NET DESERIALIZATION
- Traffic fingerprint:
- BinaryFormatter: hex
AAEAAD(base64AAEAAAD/////) - ViewState: hex
FF01or/wprefix - JSON.NET:
$typeproperty in JSON - BinaryFormatter (most dangerous, deprecated in .NET 5+): arbitrary type instantiation
- XmlSerializer:
ObjectDataProvider+XamlReaderchain for command execution
``xml <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="http://schemas.microsoft.com/powershell/2004/04" type="System.Windows.Data.ObjectDataProvider"> <od:MethodName>Start</od:MethodName> <od:MethodParameters><sys:String>cmd</sys:String><sys:String>/c calc</sys:String></od:MethodParameters> <od:ObjectInstance xsi:type="System.Diagnostics.Process"/> </root> ``
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsource/skills/yunkun-security-workflow/references/references/experts/deserialization-insecure/SKILL.md
Popularity
- Repository stars
- 131
- Repository forks
- 7
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/haryy985/yunkun-console-preview/deserialization-insecure)