SlideShare ist ein Scribd-Unternehmen logo
1 von 83
Downloaden Sie, um offline zu lesen
DC5527
Maycon Maia Vitali
maycon@hacknroll.com
DC5527.ORG DEF CON GROUP
REVERSING ANDROID APPLICATIONS
FOR FUN AND PROFIT
AGENDA
●
Who am I?
●
Hello Android!
●
Reversing Toolset
●
Static Analysis
–
(Short Introduction to) Smali Code
●
Dynamic Analysis
– Binary Instrumentation
●
Let’s Go
– Patching WhatsApp Messenger (On-the-fly)
– Patching WhatsApp Messenger (Binary APK)
WHO AM I?
●
Maycon Maia Vitali
●
Bsc & Msc in Computer Science
●
Trustwave
– Security Consultant @ SpiderLabs
– Member of Mobile Application Security VT
●
Hack N’ Roll - Member & Founder
●
DC5527 Defcon Group - Member & Founder
●
Certifications
– Offensive Security Certified Expert (OSCE)
– Mobile Application Penetration Test (MAPT)
HELLO WORLD, ANDROID!
ANDROID FUNDAMENTALS
Application Components
●
Activities
– Entry point for interacting with the user
●
Services
– Keep an app running in the background
●
Content Providers
– App data that you can store in the file system
●
Broadcast Receivers
– Enables the system to deliver events
THE MANIFEST FILE
AndroidManifest.xml
●
Application information
– Name, Version, API Level, SDK version etc.
●
User permissions
– Internet Access, Camera, access external storage etc.
●
Components
– Activities, Services, Receivers and Providers
●
Componentes resources
THE MANIFEST FILE
AndroidManifest.xml
THE MANIFEST FILE
AndroidManifest.xml
Package
Informations
THE MANIFEST FILE
AndroidManifest.xml
Permissions
THE MANIFEST FILE
AndroidManifest.xml
Activity
Component
THE MANIFEST FILE
AndroidManifest.xml
Resource
THE MANIFEST FILE
AndroidManifest.xml
Intent Filters
REVERSING TOOLSET
REVERSING TOOLSET
●
adb
– Android Debug Bridge
●
unzip + dex2jar
– Decompres apk file and convert .dex file to .class
●
apktool + keytool + jarsigner
– Decode/build/sign .apk files
●
ByteCode Viewer <3
– Last two toolset
●
Frida <3
– Android process instrumentation tool
ANDROID DEBUG BRIDGE
adb
●
adb forward <local> <remote>
●
adb install <apk>
●
adb uninstall <pkg>
●
adb sideload <file>
●
adb push <local>... <remote>
●
adb pull <remote>... <local>
●
adb -s <specific device> ...
●
adb logcat
●
adb kill-server
●
adb start-server
●
adb devices -l
●
adb shell
●
adb root
●
adb unroot
ANDROID DEBUG BRIDGE
adb
ANDROID DEBUG BRIDGE
adb
ANDROID DEBUG BRIDGE
adb
ANDROID DEBUG BRIDGE
adb
DECOMPRESS APK FILE
unzip + dex2jar
DECOMPRESS APK FILE
unzip + dex2jar
DECOMPRESS APK FILE
unzip + dex2jar
DECOMPRESS APK FILE
unzip + dex2jar
DECOMPRESS APK FILE
unzip + dex2jar
DECOMPRESS APK FILE
unzip + dex2jar
apktool + keytool + jarsigner
apktool + keytool + jarsigner
apktool + keytool + jarsigner
$ vim ./build_sign_install.sh
BYTECODE VIEWER
procyon + CFR + JD-GUI + FernFlower + Krakatau
STATIC ANALYSIS
Introduction to Smali Language
INTRODUCTION TO SMALI
Registers
●
Virtual Registers
– Up to 64k registes
– 128 first are the most common (v0, v1, v2 …)
– Can store everything (int, float, Object …)
– Two naming schema:
●
Local: v0, v1, v2…
●
Params: p0, p1, p2…
Local Param
v0 First local register
v1 Second local register
v2 p0 First param register
v3 p1 Second param registers
v4 p2 Third param register
INTRODUCTION TO SMALI
Data Type
●
Primitive Data Type
– I – int
– J – long
– Z – boolean
– D – double
– F – float
– S – short
– C – char
– V – void (when return value)
●
Classes:
– Ljava/lang/Object;
●
Arrays:
– [I
– [Ljava/lang/Object;
– [[I
●
List of types: simple concatenation
– getAttr(Landroid/util/AttributeSet;[III)
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Java Smali→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
INTRODUCTION TO SMALI
Smali Java→
DYNAMIC ANALYSIS
Binary Instrumentation
Frida
Introduction
●
Inject Javascript to explore native applications
●
Compatible with many OS
– Windows, MacOS, Linux, iOS, Android and QNX.
●
Extremely useful for…
– … custom debugger.
– … hook any function.
– … spy on Crypt API.
– … trace application code.
●
No source-code needed.
Frida
Instalation Instructions (client)
Frida
Instalation Instructions (client)
Frida
Instalation Instructions (client)
Frida
Instalation Instructions (server)
Frida
frida-ps
Frida
frida-trace
Frida
frida-trace (scripting)
./__handlers__/libc.so/open.js
Frida
frida-trace (scripting)
./__handlers__/libc.so/open.js
Frida
frida-trace (scripting)
./__handlers__/libc.so/open.js
Frida
frida-trace (scripting)
./__handlers__/libc.so/open.js
Frida
Hooking
Frida
Hooking
Frida
Hooking
Frida
Hooking
Frida
Hooking
Frida
Hooking
Frida
Hooking
DEMO
DC5527
Maycon Maia Vitali
maycon@hacknroll.com
DC5527.ORG DEF CON GROUP
THANK YOU!

Weitere ähnliche Inhalte

Was ist angesagt?

Simplified Security Code Review Process
Simplified Security Code Review ProcessSimplified Security Code Review Process
Simplified Security Code Review Process
Sherif Koussa
 
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CanSecWest
 

Was ist angesagt? (20)

Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer tool
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
An Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices WorldAn Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices World
 
Secure Coding for Java
Secure Coding for JavaSecure Coding for Java
Secure Coding for Java
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
Log4j in 8 slides
Log4j in 8 slidesLog4j in 8 slides
Log4j in 8 slides
 
Understanding android security model
Understanding android security modelUnderstanding android security model
Understanding android security model
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
Podman Overview and internals.pdf
Podman Overview and internals.pdfPodman Overview and internals.pdf
Podman Overview and internals.pdf
 
Simplified Security Code Review Process
Simplified Security Code Review ProcessSimplified Security Code Review Process
Simplified Security Code Review Process
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
 
The Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secureThe Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secure
 
Embedded Rust
Embedded RustEmbedded Rust
Embedded Rust
 
How to Setup A Pen test Lab and How to Play CTF
How to Setup A Pen test Lab and How to Play CTF How to Setup A Pen test Lab and How to Play CTF
How to Setup A Pen test Lab and How to Play CTF
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Owasp zap
Owasp zapOwasp zap
Owasp zap
 
Malware Analysis
Malware Analysis Malware Analysis
Malware Analysis
 
Android malware analysis
Android malware analysisAndroid malware analysis
Android malware analysis
 

Ähnlich wie Reversing Android Applications For Fun and Profit

IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
WithTheBest
 
Hack Attack! An Introduction to Penetration Testing
Hack Attack! An Introduction to Penetration TestingHack Attack! An Introduction to Penetration Testing
Hack Attack! An Introduction to Penetration Testing
Steve Phillips
 

Ähnlich wie Reversing Android Applications For Fun and Profit (20)

Deep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloudDeep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloud
 
IoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT InteroperabilityIoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT Interoperability
 
Connected TIZEN
Connected TIZENConnected TIZEN
Connected TIZEN
 
Tizen Connected with IoTivity
Tizen Connected with IoTivityTizen Connected with IoTivity
Tizen Connected with IoTivity
 
Dynamic Population Discovery for Lateral Movement (Using Machine Learning)
Dynamic Population Discovery for Lateral Movement (Using Machine Learning)Dynamic Population Discovery for Lateral Movement (Using Machine Learning)
Dynamic Population Discovery for Lateral Movement (Using Machine Learning)
 
IoT Agents (With Lightweight M2M)
IoT Agents (With Lightweight M2M)IoT Agents (With Lightweight M2M)
IoT Agents (With Lightweight M2M)
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
 
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
 
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
 
Hack Attack! An Introduction to Penetration Testing
Hack Attack! An Introduction to Penetration TestingHack Attack! An Introduction to Penetration Testing
Hack Attack! An Introduction to Penetration Testing
 
Kali Linux - Falconer
Kali Linux - FalconerKali Linux - Falconer
Kali Linux - Falconer
 
FIWARE IoT Proposal & Community
FIWARE IoT Proposal & CommunityFIWARE IoT Proposal & Community
FIWARE IoT Proposal & Community
 
Uday singh resume
Uday singh resumeUday singh resume
Uday singh resume
 
Code Crime Scene
Code Crime SceneCode Crime Scene
Code Crime Scene
 
The Considerations for Internet of Things @ 2017
The Considerations for Internet of Things @ 2017The Considerations for Internet of Things @ 2017
The Considerations for Internet of Things @ 2017
 
Introduction to Open Telemetry as Observability Library
Introduction to Open  Telemetry as Observability LibraryIntroduction to Open  Telemetry as Observability Library
Introduction to Open Telemetry as Observability Library
 
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
OpenNebulaConf2019 - Crytek: A Video gaming Edge Implementation "on the shoul...
 
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
OpenNebulaConf 2019 - Crytek: A Video gaming Edge Implementation "on the shou...
 
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracingTracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
 
Multi-Agent System for APT Detection
Multi-Agent System for APT DetectionMulti-Agent System for APT Detection
Multi-Agent System for APT Detection
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Reversing Android Applications For Fun and Profit