Java Deserialization Vulnerability Methodology
Java deserialization is one of the most dangerous vulnerability classes in the Java ecosystem — once successful it usually leads straight to RCE.
⛔ Further Reading (Must Read)
- Need the ysoserial gadget chain priority table, URLDNS detection, and payload construction → references/ysoserial-gadgets.md
- Need JNDI injection, Fastjson version payloads, and Shiro/WebLogic/JBoss/Jenkins specifics → references/jndi-fastjson.md
Phase 1: Identify Java Deserialization Entry Points
1.1 Native Java Serialized Data (Magic Bytes)
- Binary:
\xac\xed\x00\x05 (hex: aced0005)
- After Base64 encoding: starts with
rO0AB
- After Gzip compression then Base64: starts with
H4sIAAAA
Check locations: cookies (rememberMe/VIEWSTATE), POST body, custom headers, WebSocket, RMI/T3/IIOP protocol ports
1.2 JSON Deserialization (Fastjson/Jackson)
- Fastjson: JSON contains an
@type field → references/jndi-fastjson.md
- Jackson:
DefaultTyping enabled → JSON contains a class name array ["com.xxx.Class", {...}]
- Identification: send malformed JSON and observe the library name in the error stack trace
1.3 Specific Middleware Ports
| Port |
Service |
Vulnerability Direction |
| 7001/7002 |
WebLogic |
T3/IIOP deserialization |
| 8009 |
AJP (Tomcat) |
GhostCat (CVE-2020-1938) |
| 1099 |
RMI Registry |
RMI deserialization |
| 1090/8500 |
JBoss JMX |
JMXInvokerServlet |
| 50000 |
Jenkins |
Jenkins CLI deserialization |
Phase 2: Exploitation Decision Tree
Deserialization entry point found
├─ Native serialization (rO0AB/aced0005)?
│ ├─ Confirm the vulnerability with URLDNS first → [references/ysoserial-gadgets.md](references/ysoserial-gadgets.md)
│ └─ Try CC1-7 → CommonsBeanutils → Spring → Groovy one by one
├─ Fastjson (`@type` field)?
│ └─ Identify the version → pick the matching payload → [references/jndi-fastjson.md](references/jndi-fastjson.md)
├─ Shiro (rememberMe=deleteMe)?
│ └─ Default key kPH+bIxk5D2deZiIxcaaaA== → [references/jndi-fastjson.md](references/jndi-fastjson.md)
└─ Log4j (Java application + user input)?
└─ ${jndi:ldap://...} → [references/jndi-fastjson.md](references/jndi-fastjson.md)
Notes
- Detect with URLDNS first, then try command-execution gadgets once the vulnerability is confirmed
- ysoserial's
Runtime.exec() does not support pipes/redirection, so Base64-encode the command
- The Java version affects how JNDI can be exploited (JDK < 8u191 is the simplest, 8u191+ needs a local gadget)
- Try multiple gadget chains one by one — different classpath environments suit different gadgets
1---2name: java-deserialization-methodology3description: "Java deserialization vulnerability detection and exploitation. Use when the target is a Java application (Tomcat/Spring/WebLogic/JBoss/Jenkins), when Base64 data starting with rO0AB/aced0005 is found, when HTTP requests carry a application/x-java-serialized-object Content-Type, or when T3/IIOP/RMI/JNDI protocol ports are present. Covers ysoserial gadget chains, JNDI injection, Fastjson/Jackson deserialization, Shiro rememberMe, and common middleware CVE exploitation"4zh-signals: "Java 反序列化漏洞检测与利用,覆盖 ysoserial gadget、JNDI 注入、Fastjson/Jackson、Shiro 与中间件 CVE。信号:Java反序列化,ysoserial,JNDI,Shiro,中间件CVE"5when-to-use: >-6 Use when targeting Java applications with serialized data (rO0AB/aced0005),7 T3/IIOP/RMI/JNDI ports, or middleware such as WebLogic, JBoss, or Jenkins.8metadata:9 source: https://skillmd.com/skills/dangeroussong/java-deserialization-methodology10 tags: "java,deserialization,ysoserial,jndi,rmi,ldap,fastjson,jackson,shiro,weblogic,jboss,jenkins,log4j,gadget,rce"11 category: "exploit"12---1314# Java Deserialization Vulnerability Methodology15- 攻击大类:C09 Web应用漏洞利用1617Java deserialization is one of the most dangerous vulnerability classes in the Java ecosystem — once successful it usually leads straight to RCE.1819## ⛔ Further Reading (Must Read)2021- Need the ysoserial gadget chain priority table, URLDNS detection, and payload construction → [references/ysoserial-gadgets.md](references/ysoserial-gadgets.md)22- Need JNDI injection, Fastjson version payloads, and Shiro/WebLogic/JBoss/Jenkins specifics → [references/jndi-fastjson.md](references/jndi-fastjson.md)2324---2526## Phase 1: Identify Java Deserialization Entry Points2728### 1.1 Native Java Serialized Data (Magic Bytes)29- Binary: `\xac\xed\x00\x05` (hex: `aced0005`)30- After Base64 encoding: starts with `rO0AB`31- After Gzip compression then Base64: starts with `H4sIAAAA`3233**Check locations**: cookies (`rememberMe`/`VIEWSTATE`), POST body, custom headers, WebSocket, RMI/T3/IIOP protocol ports3435### 1.2 JSON Deserialization (Fastjson/Jackson)36- Fastjson: JSON contains an `@type` field → [references/jndi-fastjson.md](references/jndi-fastjson.md)37- Jackson: `DefaultTyping` enabled → JSON contains a class name array `["com.xxx.Class", {...}]`38- Identification: send malformed JSON and observe the library name in the error stack trace3940### 1.3 Specific Middleware Ports4142| Port | Service | Vulnerability Direction |43|------|------|----------|44| 7001/7002 | WebLogic | T3/IIOP deserialization |45| 8009 | AJP (Tomcat) | GhostCat (CVE-2020-1938) |46| 1099 | RMI Registry | RMI deserialization |47| 1090/8500 | JBoss JMX | JMXInvokerServlet |48| 50000 | Jenkins | Jenkins CLI deserialization |4950## Phase 2: Exploitation Decision Tree5152```53Deserialization entry point found54├─ Native serialization (rO0AB/aced0005)?55│ ├─ Confirm the vulnerability with URLDNS first → [references/ysoserial-gadgets.md](references/ysoserial-gadgets.md)56│ └─ Try CC1-7 → CommonsBeanutils → Spring → Groovy one by one57├─ Fastjson (`@type` field)?58│ └─ Identify the version → pick the matching payload → [references/jndi-fastjson.md](references/jndi-fastjson.md)59├─ Shiro (rememberMe=deleteMe)?60│ └─ Default key kPH+bIxk5D2deZiIxcaaaA== → [references/jndi-fastjson.md](references/jndi-fastjson.md)61└─ Log4j (Java application + user input)?62 └─ ${jndi:ldap://...} → [references/jndi-fastjson.md](references/jndi-fastjson.md)63```6465## Notes66- **Detect with URLDNS first**, then try command-execution gadgets once the vulnerability is confirmed67- ysoserial's `Runtime.exec()` does not support pipes/redirection, so Base64-encode the command68- The Java version affects how JNDI can be exploited (JDK < 8u191 is the simplest, 8u191+ needs a local gadget)69- Try multiple gadget chains one by one — different classpath environments suit different gadgets