SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Downloaden Sie, um offline zu lesen
Case Study
Java Hurdling
Obstacles and Techniques in
Java Client Penetration-Testing
Tal Melamed
Application Security Expert
Tal@AppSec-Labs.com
Agenda
Me
AppSec Labs
The problems
Fail #1
Fail #2
Fail #3 }
about:me
Tech Lead @ AppSec Labs
Tal@AppSec-Labs.com
Application Security Expert
Trainer, builder & breaker
Follow me @ appsec.it
https://github.com/nu11p0inter
, but when I do:
http://lnkdin.me/cyber
AppSec Labs
https://appsec-labs.com/
AppSec Labs
Industry vectors:
AppSec Labs provides its high end services to the following
industry vectors:
High Tech software development
Banking and financing
National security
IoT
Cloud
Pharmaceuticals
Commerce
Travel and transport
IT Security products
Biometrics
Education
Gaming
Government
Telecommunications
We are hiring!
jobs@appsec-labs.com
Experienced PT
Exp. Code-Review*
Training skills
Willing to travel *
English
Independent work and self-learning ability
Disclaimer
This is a true story. The events depicted in this talk
took place in 2016.
At the request of the survivors, names, characters,
places and incidents were changed, and are either
products of the author’s imagination
or are used fictitiously.
Any resemblance to actual events
or locales or persons,
living or dead, is entirely coincidental.
The rest is told exactly as it occurred.
Warning: this presentation might contain memes…
The Problems
TCP rather than HTTP
SSL/TLS
Certificate Pinning
Runtime manipulation
Patching the application
ProKSy – revealed for the first time…
Day 1: I Got This!
Let’s use BURP! - set the HTTP Proxy (option in tool)
Nothing happens…
Looking at WireShark
Port 1XXXX TLS - Not HTTP!
Sure, let use AppSec Labs’ incredible TCP proxy tool (TBC)
Problem #1: No HTTP/S
We all Burp (nothing to be ashamed about)
But what if…
the application is not communicating over HTTP(s)?
Echo Mirage – by Wildcroft Security
Link: unknown (good luck with FileHippo)
Advanced Packet Editor
https://appsec-labs.com/advanced-packet-editor/
https://github.com/appsec-labs/Advanced_Packet_Editor
Based on:
APE
Intercept & tamper with TCP-based comm
APE
What‘s new
APE
External Filter – python based
APE – Listen to Requests
HTTP/S? – Why not integrating with Burp?
What Really Happened?
Nothing! Probably SSL…
(Also, doesn’t work on 64-bit)
What Else is There?
Stcppipe
http://aluigi.altervista.org/mytoolz/stcppipe.zip
A Fraction of Hope…
Side Note: De/Serialization
What is Serialization
Converting the state of data to a byte stream so that the byte stream
can be reverted back into a copy of the object
What is the problem?
Deserialization of untrusted data
What does that mean?
De-serializing data coming from the client could abuse the application
logic, deny service, or execute arbitrary code.
What to look for?
ObjectInput.readObject()
Externalizable.readExternal()
Serializable.readResolve()
ObjectOutputStream.replaceObject()
ObjectInputStream.readUnshared()
Many more…
All You Need to Know…
You can find everything here:
https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet
https://github.com/njfox/Java-Deserialization-Exploit
PayPal RCE (2016)
http://artsploit.blogspot.co.il/2016/01/paypal-rce.html
Burp Extension
https://github.com/NetSPI/JavaSerialKiller
https://github.com/federicodotta/BurpJDSer-ng-edited
https://appsec-labs.com/belch/
Scanner
https://github.com/federicodotta/Java-Deserialization-Scanner
Code Analyzer
https://github.com/mbechler/serianalyzer
Where Were We?
I can see the traffic, but how do I tamper with it?
Tunnel “stripped” traffic onto APE!
We need to inject APE into stcppipe
And… Fail #1
APE got the encrypted data
How Do We Intercept TCP Over SSL?
Download TcpCatcher
http://www.tcpcatcher.org/
Download TcpCathcer’s root certificate
Install it as a RootCA in the KeyStore
Download KeyStore Explorer
http://www.keystore-explorer.org/
How Do We Intercept TCP Over SSL?
Configure TcpCatcher to communication with both, the
client and the server
TcpCatcherwill now serve as a MitM.
Woohoo!
What Really Happened?
It didn’t work!
Let’s say I got this…………….
Let’s decode:
Now, That my friends….
Is SSL pinning!
The application validates the info of the received
(TcpCatcher’s) certificate, against the wanted info,
hardcoded in the class.
Since it’s a self-signed certificate – we could just
replace it with our own.
You passphrase is: “OpenSSL”
Create you own self-signed certificate
Fill in the required info (found in the class)
Install the new certificate in the KS.
Should do the trick!
Keytool
keytool -keystore clientkeystore -genkey -alias client
keytool -keystore clientkeystore -certreq -alias client -keyalg rsa -file client.csr
But, which seems to have happened a lot
TcpCatcher does not support using your own
certificate
only on-the-fly ones with a single value.
Other Possible Scenarios
Checking that its “actually” a Root CA.
Create a Root CA, using OpenSSL
Sign your certificate with theRootCA
Import the new Root CA into the default KeyStore
(default password: changeme)
Pinning the Root CA
You might need toactually sign your own certificate
Pinning the intermediate
You’ll probably have to patch the code and replace the int.
public key with your own.
Using self-created KeyStore
Replace the KeyStore
Might require some patching the bypass possible KS
validations (e.g. checksum)
What do we do now?
Let’s hook in runtime!
Goodbye stcppipe.
Hello… JavaSnoop!
Day 2: JavaSnoop
Attaches into any app running over JVM
Hook methods
Tamper with parameters, print stacks, etc.
JavaSnoop
What Really Happened?
After 5 Hours (on the 2nd day!)
I Shall Call Him…
Fail #2
Server checked the value… 
What next?
Let’s patch the JAR!
Day 3: Fail #3
// extract jar
# jar -xf myapp.jar
// pack jar
# jar –cvf <desired.jar> <files>
// update jar
# jar -uf <file.jar> <my.class>
Let’s Modify Classes Directly!
Now, how do you modify class files??
Introducing - JBE
Java Bytecode Editor - http://set.ee/jbe/
Java Bytecode
https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
Java Bytecode Human
ifeq / ifne if value is (not) 0, branch to offset
if_icmpeq /if_icmpne if ints are equal / not equal
iconst_0 / iconst_1 load int=0/ int=1
aload_0 load a reference into a local variable 0
astore_1 store a reference into local variable 1
dcmpg compare two doubles
areturn return a reference form a method
fneg negate a float
ireturn return an integer from a method
ldc push a constant from a constant pool to the stack
Java Bytecode Editor
Demo time…
What REALLY Happened?
0. Load something…
1. If null  jump to 14 (const_0)
4. Load something…
5. Get static “ADMIN”
8. Invoke equals(x,y)
11. If equals  jump to 18 (const_1)
14. (no jump) const_0
15. Go to  19 (return)
18. const_1
19. return
Before…
I’ll Just….
Let Us Pray!
After 2 days and 6 hours
Imagine if…
We needed to create a MitM, to serve as a proxy
between the original MitM and the client, replacing
its on-the-fly certificate with our own certificate
So, now we have:
For the first time!
Introducing…. ProKSy
-- What with the “KS”?
-- Stands for KeyStore :P
https://github.com/nu11p0inter/ProKSy
Demo Time!
The Moral of the Story
What did not work for me, might work for you
Java – might not (fun) “writable”, but “readable”
Never give up - there’s no such thing as “unbreakable”
We love memes
Download ProKSy!
One slide to dl them all
APE - TCP (.net) Proxy for Hooking
https://appsec-labs.com/advanced-packet-editor/
ProKSy - TCP/SSL Proxy for SSL Pinning
https://github.com/nu11p0inter/ProKSy/
JavaSnoop - Java Runtime Manipulation
http://www.aspectsecurity.com/tools/javasnoop
JBE/reJ - Java ByteCode Editing
http://set.ee/jbe/
https://sourceforge.net/projects/rejava
Thank you! see you @ OWASP IL 2017
QUESTIONS?
Tal@AppSec-Labs.com
http://appsec.it
https://github.com/nu11p0inter
http://lnkdin.me/cyber

