SlideShare a Scribd company logo
Mitigating Java
Deserialization attacks from
within the JVM
Apostolos Giannakidis
@cyberApostle
BSides Luxembourg
20th October 2017
1
Who is
BACKGROUND
◈ Security Architect at Waratek
◈ AppSec
◈ Runtime protection
◈ Vulnerability and exploit analysis
◈ R&D exploit mitigation
◈ MSc Computer Science
2
Key Takeaways
◈ Black/White listing is not an enterprise-scale solution
◈ Instrumentation Agents can be manipulated
◈ Runtime Virtualization offers memory isolation
◈ Runtime Privilege De-escalation safeguards application
components and the JVM from API Abuse
3
Attack Vectors
● RPC/IPC
● Message Brokers
● Caching
● Tokens / Cookies
● RMI
● JMX
● JMS
● ...
Why should I care?
Attack Surface
● Oracle
● Red Hat
● Apache
● IBM
● Symantec
● Cisco
● Atlassian
● Adobe
● ...
4
Impact & Popularity
● Reliable attack
● Easy to exploit
● All software layers
● OWASP Top 10 2017
● Oracle Java SE CPUs
● SF Muni breach
⬥ ~ 900 computers
⬥ ~$560k daily loss
Serialization 101
5
Deserialization of untrusted data
What is the problem here?
InputStream untrusted = request.getInputStream();
ObjectInputStream ois = new ObjectInputStream(untrusted);
SomeObject deserialized = (SomeObject) ois.readObject();
6
Deserialization of untrusted data
What is the problem here?
◈ Any available class can be deserialized
◈ Deserializing untrusted data can result in malicious behavior
⬥ Arbitrary code execution
⬥ Denial of Service
⬥ Remote command execution
⬦ Malware / Ransomware infection
InputStream untrusted = request.getInputStream();
ObjectInputStream ois = new ObjectInputStream(untrusted);
SomeObject deserialized = (SomeObject) ois.readObject();
7
How to solve the problem?
◈ Stop using deserialization
⬥ Requires significant refactoring
⬥ Requires architectural changes
⬥ Endpoints in other software layers?
⬥ Legacy software?
◈ Patch your software
⬥ “It is possible that some REST actions stop working” -
CVE-2017-9805
⬥ Oracle CPU October 2017 breaks backwards compatibility
8
Java Security Manager
◈ Custom Security Policy
Filtering Class names
◈ Serialization Filtering (JEP-290)
◈ Custom Instrumentation Agents
Runtime Virtualization
◈ Micro-compartmentalization
◈ Privilege De-escalation
Existing Runtime Mitigation Techniques
9
Java Security Manager
◈ Difficult to configure it correctly
◈ Performance issues
◈ No protection against DoS attacks
◈ No protection against deferred deserialization attacks
Critical Patch Update # vuls that can bypass the sandbox
October 2017 18
July 2017 26
April 2017 8
January 2017 14 10
Discussion Time: Filtering class names
Blacklisting Whitelisting
11
Blacklisting
● Requires profiling
● Never complete
● False sense of security
● Not possible if class is needed
● Can be bypassed
Discussion Time: Filtering class names
Whitelisting
● Requires profiling
● Difficult to do it right
● False positives if misconfigured
● No protection if class is needed
● No protection against Golden
Gadgets
● Requires code reviews & testing
12
Whitelists are commonly mistreated
13
Maintaining lists is a shity job
14
Serialization Filtering (JEP-290)
◈ Introduced in Java 9 on January 2017
⬥ Backported but not available in old JVM versions
◈ White / Black listing approach
◈ 3 types of filters
⬥ Global Filter
⬥ Custom Filters
⬥ Built-in Filters
◈ Graph and Stream Limits
⬥ Requires knowledge of graphs, JVM internals and details
of all deployed code 15
Serialization Filtering problems
!!!!!
16
Serialization Filtering problems
17
Serialization Filtering problems
18
Instrumentation Agents
◈ Instrumentation API
◈ Black/ White listing approach
⬥ Global Filter
⬥ Custom Filters
◈ Known open source agents
⬥ NotSoSerial
⬥ Contrast-rO0
⬥ more...
19
What is the problem with Instrumentation Agents?
?
20
What is the problem with Instrumentation Agents?
◈ Instrumentation API was not designed for Security
From the Javadoc API:
Instrumentation is the addition of byte-codes to methods
for the purpose of gathering data.
Since the changes are purely additive, these tools
do not modify application state or behavior.
Examples of such benign tools include monitoring agents,
profilers, coverage analyzers, and event loggers.
21
Single Fault Domain
◈ Instr. agents and application share the same address space
◈ No separation of privileges
◈ Nothing prevents an app exploit to modify Agent code/data
◈ Think of the browser / plugin paradigm
◈ Agents can be compromised by application attack vectors
◈ No protection against insider attacks
◈ Inappropriate for Cloud environments
22
Instrumentation Agents can turn into Double Agents
◈ Reporting & Blacklisting mode not suitable for production
◈ Configuration tampering at runtime
⬥ Backdoor deployment
⬥ Agent becomes DoS attack vector
◈ Protection can be disabled
◈ Log entries cannot be trusted
23
Demo PoC: Turn Contrast-rO0 against itself
Setup
◈ Deploy the Contrast-rO0 instrumentation agent
◈ Use the default configuration file
◈ Run Tomcat with a vulnerable sample app
Goal
◈ Tamper agent’s runtime configuration
◈ Remove blacklisted classes (aka add backdoors)
24
Source: https://github.com/maestros/fileuploadapp
Let’s study the attack carefully
25
Source: Chris Frohoff
Marshalling Pickles
AppSecCali 2015
ObjectInputStream.readObject()
AnnotationInvocationHandler.readObject()
Map(Proxy).entrySet()
AnnotationInvocationHandler.invoke()
LazyMap.get()
...
InvokerTransformer.transform()
Method.invoke()
Runtime.exec()
26
Source: Chris Frohoff
ysoserial
LinkedHashSet.readObject()
...
LinkedHashSet.add()
...
Proxy(Templates).equals()
...
ClassLoader.defineClass()
Class.newInstance()
...
Runtime.exec()
27
Let’s revisit the core of the problem
◈ The JVM is irrationally too permissive
◈ The JVM makes no effort to mitigate API Abuse attacks
◈ It is not even safeguarding its own invariants!
◈ All code and data can be accessible from any context
⬥ without a Security Manager
28
What do the standards suggest?
CERT Secure Coding Standards
◈ SER08-J. Minimize privileges before deserializing from a privileged context
◈ SEC58-J. Deserialization methods should not perform potentially
dangerous operations
MITRE
◈ CWE-250: Execution with Unnecessary Privileges
⬥ [...] isolate the privileged code as much as possible from other code.
Raise privileges as late as possible, and drop them as soon as possible.
◈ CWE-273: Improper Check for Dropped Privileges
⬥ Compartmentalize the system to have "safe" areas where trust
boundaries can be unambiguously drawn.
29
Runtime Virtualization Deserialization Mitigation
◈ Runtime Virtualization
⬥ Places security controls in an isolated address space
⬥ Offers complete visibility of all executed instructions
◈ Runtime Micro-compartmentalization
⬥ Defines boundaries around operations
⬥ Controlled communication between compartments
◈ Runtime Privilege De-escalation
⬥ Allows only non-privileged operations after each boundary
⬥ Safeguards JVM’s state
⬥ Protects against API abuse cases 30
Conclusion
◈ Maintaining lists does not scale and is a burden
◈ Filtering classes can be too low level for AppSec teams
◈ Instrumentation Agents can become Double Secret Agents
◈ Do not use agent’s Reporting & Blacklist mode in production
◈ The runtime platform must:
⬥ be secure-by-default
⬥ safeguard the developer’s code from being abused
31
Thanks!
Apostolos Giannakidis
@cyberApostle
BSides Luxembourg
20th October 2017
32
Discussion Time
◈ Bug hunting - Code reviewing deserialization gadgets
◈ Global Filters - Good or Bad?
◈ Attack detection using WAFs
Apostolos Giannakidis
@cyberApostle
BSides Luxembourg
20th October 2017
33
public class LookupTable implements Serializable {
private transient TableElement[] lookupTable;
public LookupTable(int size) {
int elements = Math.min(Math.max(4,size),32);
lookupTable = new TableElement[elements];
}
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
int numEntries = s.readInt();
lookupTable = new TableElement[numEntries];
}
}
Code Review #1
34
public final class TempFile implements Serializable {
private String fileName;
private void readObject(ObjectInputStream s) {
s.defaultReadObject(); // read the field
}
public String toString() {
return fileName != null ? fileName : "";
}
private void finalize() {
new File(fileName).delete();
}
public File getTempFile() {
return new File(fileName);
}
}
Code Review #2
35
Know what you need to protect
Audit
Serializable classes
Create
Threat Model
Re-evaluate
Threat Model when
class evolves
Identify all
deserialization
end-points
Add authentication
in each end-point
36
Risk-based Management using lists
◈ Who should be responsible for their maintenance?
◈ Difficult to apply risk-based management
⬥ How should a class’s risk profile be assessed?
⬥ Developers understand code
⬥ AppSec teams understand operations
⬦ OS, File System, Network, Database, etc.
37
What is the problem with Global Filters?
◈ A Global Filter is ... Global (System-wide)
◈ Applies to all deserialization endpoints
⬥ Even if the endpoint deserializes internal data
◈ Whitelist must include classes from all software layers
⬥ How do you know what classes are needed by each layer?
◈ Whitelisting with Global Filter increases risk exposure
⬥ The Global Filter defines your deserialization attack vector
38
Check WAFs for False Positives
HashMap<String, String> map = new HashMap<>();
map.put(
“org.apache.commons.collections.functors.InvokerTransformer”,
“calc.exe” );
FileOutputStream file = new FileOutputStream( "out.bin" );
ObjectOutputStream out = new ObjectOutputStream(file);
out.writeObject( map );
out.close();
39
java.lang.reflect.Field configField = ClassLoader.getSystemClassLoader()
.loadClass("com.contrastsecurity.rO0.RO0Agent").getField("config");
Object configObj = configField.get(null);
Class<?> configClass = configObj.getClass();
java.lang.reflect.Field blacklistEnabledField =
configClass.getDeclaredField("blacklistEnabled");
blacklistEnabledField.setAccessible(true);
blacklistEnabledField.setBoolean(configObj, false);
java.lang.reflect.Field blacklistField =
configClass.getDeclaredField("blacklist");
blacklistField.setAccessible(true);
blacklistField.set(configObj, null); 40
41
● Runtime Application Self-Protection technology for Java applications built on
top of the Oracle JVM
● A Java Container is a protected in-JVM container
with built-in application security
and quarantine controls
● The Java container separates apart the
vulnerable JRE code from the low-level JVM
● Application security controls inserted
between the Java Container and the JVM
protect and quarantine the Java application
Java Security via Runtime Virtual Containers

