SlideShare a Scribd company logo
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

More Related Content

What's hot (18)

PPTX
Inversion Of Control: Spring.Net Overview
Orbit One - We create coherence
 
PDF
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Victor Rentea
 
PDF
Patterns and practices for building resilient serverless applications.pdf
Yan Cui
 
PDF
Writing usableap isinpractice
Giovanni Asproni
 
PPTX
Do WAFs dream of static analyzers
Vladimir Kochetkov
 
PDF
JRuby 6 Years in Production
Mark Menard
 
PDF
Asynchronous API in Java8, how to use CompletableFuture
José Paumard
 
PPTX
Why you should be using the shiny new C# 6.0 features now!
Eric Phan
 
PPT
JavaOne 2007 - TS4721
Edgar Silva
 
PDF
How to bring chaos engineering to serverless
Yan Cui
 
PDF
2010-07-19_rails_tdd_week1
Wolfram Arnold
 
PPT
Retrofitting
Ted Husted
 
PDF
Brief introduction into Padding Oracle attack vector
Payampardaz
 
PDF
Async await...oh wait!
Thomas Pierrain
 
PDF
Dependency Injection
Giovanni Scerra ☃
 
PPTX
Building unit tests correctly with visual studio 2013
Dror Helper
 
ODP
Intro To Spring Python
gturnquist
 
PDF
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Codemotion
 
Inversion Of Control: Spring.Net Overview
Orbit One - We create coherence
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Victor Rentea
 
Patterns and practices for building resilient serverless applications.pdf
Yan Cui
 
Writing usableap isinpractice
Giovanni Asproni
 
Do WAFs dream of static analyzers
Vladimir Kochetkov
 
JRuby 6 Years in Production
Mark Menard
 
Asynchronous API in Java8, how to use CompletableFuture
José Paumard
 
Why you should be using the shiny new C# 6.0 features now!
Eric Phan
 
JavaOne 2007 - TS4721
Edgar Silva
 
How to bring chaos engineering to serverless
Yan Cui
 
2010-07-19_rails_tdd_week1
Wolfram Arnold
 
Retrofitting
Ted Husted
 
Brief introduction into Padding Oracle attack vector
Payampardaz
 
Async await...oh wait!
Thomas Pierrain
 
Dependency Injection
Giovanni Scerra ☃
 
Building unit tests correctly with visual studio 2013
Dror Helper
 
Intro To Spring Python
gturnquist
 
Matteo Vaccari - Going Frameworkless in the Backend - Codemotion Milan 2018
Codemotion
 

Viewers also liked (20)

PPTX
Matching theory
Pavel Alexeev
 
PDF
red - The latest Conflict Management Experience
Daniel Schmid, PhD
 
PDF
итоговый отчет.Docx сделанный арди 30.12.2015г.
«The Public Organization of Parents of Children with Disabilities "ARDI".
 
PPTX
Sistemas operativos
German91010
 
PDF
LPC4300_two_cores
Massimo Manca
 
PDF
Kallion luona Living water
Terttu Lajunen
 
DOCX
Rechazoprueba5a carteles
edukfuenla
 
DOC
Nourhan Mansour
Nourhan Abd-Allah
 
PPTX
eCommerce day 2017 - On-page Optimization - Soft Uni
Tendrik
 
PPTX
Bases of the design for advertising and promotion
Universidad del Valle de México
 
PPTX
Wasser unser Element
Matthias C. Mend
 
PPTX
What's your native language?
Suzie Towne
 
PPTX
Ceneval planeación estratégica
Universidad del Valle de México
 
PPTX
Role of media in advertising
Universidad del Valle de México
 
PDF
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
 
PPTX
ViolacióN A Los Derechos Humanos
guest71e273
 
DOC
Profile
Alajnha Alsareea
 
PDF
120514 4
Nelly An
 
DOCX
Shri nayika kavacham
Ashish Bhadoriya
 
Matching theory
Pavel Alexeev
 
red - The latest Conflict Management Experience
Daniel Schmid, PhD
 
итоговый отчет.Docx сделанный арди 30.12.2015г.
«The Public Organization of Parents of Children with Disabilities "ARDI".
 