Weitere ähnliche Inhalte

Was ist angesagt?

Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideVictor Rentea
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfYan Cui
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpracticeGiovanni Asproni
 
Do WAFs dream of static analyzers
Do WAFs dream of static analyzersDo WAFs dream of static analyzers
Do WAFs dream of static analyzersVladimir Kochetkov
 
JRuby 6 Years in Production
JRuby 6 Years in ProductionJRuby 6 Years in Production
JRuby 6 Years in ProductionMark Menard
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
 
Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Eric Phan
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 Edgar Silva
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverlessYan Cui
 
2010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week12010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week1Wolfram Arnold
 
Brief introduction into Padding Oracle attack vector
Brief introduction into Padding Oracle attack vectorBrief introduction into Padding Oracle attack vector
Brief introduction into Padding Oracle attack vectorPayampardaz
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Dror Helper
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018Codemotion
 

Was ist angesagt? (18)

Inversion Of Control: Spring.Net Overview
Inversion Of Control: Spring.Net OverviewInversion Of Control: Spring.Net Overview
Inversion Of Control: Spring.Net Overview
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdf
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpractice
 
Do WAFs dream of static analyzers
Do WAFs dream of static analyzersDo WAFs dream of static analyzers
Do WAFs dream of static analyzers
 
JRuby 6 Years in Production
JRuby 6 Years in ProductionJRuby 6 Years in Production
JRuby 6 Years in Production
 
Asynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFutureAsynchronous API in Java8, how to use CompletableFuture
Asynchronous API in Java8, how to use CompletableFuture
 
Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!
 
JavaOne 2007 - TS4721
JavaOne 2007 - TS4721 JavaOne 2007 - TS4721
JavaOne 2007 - TS4721
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverless
 
2010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week12010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week1
 
Retrofitting
RetrofittingRetrofitting
Retrofitting
 
Brief introduction into Padding Oracle attack vector
Brief introduction into Padding Oracle attack vectorBrief introduction into Padding Oracle attack vector
Brief introduction into Padding Oracle attack vector
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
 

Andere mochten auch

red - The latest Conflict Management Experience
red - The latest Conflict Management Experiencered - The latest Conflict Management Experience
red - The latest Conflict Management ExperienceDaniel Schmid, PhD
 
Sistemas operativos
Sistemas operativosSistemas operativos
Sistemas operativosGerman91010
 
Kallion luona Living water
Kallion luona   Living waterKallion luona   Living water
Kallion luona Living waterTerttu Lajunen
 
Rechazoprueba5a carteles
Rechazoprueba5a cartelesRechazoprueba5a carteles
Rechazoprueba5a cartelesedukfuenla
 
eCommerce day 2017 - On-page Optimization - Soft Uni
eCommerce day 2017 - On-page Optimization - Soft UnieCommerce day 2017 - On-page Optimization - Soft Uni
eCommerce day 2017 - On-page Optimization - Soft UniTendrik
 
What's your native language?
What's your native language?What's your native language?
What's your native language?Suzie Towne
 
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...SaoKim.com.vn
 
ViolacióN A Los Derechos Humanos
ViolacióN A Los Derechos HumanosViolacióN A Los Derechos Humanos
ViolacióN A Los Derechos Humanosguest71e273
 

Andere mochten auch (20)

Matching theory
Matching theoryMatching theory
Matching theory
 
red - The latest Conflict Management Experience
red - The latest Conflict Management Experiencered - The latest Conflict Management Experience
red - The latest Conflict Management Experience
 
итоговый отчет.Docx сделанный арди 30.12.2015г.
итоговый отчет.Docx сделанный арди 30.12.2015г.итоговый отчет.Docx сделанный арди 30.12.2015г.
итоговый отчет.Docx сделанный арди 30.12.2015г.
 
Sistemas operativos
Sistemas operativosSistemas operativos
Sistemas operativos
 
LPC4300_two_cores
LPC4300_two_coresLPC4300_two_cores
LPC4300_two_cores
 
