Java-Deserialization-Cheat-Sheet
A cheat sheet for pentesters and researchers about deserialization vulnerabilities in various Java (JVM) serialization libraries.
Please, use #javadeser hash tag for tweets.
Java Native Serialization (binary)
Main talks & presentations & docs
by @frohoff & @gebl
Exploiting Deserialization Vulnerabilities in Java
by @matthias_kaiser
Serial Killer: Silently Pwning Your Java Endpoints
by @pwntester & @cschneider4711
Deserialize My Shorts: Or How I Learned To Start Worrying and Hate Java Object Deserialization
by @frohoff & @gebl
Surviving the Java serialization apocalypse
by @cschneider4711 & @pwntester
Java Deserialization Vulnerabilities - The Forgotten Bug Class
by @matthias_kaiser
Pwning Your Java Messaging With Deserialization Vulnerabilities
by @matthias_kaiser
Defending against Java Deserialization Vulnerabilities
by @lucacarettoni
A Journey From JNDI/LDAP Manipulation To Remote Code Execution Dream Land
by @pwntester and O. Mirosh
Fixing the Java Serialization mess
by @e_rnst
Blind Java Deserialization
by deadcode.me
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (JVM)
by @joaomatosf
Automated Discovery of Deserialization Gadget Chains
by @ianhaken
https://github.com/frohoff/ysoserial
ysoserial 0.6 payloads:
| payload |
author |
dependencies |
impact (if not RCE) |
| BeanShell1 |
@pwntester, @cschneider4711 |
bsh:2.0b5 |
|
| C3P0 |
@mbechler |
c3p0:0.9.5.2, mchange-commons-java:0.2.11 |
|
| Clojure |
@JackOfMostTrades |
clojure:1.8.0 |
|
| CommonsBeanutils1 |
@frohoff |
commons-beanutils:1.9.2, commons-collections:3.1, commons-logging:1.2 |
|
| CommonsCollections1 |
@frohoff |
commons-collections:3.1 |
|
| CommonsCollections2 |
@frohoff |
commons-collections4:4.0 |
|
| CommonsCollections3 |
@frohoff |
commons-collections:3.1 |
|
| CommonsCollections4 |
@frohoff |
commons-collections4:4.0 |
|
| CommonsCollections5 |
@matthias_kaiser, @jasinner |
commons-collections:3.1 |
|
| CommonsCollections6 |
@matthias_kaiser |
commons-collections:3.1 |
|
| CommonsCollections7 |
@scristalli, @hanyrax, @EdoardoVignati |
commons-collections:3.1 |
|
| FileUpload1 |
@mbechler |
commons-fileupload:1.3.1, commons-io:2.4 |
file uploading |
| Groovy1 |
@frohoff |
groovy:2.3.9 |
|
| Hibernate1 |
@mbechler |
|
|
| Hibernate2 |
@mbechler |
|
|
| JBossInterceptors1 |
@matthias_kaiser |
javassist:3.12.1.GA, jboss-interceptor-core:2.0.0.Final, cdi-api:1.0-SP1, javax.interceptor-api:3.1, jboss-interceptor-spi:2.0.0.Final, slf4j-api:1.7.21 |
|
| JRMPClient |
@mbechler |
|
|
| JRMPListener |
@mbechler |
|
|
| JSON1 |
@mbechler |
json-lib:jar:jdk15:2.4, spring-aop:4.1.4.RELEASE, aopalliance:1.0, commons-logging:1.2, commons-lang:2.6, ezmorph:1.0.6, commons-beanutils:1.9.2, spring-core:4.1.4.RELEASE, commons-collections:3.1 |
|
| JavassistWeld1 |
@matthias_kaiser |
javassist:3.12.1.GA, weld-core:1.1.33.Final, cdi-api:1.0-SP1, javax.interceptor-api:3.1, jboss-interceptor-spi:2.0.0.Final, slf4j-api:1.7.21 |
|
| Jdk7u21 |
@frohoff |
|
|
| Jython1 |
@pwntester, @cschneider4711 |
jython-standalone:2.5.2 |
|
| MozillaRhino1 |
@matthias_kaiser |
js:1.7R2 |
|
| MozillaRhino2 |
@_tint0 |
js:1.7R2 |
|
| Myfaces1 |
@mbechler |
|
|
| Myfaces2 |
@mbechler |
|
|
| ROME |
@mbechler |
rome:1.0 |
|
| Spring1 |
@frohoff |
spring-core:4.1.4.RELEASE, spring-beans:4.1.4.RELEASE |
|
| Spring2 |
@mbechler |
spring-core:4.1.4.RELEASE, spring-aop:4.1.4.RELEASE, aopalliance:1.0, commons-logging:1.2 |
|
| URLDNS |
@gebl |
|
jre only vuln detect |
| Vaadin1 |
@kai_ullrich |
vaadin-server:7.7.14, vaadin-shared:7.7.14 |
|
| Wicket1 |
@jacob-baines |
wicket-util:6.23.0, slf4j-api:1.6.4 |
|
Additional tools (detection, integration ysoserial with Burp Suite):
Additional tool to test RMI:
Full shell (pipes, redirects and other stuff):
How it works:
https://github.com/pwntester/JRE8u20_RCE_Gadget
Pure JRE 8 RCE Deserialization gadget
https://github.com/GrrrDog/ACEDcup
File uploading via:
- Apache Commons FileUpload <= 1.3 (CVE-2013-2186) and Oracle JDK < 7u40
Universal billion-laughs DoS
https://gist.github.com/coekie/a27cc406fc9f3dc7a70d
Won't fix DoS via default Java classes (JRE)
Universal Heap overflows DoS using Arrays and HashMaps
https://github.com/topolik/ois-dos/
How it works:
Won't fix DoS using default Java classes (JRE)
DoS against Serialization Filtering (JEP-290)
no spec tool - You don't need a special tool (just Burp/ZAP + payload)
- Protocol
- Default - 1099/tcp for rmiregistry
ysoserial (works only against a RMI registry service)
- Protocol based on RMI
-
- partially patched in JRE
ysoserial
mjet
JexBoss
https://github.com/zerothoughts/jndipoc
JMET
- if no encryption or good mac
no spec tool
JexBoss
loubia (tested on 11g and 12c, supports t3s)
JavaUnserializeExploits (doesn't work for all Weblogic versions)
WLT3Serial
CVE-2018-2628 sploit
JavaUnserializeExploits
serialator
CoalfireLabs/java_deserialization_exploits
- When using custom form authentication
- WASPostParam cookie
- Full info
no spec tool
- http://jboss_server/invoker/JMXInvokerServlet
- Default port - 8080/tcp
- CVE-2015-7501
JavaUnserializeExploits
https://github.com/njfox/Java-Deserialization-Exploit
serialator
JexBoss
- http://jboss_server/invoker/readonly
- Default port - 8080/tcp
- CVE-2017-12149
- JBoss 6.X and EAP 5.X
- Details
no spec tool
- http://jboss_server/jbossmq-httpil/HTTPServerILServlet/
- <= 4.x
- CVE-2017-7504
no spec tool
JavaUnserializeExploits
JexBoss
ysoserial
- Jenkins CLI LDAP
- *Default port - High number/tcp
- <= 2.32
- <= 2.19.3 (LTS)
- CVE-2016-9299
Sploit
- <= 2.1.2
- When Rest API accepts serialized objects (uses ObjectRepresentation)
no spec tool
- *When Rest API accepts serialized objects (uses @Consumes({"*/*"}) or "application/*" )
- Details and examples
no spec tool
ysoserial
ysoserial
no spec tool
Symantec Endpoint Protection Manager
serialator
Oracle MySQL Enterprise Monitor
no spec tool
serialator
PowerFolder Business Enterprise Suite
powerfolder-exploit-poc
Solarwinds Virtualization Manager
ysoserial
Cisco Prime Infrastructure
- https://[target]/xmp_data_handler_service/xmpDataOperationRequestServlet
- <= 2.2.3 Update 4
- <= 3.0.2
- CVE-2016-1291
CoalfireLabs/java_deserialization_exploits
ysoserial
- all version, no fix (the project is not supported)
- POST XML request with ex:serializable element
- Details and examples
no spec tool
no spec tool
- https://[target]/developmentserver/metadatauploader
- CVE-2017-9844
PoC
no spec tool
- 1.0.0 <= version < 1.0.13
- 1.2.1 <= version < 1.2.14
- 2.0.0 <= version < 2.0.1
- 2.1.0 <= version < 2.1.1
- it does not check MAC
- CVE-2016-5019
no spec tool
JexBoss
exploit
- /api/spring
- /api/liferay
- <= 7.0-ga3
- if IP check works incorrectly
- Details
no spec tool
PoC
ManageEngine Applications Manager
ysoserial
HP IMC (Intelligent Management Center)
Metasploit module
HP IMC (Intelligent Management Center)
ysoserial
Apache ActiveMQ - Client lib
JMET
Redhat/Apache HornetQ - Client lib
JMET
Oracle OpenMQ - Client lib
JMET
IBM WebSphereMQ - Client lib
JMET
Oracle Weblogic - Client lib
JMET
Pivotal RabbitMQ - Client lib
JMET
IBM MessageSight - Client lib
JMET
IIT Software SwiftMQ - Client lib
JMET
Apache ActiveMQ Artemis - Client lib
JMET
Apache QPID JMS - Client lib
JMET
JMET
Amazon SQS Java Messaging - Client lib
JMET
java -jar ysoserial-*-all.jar CommonsCollections1 'COMMAND_HERE' | nc TARGET_SERVER 5001
ysoserial
ysoserial
- <= 3.0.1
- RMI
- When using Distributed Test only
- Exploit
ysoserial
- <= 1.4.0
- JNDI injection
- /jolokia/
- Exploit
ysoserial
- Magic bytes 'ac ed 00 05' bytes
- 'rO0' for Base64
- 'application/x-java-serialized-object' for Content-Type header
- Nmap >=7.10 has more java-related probes
- use nmap --all-version to find JMX/RMI on non-standart ports
Vulnerable apps (without public sploits/need more info)
Spring Service Invokers (HTTP, JMS, RMI...)
- CVE-2015-8360
- 2.3.1 <= version < 5.9.9
- Bamboo JMS port (port 54663 by default)
- only Jira with a Data Center license
- RMI (port 40001 by default)
- JRA-46203
- custom(?) protocol(60024/tcp)
- article
Oracle Application Testing Suite
VMWare vRealize Operations
VMWare vCenter/vRealize (various)
Lexmark Markvision Enterprise
McAfee ePolicy Orchestrator
HP Operations Orchestration
HP Continuous Delivery Automation
HP P9000, XP7 Command View Advanced Edition (CVAE) Suite
Unify OpenScape (various)
- 9-9.5.5, 10.0.0-10.0.2, 10.1.0-Xpress, 11.0.0-11.0.3 and 12.0.0
- 201505-01
- SOAP connector
- <= 9.0.0.9
- <= 8.5.5.14
- <= 8.0.0.15
- <= 7.0.0.45
- CVE-2018-1567
Main talks & presentations & docs
How it works:
- java.beans.XMLDecoder
- readObject
Exploit
XStream (XML/JSON/various)
How it works:
Exploit
- com.thoughtworks.xstream.XStream
- xs.fromXML(data)
Vulnerable apps (without public sploits/need more info):
How it works:
- com.esotericsoftware.kryo.io.Input
- SomeClass object = (SomeClass)kryo.readClassAndObject(input);
- SomeClass someObject = kryo.readObjectOrNull(input, SomeClass.class);
- SomeClass someObject = kryo.readObject(input, SomeClass.class);
Hessian/Burlap (binary/XML)
How it works:
- com.caucho.hessian.io
- AbstractHessianInput
- com.caucho.burlap.io.BurlapInput;
- com.caucho.burlap.io.BurlapOutput;
- BurlapInput in = new BurlapInput(is);
- Person2 p1 = (Person2) in.readObject();
How it works:
- org.codehaus.castor
- org.exolab.castor.xml.Unmarshaller
- org.springframework.oxm.Unmarshaller
- Unmarshaller.unmarshal(Person.class, reader)
- unmarshaller = context.createUnmarshaller();
- unmarshaller.unmarshal(new StringReader(data));
Vulnerable apps (without public sploits/need more info):
How it works:
Exploitation examples:
- com.cedarsoftware.util.io.JsonReader
- JsonReader.jsonToJava
vulnerable in specific configuration
How it works:
- com.fasterxml.jackson.databind.ObjectMapper
- ObjectMapper mapper = new ObjectMapper();
- objectMapper.enableDefaultTyping();
- @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
- public Object message;
- mapper.readValue(data, Object.class);
Vulnerable apps (without public sploits/need more info):
How it works (in Chinese):
- com.alibaba.fastjson.JSON
- JSON.parseObject
How it works:
- com.owlike.genson.Genson
- useRuntimeType
- genson.deserialize
How it works:
- org.red5.io
- Deserializer.deserialize(i, Object.class);
Vulnerable apps (without public sploits/need more info):
Apache Flex BlazeDS (AMF)
How it works:
Vulnerable apps (without public sploits/need more info):
How it works:
How it works:
How it works:
How it works:
- org.yaml.snakeyaml.Yaml
- yaml.load
Vulnerable apps (without public sploits/need more info):
How it works:
- org.ho.yaml.Yaml
- Yaml.loadType(data, Object.class);
How it works:
- com.esotericsoftware.yamlbeans
- YamlReader r = new YamlReader(data, yc);
Some serialization libs are safe (or almost safe) https://github.com/mbechler/marshalsec
However, it's not a recommendation, but just a list of other libs that has been researched by someone:
- JAXB
- XmlBeans
- Jibx
- Protobuf
- GSON
- GWT-RPC