Sistemas operativos
German91010
 
LPC4300_two_cores
Massimo Manca
 
Kallion luona Living water
Terttu Lajunen
 
Rechazoprueba5a carteles
edukfuenla
 
Nourhan Mansour
Nourhan Abd-Allah
 
eCommerce day 2017 - On-page Optimization - Soft Uni
Tendrik
 
Bases of the design for advertising and promotion
Universidad del Valle de México
 
Wasser unser Element
Matthias C. Mend
 
What's your native language?
Suzie Towne
 
Ceneval planeación estratégica
Universidad del Valle de México
 
Role of media in advertising
Universidad del Valle de México
 
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
guest71e273
 
120514 4
Nelly An
 
Shri nayika kavacham
Ashish Bhadoriya
 
Ad

Similar to Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing (20)

PPTX
07 application security fundamentals - part 2 - security mechanisms - data ...
appsec
 
PDF
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
Felipe Prado
 
PPTX
OWASP AppSecCali 2015 - Marshalling Pickles
Christopher Frohoff
 
PPTX
Security Vulnerabilities in Mobile Applications (Kristaps Felzenbergs)
TestDevLab
 
PDF
Java Cryptography Extensions Practical Guide for Programmers The Practical Gu...
degnerjugers
 
PDF
Defcon 27 - Writing custom backdoor payloads with C#
Mauricio Velazco
 
PPTX
owasp top 10
Satish Govindappa
 
PDF
Null Dubai Humla_Romansh_Yadav_Android_app_pentesting
Romansh Yadav
 
PPT
Secure Programming
alpha0
 
PDF
TLS Optimization
Nate Lawson
 
PDF
Tlsoptimizationprint 120224194603-phpapp02
fangjiafu
 
PDF
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold
dxvpbvqlbt970
 
PDF
Jsse
vantinhkhuc
 
PDF
When Crypto Attacks! (Yahoo 2009)
Nate Lawson
 
PDF
Trust boundaries - Confidence 2015
Logicaltrust pl
 
PDF
Java Network Programming, 4th Edition.pdf
ntrgiang203
 
PPTX
Enterprise Cloud Security - Concepts Mash-up
Dileep Kalidindi
 
KEY
Openssl
psychesnet Hsieh
 
PDF
What the Fax!?
Priyanka Aash
 
PDF
Java Network Programming Fourth Edition Harold Elliotte
zubinrlondoit
 
07 application security fundamentals - part 2 - security mechanisms - data ...
appsec
 
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
Felipe Prado
 
OWASP AppSecCali 2015 - Marshalling Pickles
Christopher Frohoff
 
Security Vulnerabilities in Mobile Applications (Kristaps Felzenbergs)
TestDevLab
 
Java Cryptography Extensions Practical Guide for Programmers The Practical Gu...
degnerjugers
 
Defcon 27 - Writing custom backdoor payloads with C#
Mauricio Velazco
 
owasp top 10
Satish Govindappa
 
Null Dubai Humla_Romansh_Yadav_Android_app_pentesting
Romansh Yadav
 
Secure Programming
alpha0
 
TLS Optimization
Nate Lawson
 
Tlsoptimizationprint 120224194603-phpapp02
fangjiafu
 
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold
dxvpbvqlbt970
 
When Crypto Attacks! (Yahoo 2009)
Nate Lawson
 
Trust boundaries - Confidence 2015
Logicaltrust pl
 
Java Network Programming, 4th Edition.pdf
ntrgiang203
 
Enterprise Cloud Security - Concepts Mash-up
Dileep Kalidindi
 
What the Fax!?
Priyanka Aash
 
Java Network Programming Fourth Edition Harold Elliotte
zubinrlondoit
 
Ad

Recently uploaded (20)

PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
July Patch Tuesday
Ivanti
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Python basic programing language for automation
DanialHabibi2
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 

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 [email protected]
  • 3. about:me Tech Lead @ AppSec Labs [email protected] 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! [email protected] 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? [email protected] http://appsec.it https://github.com/nu11p0inter http://lnkdin.me/cyber