Kallion luona Living water
Kallion luona   Living waterKallion luona   Living water
Kallion luona Living water
 
Rechazoprueba5a carteles
Rechazoprueba5a cartelesRechazoprueba5a carteles
Rechazoprueba5a carteles
 
Nourhan Mansour
Nourhan MansourNourhan Mansour
Nourhan Mansour
 
eCommerce day 2017 - On-page Optimization - Soft Uni
eCommerce day 2017 - On-page Optimization - Soft UnieCommerce day 2017 - On-page Optimization - Soft Uni
eCommerce day 2017 - On-page Optimization - Soft Uni
 
Bases of the design for advertising and promotion
Bases of the design for advertising and promotionBases of the design for advertising and promotion
Bases of the design for advertising and promotion
 
Wasser unser Element
Wasser unser ElementWasser unser Element
Wasser unser Element
 
What's your native language?
What's your native language?What's your native language?
What's your native language?
 
2 s.goda - pvgs ok
2  s.goda - pvgs ok2  s.goda - pvgs ok
2 s.goda - pvgs ok
 
Ceneval planeación estratégica
Ceneval    planeación estratégicaCeneval    planeación estratégica
Ceneval planeación estratégica
 
Role of media in advertising
Role of media in advertisingRole of media in advertising
Role of media in advertising
 
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...
Gói giải pháp toàn diện về xây dựng và phát triển thương hiệu ch...
 
ViolacióN A Los Derechos Humanos
ViolacióN A Los Derechos HumanosViolacióN A Los Derechos Humanos
ViolacióN A Los Derechos Humanos
 
Profile
ProfileProfile
Profile
 
120514 4
120514 4120514 4
120514 4
 
Shri nayika kavacham
Shri nayika kavachamShri nayika kavacham
Shri nayika kavacham
 

Ähnlich wie Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing

Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Visug
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Maarten Balliauw
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Maarten Balliauw
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aopDror Helper
 
Web Application Hacking
Web Application HackingWeb Application Hacking
Web Application HackingSensePost
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav DukhinFwdays
 
Sherlock Homepage - A detective story about running large web services - NDC ...
Sherlock Homepage - A detective story about running large web services - NDC ...Sherlock Homepage - A detective story about running large web services - NDC ...
Sherlock Homepage - A detective story about running large web services - NDC ...Maarten Balliauw
 
Pascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax SecurityPascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax Securityamiable_indian
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioAndrey Karpov
 
Test driven development for infrastructure as-a-code, the future trend_Gianfr...
Test driven development for infrastructure as-a-code, the future trend_Gianfr...Test driven development for infrastructure as-a-code, the future trend_Gianfr...
Test driven development for infrastructure as-a-code, the future trend_Gianfr...Katherine Golovinova
 
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...Zhenzhong Xu
 
Spring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate SchuttaSpring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate SchuttaVMware Tanzu
 
What Are We Still Doing Wrong
What Are We Still Doing WrongWhat Are We Still Doing Wrong
What Are We Still Doing Wrongafa reg
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Cysinfo Cyber Security Community
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Spring training
Spring trainingSpring training
Spring trainingTechFerry
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applicationsIdo Flatow
 

Ähnlich wie Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing (20)

Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
 
Web Application Hacking
Web Application HackingWeb Application Hacking
Web Application Hacking
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
Sherlock Homepage - A detective story about running large web services - NDC ...
Sherlock Homepage - A detective story about running large web services - NDC ...Sherlock Homepage - A detective story about running large web services - NDC ...
Sherlock Homepage - A detective story about running large web services - NDC ...
 
Pascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax SecurityPascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax Security
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-Studio
 
Test driven development for infrastructure as-a-code, the future trend_Gianfr...
Test driven development for infrastructure as-a-code, the future trend_Gianfr...Test driven development for infrastructure as-a-code, the future trend_Gianfr...
Test driven development for infrastructure as-a-code, the future trend_Gianfr...
 
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...
FlinkForward Asia 2019 - Evolving Keystone to an Open Collaborative Real Time...
 
Get cfml Into the Box 2018
Get cfml Into the Box 2018Get cfml Into the Box 2018
Get cfml Into the Box 2018
 
