SlideShare una empresa de Scribd logo
1 de 65
Sandy
The Malicious Exploit Analysis.

http://exploit-analysis.com/
Static Analysis and Dynamic exploit
analysis

Garage4Hackers
About Me
I work as a Researcher for a Global Threat Research
firm.
Spoke at the few security conferences like HITB [KL],
BlackHat [US Arsenal], Cocon (2011, 2012), Nullcon
(2011, 2012), HITB (AMS 2012) and BlackHat (EU
2012), EKoparty (Argentina), CanSecwest(2013),
HITCon(2013).
One of the admins of www.Garage4Hackers.com.
I cook .
https://twitter.com/fb1h2s
Garage4Hackers
About this Talk
With the rise in number of targeted attacks
against government and private companies,
there is a certain requirement for automated
exploit analysis and filtering document file
formats.
This talk would be on intelligent automated
exploit analysis and a free tool [sandy] we have
build for analyzing these exploits.
Sandy is capable of doing exploit analysis on
Doc, RTF, XLS,PPT, Jar, Urls, but in the current
talk we would be concentrating on Java
Exploits.
Garage4Hackers
What is Sandy
Sandy is an online sandbox capable of doing
both static and dynamic analysis of Malicious
Office, PDF, Jar, Flash, HTML.
The input would be the above mentioned file
formats and output would be extracted malwares,
controllers, Urls

Version 1: http://www.exploit-analysis.com

Garage4Hackers
Status of No of Documents
Exploits

Source: virus total
Analyzing samples manually
is more than impossible .
We see more than 2000 exploits a day, and need
to understand the file formats need to know the
version and the ugly obfuscation the exploit
developers use, in order to extract the binaries.
These days since java is getting raped , there are
hell a lot of java exploits as well.

We need a solution to bulk process these
samples and give the binary files.

Garage4Hackers
Why not use Current
Sandboxes
Time consuming: It takes least 3-4 minutes to do a
dynamic analysis on sandbox.
One sample at a time on a dedicated box is too much
resource consuming.
The sandbox might not have the actual software
version to get the exploit working .
Some times there would be version and language
checking for the exploit to work.
Java Exploits need the html template and right
parameters to get exploited properly.

Garage4Hackers
Static Analysis
Automating static analysis would not provide best
results always.

Manually spending time on each sample is
suicidal .
And that’s when we decided to create sandy,
intelligent analysis is better than blind analysis.

Garage4Hackers
Sandy: Static and Dynamic
Engine.
Performs both static and Dynamic analysis.
The static analysis done on the exploits is used
to perform intelligent dynamic analysis.
So final aim of sandy is to take in file formats and
give the binary, controllers embedded inside it
and attribution.

Garage4Hackers
The Architecture

Information

• Web
Interface
Exploits

• Static
Analysis

• Dynamic
Analysis
Report

Garage4Hackers
Demo

How it works
http://www.exploitanalysis.com

Garage4Hackers
Agenda
We will explain the many things we learned
building the system.
Java Security architecture explained.
Java Exploits explained in detail with [Poc].

Java exploits and different exploit reliability
mechanisms used .
Java Static analysis automation.

Java Dynamic instrumentation.
{ Not a lot of new things , just automation and
things I learned building the tool }
Garage4Hackers
Java Exploits [ Applet]
Input is java .jar files or .class files.
Jar applets need the right arguments to run from
a webpage.

Java applets runs in a sandboxed environment and
all the exploits seen in the wild uses a sandbox
bypass technique .
Garage4Hackers
The kind of Java Exploits seen
between 2011-2013
Java Type Confusion Exploits. [CVE2012-0507, CVE-2013-0431 ]

Java Logic error and sandbox bypass.
[CVE-2012-4681]
Argument Injection [CVE-2010-0886 ]
Memory Corruptions. [CVE-2013-1493 ]

Garage4Hackers
Java Sandbox

•

Before Getting into Java Exploits and Exploit
analysis lets review Java security Architecture.
Garage4Hackers
Default Sandbox settings prevents applet
from:

Ref: http://www.blackhat.com/presentations/bh-asia-02/LSD/bh-asia-02-lsd.pdf

Garage4Hackers
Java Sandbox
Java Security is handled by the a Java Sandbox .
The role of the sandbox is to provide a very
restricted environment in which to run untrusted
code obtained from the open network.
The java sandbox is only enforced on web
applets and not on java codes running on the
local machines.
Ref: http://docs.oracle.com/javase/7/docs/technotes/guides/security/spec/securityspec.doc1.html
http://www.blackhat.com/presentations/bh-asia-02/LSD/bh-asia-02-lsd.pdf

Garage4Hackers
Sandboxed :
So the following applet with the compiled class
file when run form the browser would be
executing on a controlled environment.

<APPLET CODE="Main.class" WIDTH="800"
HEIGHT="500">