More Related Content

What's hot

Csw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelistingCsw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelisting
CanSecWest
 
Protected Process Light will be Protected – MemoryRanger Fills the Gap Again
Protected Process Light will be Protected – MemoryRanger Fills the Gap AgainProtected Process Light will be Protected – MemoryRanger Fills the Gap Again
Protected Process Light will be Protected – MemoryRanger Fills the Gap Again
Igor Korkin
 
AusCERT 2016: CVE and alternatives
AusCERT 2016: CVE and alternativesAusCERT 2016: CVE and alternatives
AusCERT 2016: CVE and alternatives
David Jorm
 
Under the hood of modern HIPS-es and Windows access control mechanisms
Under the hood of modern HIPS-es and Windows access control mechanismsUnder the hood of modern HIPS-es and Windows access control mechanisms
Under the hood of modern HIPS-es and Windows access control mechanisms
ReCrypt
 
Automating Malware Analysis
Automating Malware AnalysisAutomating Malware Analysis
Automating Malware Analysis
securityxploded
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java securityveszpremimeetup
 
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Priyanka Aash
 
Virtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the CloudVirtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the Cloud
Tjylen Veselyj
 
Introduction to iOS Penetration Testing
Introduction to iOS Penetration TestingIntroduction to iOS Penetration Testing
Introduction to iOS Penetration Testing
OWASP
 
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
BlueHat Security Conference
 
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected ProcessesNSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
NoSuchCon
 