Spring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate SchuttaSpring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate Schutta
 
What Are We Still Doing Wrong
What Are We Still Doing WrongWhat Are We Still Doing Wrong
What Are We Still Doing Wrong
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Spring training
Spring trainingSpring training
Spring training
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applications
 
Grounded Pointers
Grounded PointersGrounded Pointers
Grounded Pointers
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing

  • 1. Case Study Java Hurdling Obstacles and Techniques in Java Client Penetration-Testing Tal Melamed Application Security Expert Tal@AppSec-Labs.com
  • 3. about:me Tech Lead @ AppSec Labs Tal@AppSec-Labs.com Application Security Expert Trainer, builder & breaker Follow me @ appsec.it https://github.com/nu11p0inter , but when I do: http://lnkdin.me/cyber
  • 5. AppSec Labs Industry vectors: AppSec Labs provides its high end services to the following industry vectors: High Tech software development Banking and financing National security IoT Cloud Pharmaceuticals Commerce Travel and transport IT Security products Biometrics Education Gaming Government Telecommunications
  • 6. We are hiring! jobs@appsec-labs.com Experienced PT Exp. Code-Review* Training skills Willing to travel * English Independent work and self-learning ability
  • 7. Disclaimer This is a true story. The events depicted in this talk took place in 2016. At the request of the survivors, names, characters, places and incidents were changed, and are either products of the author’s imagination or are used fictitiously. Any resemblance to actual events or locales or persons, living or dead, is entirely coincidental. The rest is told exactly as it occurred. Warning: this presentation might contain memes…
  • 8. The Problems TCP rather than HTTP SSL/TLS Certificate Pinning Runtime manipulation Patching the application ProKSy – revealed for the first time…
  • 9. Day 1: I Got This! Let’s use BURP! - set the HTTP Proxy (option in tool) Nothing happens… Looking at WireShark Port 1XXXX TLS - Not HTTP! Sure, let use AppSec Labs’ incredible TCP proxy tool (TBC)
  • 10. Problem #1: No HTTP/S We all Burp (nothing to be ashamed about) But what if… the application is not communicating over HTTP(s)?
  • 11. Echo Mirage – by Wildcroft Security Link: unknown (good luck with FileHippo)
  • 13. APE Intercept & tamper with TCP-based comm
  • 15. APE External Filter – python based
  • 16. APE – Listen to Requests HTTP/S? – Why not integrating with Burp?
  • 17. What Really Happened? Nothing! Probably SSL… (Also, doesn’t work on 64-bit)
  • 18. What Else is There? Stcppipe http://aluigi.altervista.org/mytoolz/stcppipe.zip
  • 19. A Fraction of Hope…
  • 20. Side Note: De/Serialization What is Serialization Converting the state of data to a byte stream so that the byte stream can be reverted back into a copy of the object What is the problem? Deserialization of untrusted data What does that mean? De-serializing data coming from the client could abuse the application logic, deny service, or execute arbitrary code. What to look for? ObjectInput.readObject() Externalizable.readExternal() Serializable.readResolve() ObjectOutputStream.replaceObject() ObjectInputStream.readUnshared() Many more…
  • 21. All You Need to Know… You can find everything here: https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet https://github.com/njfox/Java-Deserialization-Exploit PayPal RCE (2016) http://artsploit.blogspot.co.il/2016/01/paypal-rce.html Burp Extension https://github.com/NetSPI/JavaSerialKiller https://github.com/federicodotta/BurpJDSer-ng-edited https://appsec-labs.com/belch/ Scanner https://github.com/federicodotta/Java-Deserialization-Scanner Code Analyzer https://github.com/mbechler/serianalyzer
  • 22. Where Were We? I can see the traffic, but how do I tamper with it? Tunnel “stripped” traffic onto APE! We need to inject APE into stcppipe
  • 23. And… Fail #1 APE got the encrypted data
  • 24. How Do We Intercept TCP Over SSL? Download TcpCatcher http://www.tcpcatcher.org/ Download TcpCathcer’s root certificate Install it as a RootCA in the KeyStore Download KeyStore Explorer http://www.keystore-explorer.org/
  • 25. How Do We Intercept TCP Over SSL? Configure TcpCatcher to communication with both, the client and the server TcpCatcherwill now serve as a MitM.
  • 27. What Really Happened? It didn’t work! Let’s say I got this……………. Let’s decode:
  • 28. Now, That my friends…. Is SSL pinning! The application validates the info of the received (TcpCatcher’s) certificate, against the wanted info, hardcoded in the class. Since it’s a self-signed certificate – we could just replace it with our own. You passphrase is: “OpenSSL” Create you own self-signed certificate Fill in the required info (found in the class) Install the new certificate in the KS. Should do the trick!
  • 29. Keytool keytool -keystore clientkeystore -genkey -alias client keytool -keystore clientkeystore -certreq -alias client -keyalg rsa -file client.csr
  • 30. But, which seems to have happened a lot TcpCatcher does not support using your own certificate only on-the-fly ones with a single value.
  • 31. Other Possible Scenarios Checking that its “actually” a Root CA. Create a Root CA, using OpenSSL Sign your certificate with theRootCA Import the new Root CA into the default KeyStore (default password: changeme) Pinning the Root CA You might need toactually sign your own certificate Pinning the intermediate You’ll probably have to patch the code and replace the int. public key with your own. Using self-created KeyStore Replace the KeyStore Might require some patching the bypass possible KS validations (e.g. checksum)
  • 32. What do we do now? Let’s hook in runtime! Goodbye stcppipe. Hello… JavaSnoop!
  • 33. Day 2: JavaSnoop Attaches into any app running over JVM Hook methods Tamper with parameters, print stacks, etc.
  • 36. After 5 Hours (on the 2nd day!)
  • 37. I Shall Call Him…
  • 38. Fail #2 Server checked the value…  What next? Let’s patch the JAR!
  • 39. Day 3: Fail #3 // extract jar # jar -xf myapp.jar // pack jar # jar –cvf <desired.jar> <files> // update jar # jar -uf <file.jar> <my.class>
  • 40. Let’s Modify Classes Directly! Now, how do you modify class files??
  • 41. Introducing - JBE Java Bytecode Editor - http://set.ee/jbe/
  • 42. Java Bytecode https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings Java Bytecode Human ifeq / ifne if value is (not) 0, branch to offset if_icmpeq /if_icmpne if ints are equal / not equal iconst_0 / iconst_1 load int=0/ int=1 aload_0 load a reference into a local variable 0 astore_1 store a reference into local variable 1 dcmpg compare two doubles areturn return a reference form a method fneg negate a float ireturn return an integer from a method ldc push a constant from a constant pool to the stack
  • 44. What REALLY Happened? 0. Load something… 1. If null  jump to 14 (const_0) 4. Load something… 5. Get static “ADMIN” 8. Invoke equals(x,y) 11. If equals  jump to 18 (const_1) 14. (no jump) const_0 15. Go to  19 (return) 18. const_1 19. return
  • 48. After 2 days and 6 hours
  • 49. Imagine if… We needed to create a MitM, to serve as a proxy between the original MitM and the client, replacing its on-the-fly certificate with our own certificate So, now we have:
  • 50. For the first time! Introducing…. ProKSy -- What with the “KS”? -- Stands for KeyStore :P https://github.com/nu11p0inter/ProKSy
  • 52. The Moral of the Story What did not work for me, might work for you Java – might not (fun) “writable”, but “readable” Never give up - there’s no such thing as “unbreakable” We love memes Download ProKSy!
  • 53. One slide to dl them all APE - TCP (.net) Proxy for Hooking https://appsec-labs.com/advanced-packet-editor/ ProKSy - TCP/SSL Proxy for SSL Pinning https://github.com/nu11p0inter/ProKSy/ JavaSnoop - Java Runtime Manipulation http://www.aspectsecurity.com/tools/javasnoop JBE/reJ - Java ByteCode Editing http://set.ee/jbe/ https://sourceforge.net/projects/rejava
  • 54. Thank you! see you @ OWASP IL 2017 QUESTIONS? Tal@AppSec-Labs.com http://appsec.it https://github.com/nu11p0inter http://lnkdin.me/cyber