Garage4Hackers
By Default:
By default java is designed to be safe having
solutions for a lot of common security issues,
including but not limited to buffer overflows,
memory management , type checking .
One type of files that are by default allowed to
run outside the Sandboxed environment are the
"Signed Applets"

Garage4Hackers
Previously all the security checks were
programmatically implemented.

But later a in-order to make things more
convenient and to manage java security
restrictions easily , java introduced an easy to
manage "Java Platform Security Model" .

Garage4Hackers
New Changes had the
following features
In other words, a less "powerful" domain cannot
gain additional permissions as a result of calling
or being called by a more powerful domain.
The above implementation brought in,
Permission Check | Access Controls
Implementation

Garage4Hackers
Permission Check | Access
Controls Implementation .
All the permission are enforced in a policy file
located at []java-dir]/lib/security/java.policy .

Garage4Hackers
Access Controls
Implementation
1) A stack based access control.
2) Each API when called is checked for
it's permission before getting executed.
3) The above is done by
java.security.AccessController.checkPermission

Garage4Hackers
So the basic pesudocode of
java.security.AccessController.check-Permission would be
as follows.

Garage4Hackers
Few Java Properties to
Remember.
• Java Restricted Packages
• Java Security Manager
• Reflection
• Type safety

Garage4Hackers
Java Restricted
Packages
There are packages in Java that
cannot be accessed by untrusted code by default.
These packages have the
capability to execute privileged
codes, or anything that is
possible with java.
 sun.awt.SunToolkit
Garage4Hackers
Security Manager
“Security manager is an object that defines a
security policy for an application”
You can programmatically manage security
policies using the SecurityManager class
Java.lang.System.setSecurityManager is the
method that sets security manager for the
application.
Turning off the security manager is simple as
adding this to you'r code. [Having right privilege]

Java.lang.System.setSecurityManager(null)
Ref:BH_US_12_Oh_Recent_Java_Exploitation_Trends_and_Malware_WP.pdf
Garage4Hackers
The following Packages Implement the
Security Manager

Ref: http://www.exploit-db.com/wp-content/themes/exploit/docs/21321.pdf

Garage4Hackers
Sandbox Bypass
Disable Security manager code:
Java.lang.System.setSecurityManager(nu
ll)
Disabling security manager is only
possible by a signed java applet or after a
privilege escalation, and hence the above
code is always seen in all the latest java
exploits [obfuscated] majority of times.
When a java sandbox bypass in done the
code will have privileges to disable the
security manager.
Garage4Hackers
Analysis of Type of Exploits and Poc
Java Type Confusion Exploits. [CVE2012-0507, CVE-2013-0431 ]

Java Logic error and sandbox bypass.
[CVE-2012-4681]
Argument Injection [CVE-2010-0886 ]
Memory Corruptions. [CVE-2013-1493 ]

Garage4Hackers
Reflection
Reflection is commonly used by
programs which require the ability to
examine or modify the runtime
behavior of applications running in
the Java virtual machine.
Ref: http://docs.oracle.com/javase/tutorial/reflect/

Garage4Hackers
With Reflection :
1) Can create an instance of a class at runtime and
use it while executing.
2) Can access private class members
3) We can access private methods and variable,
hidden class members .
None of the above is possible when security
manager is enabled.
Currently security checks are for all Java programs