Metasploit & Windows Kernel Exploitation
Metasploit & Windows Kernel ExploitationMetasploit & Windows Kernel Exploitation
Metasploit & Windows Kernel Exploitation
zeroSteiner
 
openioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensicsopenioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensics
Takahiro Haruyama
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat Security Conference
 
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
grecsl
 
Automatiza las detecciones de amenazas y evita falsos positivos
Automatiza las detecciones de amenazas y evita falsos positivosAutomatiza las detecciones de amenazas y evita falsos positivos
Automatiza las detecciones de amenazas y evita falsos positivos
Imma Valls Bernaus
 
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
BlueHat Security Conference
 
One-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic AnalysisOne-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic AnalysisTakahiro Haruyama
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CanSecWest
 
Csw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooksCsw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooks
CanSecWest
 

What's hot (20)

Csw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelistingCsw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelisting
 
Protected Process Light will be Protected – MemoryRanger Fills the Gap Again
Protected Process Light will be Protected – MemoryRanger Fills the Gap AgainProtected Process Light will be Protected – MemoryRanger Fills the Gap Again
Protected Process Light will be Protected – MemoryRanger Fills the Gap Again
 
AusCERT 2016: CVE and alternatives
AusCERT 2016: CVE and alternativesAusCERT 2016: CVE and alternatives
AusCERT 2016: CVE and alternatives
 
Under the hood of modern HIPS-es and Windows access control mechanisms
Under the hood of modern HIPS-es and Windows access control mechanismsUnder the hood of modern HIPS-es and Windows access control mechanisms
Under the hood of modern HIPS-es and Windows access control mechanisms
 
Automating Malware Analysis
Automating Malware AnalysisAutomating Malware Analysis
Automating Malware Analysis
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
 
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
 
Virtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the CloudVirtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the Cloud
 
Introduction to iOS Penetration Testing
Introduction to iOS Penetration TestingIntroduction to iOS Penetration Testing
Introduction to iOS Penetration Testing
 
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
BlueHat v18 || Return of the kernel rootkit malware (on windows 10)
 
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected ProcessesNSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
NSC #2 - D3 05 - Alex Ionescu- Breaking Protected Processes
 
Metasploit & Windows Kernel Exploitation
Metasploit & Windows Kernel ExploitationMetasploit & Windows Kernel Exploitation
Metasploit & Windows Kernel Exploitation
 
openioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensicsopenioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensics
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
Deploying a Shadow Threat Intel Capability at Thotcon on May 6, 2016
 
Automatiza las detecciones de amenazas y evita falsos positivos
Automatiza las detecciones de amenazas y evita falsos positivosAutomatiza las detecciones de amenazas y evita falsos positivos
Automatiza las detecciones de amenazas y evita falsos positivos
 
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
 
One-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic AnalysisOne-Byte Modification for Breaking Memory Forensic Analysis
One-Byte Modification for Breaking Memory Forensic Analysis
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
 
Csw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooksCsw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooks
 

Similar to Mitigating Java Deserialization attacks from within the JVM

The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
DevOps.com
 
Derbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active DirectoryDerbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active Directory
Will Schroeder
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
NotSoSecure Global Services
 
CNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android ApplicationsCNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)
abend_cve_9999_0001
 
I got 99 trends and a # is all of them
I got 99 trends and a # is all of themI got 99 trends and a # is all of them
I got 99 trends and a # is all of them
Roberto Suggi Liverani
 
Droidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensicsDroidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensics
viaForensics
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
CNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android ApplicationsCNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
Enterprise Cloud Security
Enterprise Cloud SecurityEnterprise Cloud Security
Enterprise Cloud Security
MongoDB
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
Will Schroeder
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Apostolos Giannakidis
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
nitinscribd
 
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group OsnabrueckCut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Theo Jungeblut
 
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Theo Jungeblut
 
Android security
Android securityAndroid security
Android security
Mobile Rtpl
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
Ortus Solutions, Corp
 