Garage4Hackers
Type safety
The storage format, having defined a specific
type or storage .
Type safety is generally done by
1) performing static analysis before code runs
2)performing type safety check when program
runs
Java type safety is done by static check at the time
of compilation.
So if a type changes at runtime then it’s impossible
to do the safe check.
Garage4Hackers
Type Confusion
One type impersonating as another .
Type confusion can be at object level can lead to vulnerability at whole application
level.
Ref:(http://www.securingjava.com/chapter-two/chapter-two-10.html
http://www.securingjava.com/chapter-five/chapter-five-7.html

Garage4Hackers
CVE-2012-0507 - Java Atomic Reference
Array Exploit
POC Explained
AtomicReferenceArray ara = new AtomicReferenceArray(new Integer[1]);
Integer value = (Integer)ara.get(0); // value set to type integer of atomic ref
array
AtomicReferenceArray uses sun.misc.Unsafe to directly access the array
With this we can do “ AtomicReferenceArray.set() “ method allows you to store
any reference in the array.
So we can replace integer value with any reference in the array, and type
safety check is bypassed.

Garage4Hackers
POC
AtomicReferenceArray ara = new
AtomicReferenceArray(new Integer[1]);
ara.set(0, "foo");
Integer value = (Integer)ara.get(0);
•

Now value contains a string while being typed as Integer.

•

With this we can disable security manager , and sanbox restriction
would be bypassed.

Garage4Hackers
Memory corruption
CVE-2013-1493 Memory corruption in java
POC :
•

Memmory corruption in BufferedImage .

•

Before triggering the vulnerability , call java garagbage
collector to clean the heap.

•

Do a heap spray , trigger the vulnerability and get control of
the program and disable java security manager, since the
applet has control over it.

•

Game Over.

Garage4Hackers
CVE-2012-4681 - Accessing restricted
class with [
com.sun.beans.finder.ClassFinder ]
Classfinder.findclass was able to access restricted class .
Get accessor to private "acc" field of Statement.class .
{Java 7}
Create Access control context with all permission
Create statement that disables security manager.
Set "acc" field accessor with permissions and security
manager statement.
Execute and disable security manager
Game over.
Ref: http://www.docjar.com/docs/api/com/sun/beans/finder/ClassFinder.html
Garage4Hackers
Argument Injection
CVE-2012-0500: Java Web Start Plugin
Poc Code explanation.
Arg injection in JNPL config file.

http://www.garage4hackers.com/content.php?r=114-Binary-Analysis-of-OracleJava-CVE-2012-0500-and-Alternate-Exploitation-on-Win-Linux

Garage4Hackers
Java Exploits HTML
Template

Garage4Hackers
How Sandy Handles HTML
Obfuscation
All the analysis are carried out on a real browser
whose driver is controlled by sandy code.

Once the exploits runs the obfuscated code and
writes the exploits to the dom, the de-obfuscated
html is picked up and analyzed.
This way all runtime obfuscation would be
decompiled and we would get the original
payload.

Garage4Hackers
Obfuscation
Javascript
Eval
document.write

unescape(unescape(
new ActiveXObject(String.fromCharCode(
Other runtime DOM writes.

Garage4Hackers
Controlled Browser
Certain exploits get triggered only on a
“mousemove” or any “mouse-events”, we can
pass those as well.
Sandy is able to detect these events and would
be able to pass any JS events to the browser
there by defeating the above protections.

We can analyze multiple urls at the same time on
a single sandbox. [Less resource consuming ]

Garage4Hackers
URL Analysis
Each URL analysis go through individual proxys.
Merits: One sandbox[browser] can analyze multiple
URLS.
Inject our JavaScript logger into each page.
<script src="logger.js"
type="text/javascript"></script>
The Html/JS traffic is inspected for common exploit
pattern.

Once Dom is populated we inspect that source
Garage4Hackers
again.
Demo
Sandy Dynamic module dealing with URL
Exploits and obfuscation.

If a jar is dropped then a static analysis is done
on it.

Garage4Hackers
Sandy Submission:1
URL Module
Based on a URL submission on: 2013-08-22
Karnataka Gov website infected.

http://exploitanalysis.com/sandy/view/linkscan_view.php?id=Xqs
mOI%2BFHGTY8i1TTHT7dg%3D%3D
http://exploitanalysis.com/sandy/view/linkscan_view.php?id=z7B
42P%2Fd1v1077W%2F06Yo6g%3D%3D
A music Company infected with java exploit.
Garage4Hackers
If .class file:
Disassemble the source look for strings matching
external links.

Identify the Java build version using the magic
number + 4
Decompile the source using [Jad]

Garage4Hackers
If jar file:
Disassemble the source look for strings matching
external links.

Identify the Java build version using the magic
number + 4
Decompile the source using [Jad]

Extract all files from the jar file
Detect CVE or possible Java version the exploit
will work.
Garage4Hackers
Java Static Analysis
Search for string for any java version|lang
mentioned. “System.getProperty(“
Extract Java main class name.
Extract imported class names.

Extract parameter names to be used and to be
supplied to the applet to run properly.
Extract os commands other other interesting
information's.
Extracts Encryptions used .
 javax.crypto.*
Garage4Hackers
• If jar:
Look for binaries inside the jar files.
Some times xor encrypted, do quick
brute do an entropy analysis to find key.

Garage4Hackers
Identify the java main
class.
•

Look inside java manifest file

•

Disassemble jar code locate “main(“ string

•

Use javap[magic headers] to identify the version
built.

•

Use the java class path load the java file .

Garage4Hackers
Demo Jar Analysis
Sandy static module dealing with Jar Exploits.

Garage4Hackers
Central Tibet Waterhole Java exploit
Submission on 16th Aug

Garage4Hackers
Central Tibet Waterhole Java exploit
Attackers hacked Central Tibet website. [Trusted
and most visited site for Tibet ]
Added a java exploit .
On users visiting the site they would be infected
by a malware.
The dropped malware was a windows backdoor.
http://exploitanalysis.com/sandy/view/view_java.php?md5=0
K%2B7TOrG6AqDbVRTm54ZCQ%3D%3D.

Garage4Hackers
Obfuscation in Java code
String Obfuscation and dynamic string
generation.

Dynamic Class resolution .
Class method obfuscation .
Anti Decompiling

Garage4Hackers
String Obfuscation in
in Java
Java obfuscation is done mainly by dynamically
constructing the function calls and strings.

Example

Garage4Hackers
Sandy Submission:3
Java Module
Submission on 12-09-2013
Java exploit, dropping windows and OSX malware ,
possibly targeting #tibet.
http://exploit-analysis.com/sandy/view/view_java.php?md5=94ra2GG5en6x7uz3dtkSAg%3D%3D

Garage4Hackers
Obfuscation using 2 way
encryptions.
Look for traces of common algorithms used
based on signatures.

import javax.crypto.*;
import java.security.spec.InvalidKeySpecException;
Look for traces of Encrypted strings, and
decryption keys.
Based on string length 16-byte, 32-byte etc. And try
to do a quick brute force on possible algorithms.
Garage4Hackers
Java Malware
Analysis Demo
h t t p : / / e x p l o i t analysis.com/sandy/view/view_java.php?md5=JR2Xv
0QuTlgve9o%2FdzNP1A%3D%3D

Garage4Hackers
Anti Decompiling
Then static analysis becomes hard for sandy, so it
proceeds to dynamic.

Read More:
http://www.securelist.com/en/analysis/204792300/Anti_d
ecompiling_techniques_in_malicious_Java_Applets
Garage4Hackers
If No Binary : Do Dynamic
Analysis
Construct an applet template.
Use the previous collected add to applet
template pass data to the appropriate JVM
sandboxed machine.
The JVM is hooked in using our monitor, which
logs important function calls and arguments.
This way we gather all string generated at
runtime and the functions called.

Garage4Hackers
The JVM Hook
Code would be available here soon.
http://exploit-analysis.com/code/

Garage4Hackers
Same steps goes for all
other file formats
This way we would have a good intelligence
information on what we are processing.

So if static analysis fails, we would be able to
use the collected information to send it to an
appropriate sandbox with the right exploit
application installed.

Garage4Hackers
Sandy
Sandy version 1 Stable release is available
online at

http://exploit-analysis.com.

Version 1 sucks  but more codes is gone flow in
and a better release would be out soon.

Garage4Hackers
Thank You
Contact me at:
https://twitter.com/fb1h2s
https://www.facebook.com/loverahulsas
fb1h2s@gmail.com

Garage4Hackers

Más contenido relacionado

La actualidad más candente

Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)CODE WHITE GmbH
 
Black Hat EU 2010 - Attacking Java Serialized Communication
Black Hat EU 2010 - Attacking Java Serialized CommunicationBlack Hat EU 2010 - Attacking Java Serialized Communication
Black Hat EU 2010 - Attacking Java Serialized Communicationmsaindane
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!Luca Carettoni
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilitiesGreenD0g
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applicationshubx
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java securityveszpremimeetup
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization VulnerabilitiesLuca Carettoni
 
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1ITAS VIETNAM
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000CTruncer
 
Pentester++
Pentester++Pentester++
Pentester++CTruncer
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013midnite_runr
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)CODE WHITE GmbH
 
Abusing Java Remote Interfaces
Abusing Java Remote InterfacesAbusing Java Remote Interfaces
Abusing Java Remote Interfacesjuanvazquezslides
 
Toward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malwareToward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malwareZongXian Shen
 

La actualidad más candente (20)

Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
 
Black Hat EU 2010 - Attacking Java Serialized Communication
Black Hat EU 2010 - Attacking Java Serialized CommunicationBlack Hat EU 2010 - Attacking Java Serialized Communication
Black Hat EU 2010 - Attacking Java Serialized Communication
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
Web-App Remote Code Execution Via Scripting Engines
Web-App Remote Code Execution Via Scripting EnginesWeb-App Remote Code Execution Via Scripting Engines
Web-App Remote Code Execution Via Scripting Engines
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilities
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
 
Tollas Ferenc - Java security
Tollas Ferenc - Java securityTollas Ferenc - Java security
Tollas Ferenc - Java security
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
 
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
[ITAS.VN]CheckMarx-CxSuite-Sample result for webgoat5.3rc1
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
 
Pentester++
Pentester++Pentester++
Pentester++
 
The Veil-Framework
The Veil-FrameworkThe Veil-Framework
The Veil-Framework
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
Codemotion 2015 spock_workshop
Codemotion 2015 spock_workshopCodemotion 2015 spock_workshop
Codemotion 2015 spock_workshop
 
Abusing Java Remote Interfaces
Abusing Java Remote InterfacesAbusing Java Remote Interfaces
Abusing Java Remote Interfaces
 
Toward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malwareToward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malware
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
 

Destacado

Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection apiMatthieu Aubry
 
Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained SimplyCiaran McHale
 
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
Steelcon 2015 Reverse-Engineering Obfuscated Android ApplicationsSteelcon 2015 Reverse-Engineering Obfuscated Android Applications
Steelcon 2015 Reverse-Engineering Obfuscated Android ApplicationsTom Keetch
 
Code obfuscation
Code obfuscationCode obfuscation
Code obfuscationAmol Kamble
 

Destacado (8)

Java Reflection @KonaTechAdda
Java Reflection @KonaTechAddaJava Reflection @KonaTechAdda
Java Reflection @KonaTechAdda
 
Java reflection
Java reflectionJava reflection
Java reflection
 
Easy rest service using PHP reflection api
Easy rest service using PHP reflection apiEasy rest service using PHP reflection api
Easy rest service using PHP reflection api
 
Java notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esectionJava notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esection
 
Reflection in Java
Reflection in JavaReflection in Java
Reflection in Java
 
Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained Simply
 
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
Steelcon 2015 Reverse-Engineering Obfuscated Android ApplicationsSteelcon 2015 Reverse-Engineering Obfuscated Android Applications
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
 
Code obfuscation
Code obfuscationCode obfuscation
Code obfuscation
 

Similar a Automated Exploit Analysis and Extraction of Java Malware

Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019Codemotion
 
Android security and penetration testing | DIVA | Yogesh Ojha
Android security and penetration testing | DIVA | Yogesh OjhaAndroid security and penetration testing | DIVA | Yogesh Ojha
Android security and penetration testing | DIVA | Yogesh OjhaYogesh Ojha
 
Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5Jim Manico
 
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...Mobodexter
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxwhittemorelucilla
 
Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security ClassRich Helton
 
Making Security Agile
Making Security AgileMaking Security Agile
Making Security AgileOleg Gryb
 
AppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileAppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileOleg Gryb
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysisAbdulrahman Bassam
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chanceDr. Anish Cheriyan (PhD)
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web applicationSecurity Bootcamp
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013drewz lin
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guideSudhanshu Chauhan
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworksphanleson
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.pptHaymanotTadese
 
Javascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackRan Bar-Zik
 
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.Rahul Sasi
 

Similar a Automated Exploit Analysis and Extraction of Java Malware (20)

Advanced Java
Advanced JavaAdvanced Java
Advanced Java
 
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
 
Android security and penetration testing | DIVA | Yogesh Ojha
Android security and penetration testing | DIVA | Yogesh OjhaAndroid security and penetration testing | DIVA | Yogesh Ojha
Android security and penetration testing | DIVA | Yogesh Ojha
 
Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5
 
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...
Top 10 Software to Detect & Prevent Security Vulnerabilities from BlackHat US...
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docx
 
Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security Class
 
Making Security Agile
Making Security AgileMaking Security Agile
Making Security Agile
 
AppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileAppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security Agile
 
FEATURES OF JAVA
FEATURES OF JAVAFEATURES OF JAVA
FEATURES OF JAVA
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysis
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chance
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013
 
Security in Java
Security in JavaSecurity in Java
Security in Java
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guide
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
Javascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stack
 
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.
Is NetTraveler APT managed by PLA Military Camp in Lanzhou [China] ???.
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Automated Exploit Analysis and Extraction of Java Malware

  • 1. Sandy The Malicious Exploit Analysis. http://exploit-analysis.com/ Static Analysis and Dynamic exploit analysis Garage4Hackers
  • 2. About Me I work as a Researcher for a Global Threat Research firm. Spoke at the few security conferences like HITB [KL], BlackHat [US Arsenal], Cocon (2011, 2012), Nullcon (2011, 2012), HITB (AMS 2012) and BlackHat (EU 2012), EKoparty (Argentina), CanSecwest(2013), HITCon(2013). One of the admins of www.Garage4Hackers.com. I cook . https://twitter.com/fb1h2s Garage4Hackers
  • 3. About this Talk With the rise in number of targeted attacks against government and private companies, there is a certain requirement for automated exploit analysis and filtering document file formats. This talk would be on intelligent automated exploit analysis and a free tool [sandy] we have build for analyzing these exploits. Sandy is capable of doing exploit analysis on Doc, RTF, XLS,PPT, Jar, Urls, but in the current talk we would be concentrating on Java Exploits. Garage4Hackers
  • 4. What is Sandy Sandy is an online sandbox capable of doing both static and dynamic analysis of Malicious Office, PDF, Jar, Flash, HTML. The input would be the above mentioned file formats and output would be extracted malwares, controllers, Urls Version 1: http://www.exploit-analysis.com Garage4Hackers
  • 5. Status of No of Documents Exploits Source: virus total
  • 6. Analyzing samples manually is more than impossible . We see more than 2000 exploits a day, and need to understand the file formats need to know the version and the ugly obfuscation the exploit developers use, in order to extract the binaries. These days since java is getting raped , there are hell a lot of java exploits as well. We need a solution to bulk process these samples and give the binary files. Garage4Hackers
  • 7. Why not use Current Sandboxes Time consuming: It takes least 3-4 minutes to do a dynamic analysis on sandbox. One sample at a time on a dedicated box is too much resource consuming. The sandbox might not have the actual software version to get the exploit working . Some times there would be version and language checking for the exploit to work. Java Exploits need the html template and right parameters to get exploited properly. Garage4Hackers
  • 8. Static Analysis Automating static analysis would not provide best results always. Manually spending time on each sample is suicidal . And that’s when we decided to create sandy, intelligent analysis is better than blind analysis. Garage4Hackers
  • 9. Sandy: Static and Dynamic Engine. Performs both static and Dynamic analysis. The static analysis done on the exploits is used to perform intelligent dynamic analysis. So final aim of sandy is to take in file formats and give the binary, controllers embedded inside it and attribution. Garage4Hackers
  • 10. The Architecture Information • Web Interface Exploits • Static Analysis • Dynamic Analysis Report Garage4Hackers
  • 12. Agenda We will explain the many things we learned building the system. Java Security architecture explained. Java Exploits explained in detail with [Poc]. Java exploits and different exploit reliability mechanisms used . Java Static analysis automation. Java Dynamic instrumentation. { Not a lot of new things , just automation and things I learned building the tool } Garage4Hackers
  • 13. Java Exploits [ Applet] Input is java .jar files or .class files. Jar applets need the right arguments to run from a webpage. Java applets runs in a sandboxed environment and all the exploits seen in the wild uses a sandbox bypass technique . Garage4Hackers
  • 14. The kind of Java Exploits seen between 2011-2013 Java Type Confusion Exploits. [CVE2012-0507, CVE-2013-0431 ] Java Logic error and sandbox bypass. [CVE-2012-4681] Argument Injection [CVE-2010-0886 ] Memory Corruptions. [CVE-2013-1493 ] Garage4Hackers
  • 15. Java Sandbox • Before Getting into Java Exploits and Exploit analysis lets review Java security Architecture. Garage4Hackers
  • 16. Default Sandbox settings prevents applet from: Ref: http://www.blackhat.com/presentations/bh-asia-02/LSD/bh-asia-02-lsd.pdf Garage4Hackers
  • 17. Java Sandbox Java Security is handled by the a Java Sandbox . The role of the sandbox is to provide a very restricted environment in which to run untrusted code obtained from the open network. The java sandbox is only enforced on web applets and not on java codes running on the local machines. Ref: http://docs.oracle.com/javase/7/docs/technotes/guides/security/spec/securityspec.doc1.html http://www.blackhat.com/presentations/bh-asia-02/LSD/bh-asia-02-lsd.pdf Garage4Hackers
  • 18. Sandboxed : So the following applet with the compiled class file when run form the browser would be executing on a controlled environment. <APPLET CODE="Main.class" WIDTH="800" HEIGHT="500"> Garage4Hackers
  • 19. By Default: By default java is designed to be safe having solutions for a lot of common security issues, including but not limited to buffer overflows, memory management , type checking . One type of files that are by default allowed to run outside the Sandboxed environment are the "Signed Applets" Garage4Hackers
  • 20. Previously all the security checks were programmatically implemented. But later a in-order to make things more convenient and to manage java security restrictions easily , java introduced an easy to manage "Java Platform Security Model" . Garage4Hackers
  • 21. New Changes had the following features In other words, a less "powerful" domain cannot gain additional permissions as a result of calling or being called by a more powerful domain. The above implementation brought in, Permission Check | Access Controls Implementation Garage4Hackers
  • 22. Permission Check | Access Controls Implementation . All the permission are enforced in a policy file located at []java-dir]/lib/security/java.policy . Garage4Hackers
  • 23. Access Controls Implementation 1) A stack based access control. 2) Each API when called is checked for it's permission before getting executed. 3) The above is done by java.security.AccessController.checkPermission Garage4Hackers
  • 24. So the basic pesudocode of java.security.AccessController.check-Permission would be as follows. Garage4Hackers
  • 25. Few Java Properties to Remember. • Java Restricted Packages • Java Security Manager • Reflection • Type safety Garage4Hackers
  • 26. Java Restricted Packages There are packages in Java that cannot be accessed by untrusted code by default. These packages have the capability to execute privileged codes, or anything that is possible with java.  sun.awt.SunToolkit Garage4Hackers
  • 27. Security Manager “Security manager is an object that defines a security policy for an application” You can programmatically manage security policies using the SecurityManager class Java.lang.System.setSecurityManager is the method that sets security manager for the application. Turning off the security manager is simple as adding this to you'r code. [Having right privilege] Java.lang.System.setSecurityManager(null) Ref:BH_US_12_Oh_Recent_Java_Exploitation_Trends_and_Malware_WP.pdf Garage4Hackers
  • 28. The following Packages Implement the Security Manager Ref: http://www.exploit-db.com/wp-content/themes/exploit/docs/21321.pdf Garage4Hackers
  • 29. Sandbox Bypass Disable Security manager code: Java.lang.System.setSecurityManager(nu ll) Disabling security manager is only possible by a signed java applet or after a privilege escalation, and hence the above code is always seen in all the latest java exploits [obfuscated] majority of times. When a java sandbox bypass in done the code will have privileges to disable the security manager. Garage4Hackers
  • 30. Analysis of Type of Exploits and Poc Java Type Confusion Exploits. [CVE2012-0507, CVE-2013-0431 ] Java Logic error and sandbox bypass. [CVE-2012-4681] Argument Injection [CVE-2010-0886 ] Memory Corruptions. [CVE-2013-1493 ] Garage4Hackers
  • 31. Reflection Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java virtual machine. Ref: http://docs.oracle.com/javase/tutorial/reflect/ Garage4Hackers
  • 32. With Reflection : 1) Can create an instance of a class at runtime and use it while executing. 2) Can access private class members 3) We can access private methods and variable, hidden class members . None of the above is possible when security manager is enabled. Currently security checks are for all Java programs Garage4Hackers
  • 33. Type safety The storage format, having defined a specific type or storage . Type safety is generally done by 1) performing static analysis before code runs 2)performing type safety check when program runs Java type safety is done by static check at the time of compilation. So if a type changes at runtime then it’s impossible to do the safe check. Garage4Hackers
  • 34. Type Confusion One type impersonating as another . Type confusion can be at object level can lead to vulnerability at whole application level. Ref:(http://www.securingjava.com/chapter-two/chapter-two-10.html http://www.securingjava.com/chapter-five/chapter-five-7.html Garage4Hackers
  • 35. CVE-2012-0507 - Java Atomic Reference Array Exploit POC Explained AtomicReferenceArray ara = new AtomicReferenceArray(new Integer[1]); Integer value = (Integer)ara.get(0); // value set to type integer of atomic ref array AtomicReferenceArray uses sun.misc.Unsafe to directly access the array With this we can do “ AtomicReferenceArray.set() “ method allows you to store any reference in the array. So we can replace integer value with any reference in the array, and type safety check is bypassed. Garage4Hackers
  • 36. POC AtomicReferenceArray ara = new AtomicReferenceArray(new Integer[1]); ara.set(0, "foo"); Integer value = (Integer)ara.get(0); • Now value contains a string while being typed as Integer. • With this we can disable security manager , and sanbox restriction would be bypassed. Garage4Hackers
  • 37. Memory corruption CVE-2013-1493 Memory corruption in java POC : • Memmory corruption in BufferedImage . • Before triggering the vulnerability , call java garagbage collector to clean the heap. • Do a heap spray , trigger the vulnerability and get control of the program and disable java security manager, since the applet has control over it. • Game Over. Garage4Hackers
  • 38. CVE-2012-4681 - Accessing restricted class with [ com.sun.beans.finder.ClassFinder ] Classfinder.findclass was able to access restricted class . Get accessor to private "acc" field of Statement.class . {Java 7} Create Access control context with all permission Create statement that disables security manager. Set "acc" field accessor with permissions and security manager statement. Execute and disable security manager Game over. Ref: http://www.docjar.com/docs/api/com/sun/beans/finder/ClassFinder.html Garage4Hackers
  • 39. Argument Injection CVE-2012-0500: Java Web Start Plugin Poc Code explanation. Arg injection in JNPL config file. http://www.garage4hackers.com/content.php?r=114-Binary-Analysis-of-OracleJava-CVE-2012-0500-and-Alternate-Exploitation-on-Win-Linux Garage4Hackers
  • 41. How Sandy Handles HTML Obfuscation All the analysis are carried out on a real browser whose driver is controlled by sandy code. Once the exploits runs the obfuscated code and writes the exploits to the dom, the de-obfuscated html is picked up and analyzed. This way all runtime obfuscation would be decompiled and we would get the original payload. Garage4Hackers
  • 43. Controlled Browser Certain exploits get triggered only on a “mousemove” or any “mouse-events”, we can pass those as well. Sandy is able to detect these events and would be able to pass any JS events to the browser there by defeating the above protections. We can analyze multiple urls at the same time on a single sandbox. [Less resource consuming ] Garage4Hackers
  • 44. URL Analysis Each URL analysis go through individual proxys. Merits: One sandbox[browser] can analyze multiple URLS. Inject our JavaScript logger into each page. <script src="logger.js" type="text/javascript"></script> The Html/JS traffic is inspected for common exploit pattern. Once Dom is populated we inspect that source Garage4Hackers again.
  • 45. Demo Sandy Dynamic module dealing with URL Exploits and obfuscation. If a jar is dropped then a static analysis is done on it. Garage4Hackers
  • 46. Sandy Submission:1 URL Module Based on a URL submission on: 2013-08-22 Karnataka Gov website infected. http://exploitanalysis.com/sandy/view/linkscan_view.php?id=Xqs mOI%2BFHGTY8i1TTHT7dg%3D%3D http://exploitanalysis.com/sandy/view/linkscan_view.php?id=z7B 42P%2Fd1v1077W%2F06Yo6g%3D%3D A music Company infected with java exploit. Garage4Hackers
  • 47. If .class file: Disassemble the source look for strings matching external links. Identify the Java build version using the magic number + 4 Decompile the source using [Jad] Garage4Hackers
  • 48. If jar file: Disassemble the source look for strings matching external links. Identify the Java build version using the magic number + 4 Decompile the source using [Jad] Extract all files from the jar file Detect CVE or possible Java version the exploit will work. Garage4Hackers
  • 49. Java Static Analysis Search for string for any java version|lang mentioned. “System.getProperty(“ Extract Java main class name. Extract imported class names. Extract parameter names to be used and to be supplied to the applet to run properly. Extract os commands other other interesting information's. Extracts Encryptions used .  javax.crypto.* Garage4Hackers
  • 50. • If jar: Look for binaries inside the jar files. Some times xor encrypted, do quick brute do an entropy analysis to find key. Garage4Hackers
  • 51. Identify the java main class. • Look inside java manifest file • Disassemble jar code locate “main(“ string • Use javap[magic headers] to identify the version built. • Use the java class path load the java file . Garage4Hackers
  • 52. Demo Jar Analysis Sandy static module dealing with Jar Exploits. Garage4Hackers
  • 53. Central Tibet Waterhole Java exploit Submission on 16th Aug Garage4Hackers
  • 54. Central Tibet Waterhole Java exploit Attackers hacked Central Tibet website. [Trusted and most visited site for Tibet ] Added a java exploit . On users visiting the site they would be infected by a malware. The dropped malware was a windows backdoor. http://exploitanalysis.com/sandy/view/view_java.php?md5=0 K%2B7TOrG6AqDbVRTm54ZCQ%3D%3D. Garage4Hackers
  • 55. Obfuscation in Java code String Obfuscation and dynamic string generation. Dynamic Class resolution . Class method obfuscation . Anti Decompiling Garage4Hackers
  • 56. String Obfuscation in in Java Java obfuscation is done mainly by dynamically constructing the function calls and strings. Example Garage4Hackers
  • 57. Sandy Submission:3 Java Module Submission on 12-09-2013 Java exploit, dropping windows and OSX malware , possibly targeting #tibet. http://exploit-analysis.com/sandy/view/view_java.php?md5=94ra2GG5en6x7uz3dtkSAg%3D%3D Garage4Hackers
  • 58. Obfuscation using 2 way encryptions. Look for traces of common algorithms used based on signatures. import javax.crypto.*; import java.security.spec.InvalidKeySpecException; Look for traces of Encrypted strings, and decryption keys. Based on string length 16-byte, 32-byte etc. And try to do a quick brute force on possible algorithms. Garage4Hackers
  • 59. Java Malware Analysis Demo h t t p : / / e x p l o i t analysis.com/sandy/view/view_java.php?md5=JR2Xv 0QuTlgve9o%2FdzNP1A%3D%3D Garage4Hackers
  • 60. Anti Decompiling Then static analysis becomes hard for sandy, so it proceeds to dynamic. Read More: http://www.securelist.com/en/analysis/204792300/Anti_d ecompiling_techniques_in_malicious_Java_Applets Garage4Hackers
  • 61. If No Binary : Do Dynamic Analysis Construct an applet template. Use the previous collected add to applet template pass data to the appropriate JVM sandboxed machine. The JVM is hooked in using our monitor, which logs important function calls and arguments. This way we gather all string generated at runtime and the functions called. Garage4Hackers
  • 62. The JVM Hook Code would be available here soon. http://exploit-analysis.com/code/ Garage4Hackers
  • 63. Same steps goes for all other file formats This way we would have a good intelligence information on what we are processing. So if static analysis fails, we would be able to use the collected information to send it to an appropriate sandbox with the right exploit application installed. Garage4Hackers
  • 64. Sandy Sandy version 1 Stable release is available online at http://exploit-analysis.com. Version 1 sucks  but more codes is gone flow in and a better release would be out soon. Garage4Hackers
  • 65. Thank You Contact me at: https://twitter.com/fb1h2s https://www.facebook.com/loverahulsas fb1h2s@gmail.com Garage4Hackers

Notas del editor

  1. Its always good when urboaringgov website gets redirected to a some page with beautiful women.