Android Security, From the Ground Up
Android Security, From the Ground UpAndroid Security, From the Ground Up
Android Security, From the Ground Up
Opersys inc.
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxGiuseppe Paterno'
 
Continuous Security for GitOps
Continuous Security for GitOpsContinuous Security for GitOps
Continuous Security for GitOps
Weaveworks
 

Similar to Mitigating Java Deserialization attacks from within the JVM (20)

The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Derbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active DirectoryDerbycon - The Unintended Risks of Trusting Active Directory
Derbycon - The Unintended Risks of Trusting Active Directory
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
 
CNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android ApplicationsCNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android Applications
 
Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)
 
I got 99 trends and a # is all of them
I got 99 trends and a # is all of themI got 99 trends and a # is all of them
I got 99 trends and a # is all of them
 
Droidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensicsDroidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensics
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
CNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android ApplicationsCNIT 128 9. Writing Secure Android Applications
CNIT 128 9. Writing Secure Android Applications
 
Enterprise Cloud Security
Enterprise Cloud SecurityEnterprise Cloud Security
Enterprise Cloud Security
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
 
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group OsnabrueckCut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
 
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
 
Android security
Android securityAndroid security
Android security
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
 
Android Security, From the Ground Up
Android Security, From the Ground UpAndroid Security, From the Ground Up
Android Security, From the Ground Up
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
 
Continuous Security for GitOps
Continuous Security for GitOpsContinuous Security for GitOps
Continuous Security for GitOps
 

Recently uploaded

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 

Recently uploaded (20)

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 

Mitigating Java Deserialization attacks from within the JVM

  • 1. Mitigating Java Deserialization attacks from within the JVM Apostolos Giannakidis @cyberApostle BSides Luxembourg 20th October 2017 1
  • 2. Who is BACKGROUND ◈ Security Architect at Waratek ◈ AppSec ◈ Runtime protection ◈ Vulnerability and exploit analysis ◈ R&D exploit mitigation ◈ MSc Computer Science 2
  • 3. Key Takeaways ◈ Black/White listing is not an enterprise-scale solution ◈ Instrumentation Agents can be manipulated ◈ Runtime Virtualization offers memory isolation ◈ Runtime Privilege De-escalation safeguards application components and the JVM from API Abuse 3
  • 4. Attack Vectors ● RPC/IPC ● Message Brokers ● Caching ● Tokens / Cookies ● RMI ● JMX ● JMS ● ... Why should I care? Attack Surface ● Oracle ● Red Hat ● Apache ● IBM ● Symantec ● Cisco ● Atlassian ● Adobe ● ... 4 Impact & Popularity ● Reliable attack ● Easy to exploit ● All software layers ● OWASP Top 10 2017 ● Oracle Java SE CPUs ● SF Muni breach ⬥ ~ 900 computers ⬥ ~$560k daily loss
  • 6. Deserialization of untrusted data What is the problem here? InputStream untrusted = request.getInputStream(); ObjectInputStream ois = new ObjectInputStream(untrusted); SomeObject deserialized = (SomeObject) ois.readObject(); 6
  • 7. Deserialization of untrusted data What is the problem here? ◈ Any available class can be deserialized ◈ Deserializing untrusted data can result in malicious behavior ⬥ Arbitrary code execution ⬥ Denial of Service ⬥ Remote command execution ⬦ Malware / Ransomware infection InputStream untrusted = request.getInputStream(); ObjectInputStream ois = new ObjectInputStream(untrusted); SomeObject deserialized = (SomeObject) ois.readObject(); 7
  • 8. How to solve the problem? ◈ Stop using deserialization ⬥ Requires significant refactoring ⬥ Requires architectural changes ⬥ Endpoints in other software layers? ⬥ Legacy software? ◈ Patch your software ⬥ “It is possible that some REST actions stop working” - CVE-2017-9805 ⬥ Oracle CPU October 2017 breaks backwards compatibility 8
  • 9. Java Security Manager ◈ Custom Security Policy Filtering Class names ◈ Serialization Filtering (JEP-290) ◈ Custom Instrumentation Agents Runtime Virtualization ◈ Micro-compartmentalization ◈ Privilege De-escalation Existing Runtime Mitigation Techniques 9
  • 10. Java Security Manager ◈ Difficult to configure it correctly ◈ Performance issues ◈ No protection against DoS attacks ◈ No protection against deferred deserialization attacks Critical Patch Update # vuls that can bypass the sandbox October 2017 18 July 2017 26 April 2017 8 January 2017 14 10
  • 11. Discussion Time: Filtering class names Blacklisting Whitelisting 11
  • 12. Blacklisting ● Requires profiling ● Never complete ● False sense of security ● Not possible if class is needed ● Can be bypassed Discussion Time: Filtering class names Whitelisting ● Requires profiling ● Difficult to do it right ● False positives if misconfigured ● No protection if class is needed ● No protection against Golden Gadgets ● Requires code reviews & testing 12
  • 13. Whitelists are commonly mistreated 13
  • 14. Maintaining lists is a shity job 14
  • 15. Serialization Filtering (JEP-290) ◈ Introduced in Java 9 on January 2017 ⬥ Backported but not available in old JVM versions ◈ White / Black listing approach ◈ 3 types of filters ⬥ Global Filter ⬥ Custom Filters ⬥ Built-in Filters ◈ Graph and Stream Limits ⬥ Requires knowledge of graphs, JVM internals and details of all deployed code 15
  • 19. Instrumentation Agents ◈ Instrumentation API ◈ Black/ White listing approach ⬥ Global Filter ⬥ Custom Filters ◈ Known open source agents ⬥ NotSoSerial ⬥ Contrast-rO0 ⬥ more... 19
  • 20. What is the problem with Instrumentation Agents? ? 20
  • 21. What is the problem with Instrumentation Agents? ◈ Instrumentation API was not designed for Security From the Javadoc API: Instrumentation is the addition of byte-codes to methods for the purpose of gathering data. Since the changes are purely additive, these tools do not modify application state or behavior. Examples of such benign tools include monitoring agents, profilers, coverage analyzers, and event loggers. 21
  • 22. Single Fault Domain ◈ Instr. agents and application share the same address space ◈ No separation of privileges ◈ Nothing prevents an app exploit to modify Agent code/data ◈ Think of the browser / plugin paradigm ◈ Agents can be compromised by application attack vectors ◈ No protection against insider attacks ◈ Inappropriate for Cloud environments 22
  • 23. Instrumentation Agents can turn into Double Agents ◈ Reporting & Blacklisting mode not suitable for production ◈ Configuration tampering at runtime ⬥ Backdoor deployment ⬥ Agent becomes DoS attack vector ◈ Protection can be disabled ◈ Log entries cannot be trusted 23
  • 24. Demo PoC: Turn Contrast-rO0 against itself Setup ◈ Deploy the Contrast-rO0 instrumentation agent ◈ Use the default configuration file ◈ Run Tomcat with a vulnerable sample app Goal ◈ Tamper agent’s runtime configuration ◈ Remove blacklisted classes (aka add backdoors) 24 Source: https://github.com/maestros/fileuploadapp
  • 25. Let’s study the attack carefully 25
  • 26. Source: Chris Frohoff Marshalling Pickles AppSecCali 2015 ObjectInputStream.readObject() AnnotationInvocationHandler.readObject() Map(Proxy).entrySet() AnnotationInvocationHandler.invoke() LazyMap.get() ... InvokerTransformer.transform() Method.invoke() Runtime.exec() 26
  • 28. Let’s revisit the core of the problem ◈ The JVM is irrationally too permissive ◈ The JVM makes no effort to mitigate API Abuse attacks ◈ It is not even safeguarding its own invariants! ◈ All code and data can be accessible from any context ⬥ without a Security Manager 28
  • 29. What do the standards suggest? CERT Secure Coding Standards ◈ SER08-J. Minimize privileges before deserializing from a privileged context ◈ SEC58-J. Deserialization methods should not perform potentially dangerous operations MITRE ◈ CWE-250: Execution with Unnecessary Privileges ⬥ [...] isolate the privileged code as much as possible from other code. Raise privileges as late as possible, and drop them as soon as possible. ◈ CWE-273: Improper Check for Dropped Privileges ⬥ Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. 29
  • 30. Runtime Virtualization Deserialization Mitigation ◈ Runtime Virtualization ⬥ Places security controls in an isolated address space ⬥ Offers complete visibility of all executed instructions ◈ Runtime Micro-compartmentalization ⬥ Defines boundaries around operations ⬥ Controlled communication between compartments ◈ Runtime Privilege De-escalation ⬥ Allows only non-privileged operations after each boundary ⬥ Safeguards JVM’s state ⬥ Protects against API abuse cases 30
  • 31. Conclusion ◈ Maintaining lists does not scale and is a burden ◈ Filtering classes can be too low level for AppSec teams ◈ Instrumentation Agents can become Double Secret Agents ◈ Do not use agent’s Reporting & Blacklist mode in production ◈ The runtime platform must: ⬥ be secure-by-default ⬥ safeguard the developer’s code from being abused 31
  • 33. Discussion Time ◈ Bug hunting - Code reviewing deserialization gadgets ◈ Global Filters - Good or Bad? ◈ Attack detection using WAFs Apostolos Giannakidis @cyberApostle BSides Luxembourg 20th October 2017 33
  • 34. public class LookupTable implements Serializable { private transient TableElement[] lookupTable; public LookupTable(int size) { int elements = Math.min(Math.max(4,size),32); lookupTable = new TableElement[elements]; } private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { int numEntries = s.readInt(); lookupTable = new TableElement[numEntries]; } } Code Review #1 34
  • 35. public final class TempFile implements Serializable { private String fileName; private void readObject(ObjectInputStream s) { s.defaultReadObject(); // read the field } public String toString() { return fileName != null ? fileName : ""; } private void finalize() { new File(fileName).delete(); } public File getTempFile() { return new File(fileName); } } Code Review #2 35
  • 36. Know what you need to protect Audit Serializable classes Create Threat Model Re-evaluate Threat Model when class evolves Identify all deserialization end-points Add authentication in each end-point 36
  • 37. Risk-based Management using lists ◈ Who should be responsible for their maintenance? ◈ Difficult to apply risk-based management ⬥ How should a class’s risk profile be assessed? ⬥ Developers understand code ⬥ AppSec teams understand operations ⬦ OS, File System, Network, Database, etc. 37
  • 38. What is the problem with Global Filters? ◈ A Global Filter is ... Global (System-wide) ◈ Applies to all deserialization endpoints ⬥ Even if the endpoint deserializes internal data ◈ Whitelist must include classes from all software layers ⬥ How do you know what classes are needed by each layer? ◈ Whitelisting with Global Filter increases risk exposure ⬥ The Global Filter defines your deserialization attack vector 38
  • 39. Check WAFs for False Positives HashMap<String, String> map = new HashMap<>(); map.put( “org.apache.commons.collections.functors.InvokerTransformer”, “calc.exe” ); FileOutputStream file = new FileOutputStream( "out.bin" ); ObjectOutputStream out = new ObjectOutputStream(file); out.writeObject( map ); out.close(); 39
  • 40. java.lang.reflect.Field configField = ClassLoader.getSystemClassLoader() .loadClass("com.contrastsecurity.rO0.RO0Agent").getField("config"); Object configObj = configField.get(null); Class<?> configClass = configObj.getClass(); java.lang.reflect.Field blacklistEnabledField = configClass.getDeclaredField("blacklistEnabled"); blacklistEnabledField.setAccessible(true); blacklistEnabledField.setBoolean(configObj, false); java.lang.reflect.Field blacklistField = configClass.getDeclaredField("blacklist"); blacklistField.setAccessible(true); blacklistField.set(configObj, null); 40
  • 41. 41 ● Runtime Application Self-Protection technology for Java applications built on top of the Oracle JVM ● A Java Container is a protected in-JVM container with built-in application security and quarantine controls ● The Java container separates apart the vulnerable JRE code from the low-level JVM ● Application security controls inserted between the Java Container and the JVM protect and quarantine the Java application Java Security via Runtime Virtual Containers