SlideShare une entreprise Scribd logo
1  sur  51
Télécharger pour lire hors ligne
MALWARES
Aditya Gupta
Facebook[dot]com/aditya1391
@adi1391
./whoami
• College Student
• Security Researcher
• NOT an expert
• Grey Hat
Agenda
• Android OS Basics
• Inside the APK
• Android Security Model
• Reversing the codes
• Some case studies
• Making our own malware
• Malware = Money
• Mobile App Pentesting
What is Android
• Software Stack including OS,
middleware and applications
• Developed by Google and
OHA(Open Handset Alliance)
• Largest Market Share, more than
Symbian and IOS.
Why Android
• Everywhere! (TV, phones, tablets)
• Easy to expl0it + Open Source
• Runs on Linux 2.6.x kernel
• Uses SQLite database
• Huge community base
• Official market containing over 4,00,000 apps
ANDROID ARCHITECTURE
Android Applications
• .apk (Android Package)
format
• Nothing more than a zip
file.
• Written exclusively in Java,
with native libraries in
C/C++.
• Composed of components
such as Activities, Services,
Broadcast Recievers, etc.
Android Applications
APK
META-INF res AndroidManifest.xml Classes.dex resources
ACTIVITY
• Screen to let users interact
• Consists of views ( Buttons,
TextView, ImageView, Table
view, List view etc)
• “main” activity presented
on start
• Lifecycle is “LIFO”
ACTIVITY
• Follows the Activity
Lifecycle.
• Activity of one
application can be
accessed by other
application*.
• Permission has to be
granted
SERVICE
• Performs the work in the background
• Doesn’t comes with a UI
• Can be either stated or bound(or both)
• Example – playing music in the bg, network
activities, file i/o operations etc.
Other Components
• Broadcast Reciever
receives and responds to broadcast announcements
Incoming SMS , Screen Off etc.
• Intents
Binds individual components at runtime
• Content Providers
Stores and retrieves the application data
Data stored in an SQLite database
• Preinstalled on all
Android devices
• Contains over 4.5 billion
apps
• Anyone can publish
his/her app
Permissions.. WTF?
• Declared in
AndroidManifest.xml
• XML file containing all
the components and
permissions
• Can only use the
declared permissions
Permissions.. WTF?
• ACCESS_COARSE_LOCATION
• ACCESS_FINE_LOCATION
• BRICK
• CALL_PHONE
• INTERNET
• GET_ACCOUNTS
• PROCESS_OUTGOING_CALLS
• READ_OWNER_DATA
• READ_SMS
• RECEIVE_SMS
• SEND_SMS
• USE_CREDENTIALS
• WRITE_OWNER_DATA
• RECORD_AUDIO
Android Security Model
• Each application is run within a Dalvik Virtual Machine
• With unique UID:GID
• By default no permission is granted
• Permissions required by an application have to be
approved by the user.
• Apk files must be signed with a certificate.
UID : 1000
Application 1
UID : 1001
Application 2
UID : 1003
Application 3
UID : 1004
Application 4
UID : 1005
Application 5
SYSTEM PROCESS ( UID : SYSTEM)
LINUX KERNEL
Dalvik VM Dalvik VM Dalvik VM
Dalvik VM Dalvik VM
Android Security Model
DALVIK VIRTUAL MACHINE(DVM)
Created by Dan Bornstein
DVM vs JVM
Virtual System to run the android apps
Register based instead of stack based
Runs the dex(Dalvik Executable) files
REVERSE ENGINEERING
BREAKING THE CODES
Making of the APK
.java .class .dex .apk
Using dx(dexer) of Android SDK
apkbuilder
REVERSING THE APK
.apk.java .class .dex
REVERSING THE APK
Tools of the trade
Dedexer
Baksmali
Undx
JD-GUI
Dex2JAR
DexDump
APKTool
GETTING OUR HANDS DIRTY
DEMO TIME
ANDROID MALWARES
Special thanks to Mila for his awesome website
http://contagiodump.blogspot.com
Memories of the Past
Some famous Android Malwares
• Trojan-SMS.AndroidOS.FakePlayer.a
• Geinimi
• Snake
• DreamDroid
• GGTracker
Trojan-SMS.FakePlayer.a
• Simplest malware till
date.
• Sends SMS to a premium
rated number
• $6-10/sms
• Mainly distributed
through porn/media apps
• Stop watching porn? :O
GEINIMI : THE HOTTEST MALWARE
GEINIMI
• Most sophisticated malware till date.
• Botnet like capabilities
• Multiple variants created on the same device
• Obfuscated code
• Strings decrypted at runtime
• All network data encrypted ( DES with a key - 012345678)
GEINIMI
• Three ways of starting (Using service or Broadcast Receivers
• Makes a connection with C&C server
• Identifies each device with unique IMEI & IMSI
• Can be in 5 states (Start, download, parse, transact, idle)
• Info Stealer
• Infected legitimate apps ( Sex Positions, MonkeyJump2 etc. )
(Another reason for not watching porn on mobile! )
GEINIMI(continued)
• Botnet Command Capabilities :
o call – Call a number
o Email – Send a email
o Smsrecord – Sends all the sms’es to the server
o Install – install an app
o Shell – get a shell
o Contactlist - get the contact list of the victim
o Wallpaper – change the wallpaper etc.
DREAMDROID
• Infected legitimate software
• Hosted at “Android Market”
• Came with exploits namely Exploid ( CVE-2009-1185 ) and
rageagainstthecage(CVE-2010-EASY)
• Multi Staged Payload
• XOR Encrypted data
• Another malware with Botnet capabilities
Creating our own
Android Malware
Agenda
Taking a legitimate app (apk)
Decompile it
Insert our own codes
Repackaging to get a infected APK
PROFIT?
CREATING A MALWARE
Expected Time to be taken < 5 mins
Vulnerable Applications
• GMail App(in <Android v2.1 vuln
to XSS :O
From field: “
onload=window.location=‘http://
google.com’ “@yahoo.com”
(Found by supernothing of
spareclockcycles.org)
• Use this to launch more exploits
such as the Data Stealing Bug or
Free Webkit Exploit
• Steal Emails & SD Card Files
Stored Passwords
• Browser passwords stored in database called
webview.db
• Got r00t?
#adbpull/data/data/com.android.browser/databases/webview.db
#sqlitewebview.db
>SELECT*FROMpassword;
Insecure Data Storage
# cd /data/data/com.evernote
# ls
cache
databases
shared_prefs
lib
# cd shared_prefs
# ls
com.evernote_preferences.xml
# cat com.evernote_preferences.xml
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<string name="serviceHost"><string
name="username">myusername</string>
<boolean name="ACCOUNT_CHECKED" value="true" />
<string name="password">youcanthackme</string>
<int name="servicePort" value="0" />
<boolean name="NotifyUploadStatus" value="true" />
</map>
#
Is that all?
Webkit and platform vulnerabilities
Android 2.0 ,2.1, 2.1.1 WebKit Use-After-Free Exploit
Android 2.0/2.1 Use-After-Free Remote Code Execution on Webkit
Vulnerabilities in Apps, SQLi, XSS, etc.
Use platform vulns to get root & shell
SD card information leakage
XSSF Framework
ROOTSTRAP
Sniffing the network : )
Try MoshZuk & ANTI
Is that all?
Get the
Android
version
Run
matching
exploits
Install
malicious
app
Spread
Profit
[$]Where is the money?[$]
•Mobile App moolah by Jimmy Shah
•Premium Rates SMSes
•Make malwares for sale
•Click Fraud, BlackHat SEO, Traffic generation, PPC Ads
•Steal Accounts/CCs and sell them
•Get personal information and blackmail the owner
•Sign up to many services with your referral id
•Make a bank phishing app
[$$$]100% Illegal Ways to get rich! [$$$]
Your phone has been hacked!
Transfer $1000 to my account
Or else…….
Acc No : xxxxxxxxxxxxxxxxxxxx
[$$]Spread Yourself![$$]
• Forums
• P2P
• Send SMS’es/chat with your download link from the infected user’s phone
• Make a blog of cracked full version of famous android apps!
• Social Network viral scripts
• Android Market
• Amazon App Store
Outlaws vs Angels
The game is over!
• Malware scanners developed for
this platform.
• Lookout(one of the best security
solutions), AVG, Quick Heal,
Kaspersky have come up with
their security solutions.
• Can detect most of the malwares
of this platform.
The game is over!
The game is not over yet!
• Can create a malware not detected by the scanners
• Most of them signature based, so, can easily be bypassed.
• Obfuscating code can bypass most of them.
• Disable the AV
• Encryption for network data.
• Use your own “blackhat” creativity!
MobileApp Pentesting FTW!
MobileApp Pentesting FTW!
• Decompile the apk after pulling it from the phone.
adb pull /data/app(or app-private)/hello.apk
unzip hello.apk
dex2jar classes.dex
jdgui classes2jar.jar
or convert to smali and then analyse the code
adb pull /data/app/hello.apk
unzip hello.apk
java –jar baksmali.jar –o C:pentestapp classes.dex
OR
apktool d hello.apk
MobileApp Pentesting FTW!
• Start Emulator with Proxy
• Install the app in the emulator
• Use Wireshark, Fiddler & Burp Suite to monitor
traffic
• Run the app and check logcat
• WhisperMonitor – Android App to monitor
outgoing traffic
Emulator –avd MYAVD –http-proxy http://127.0.0.1:5001
avd install apptotest.apk
MobileApp Pentesting FTW!
Check the security mechanism and encryption used in a
banking or payment app for network data
Manifest Explorer
Strace for debugging system calls and signals
Check the location where the app stores the login credentials.
THANK YOU!

Contenu connexe

Tendances

Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android SecurityMarakana Inc.
 
Android pen test basics
Android pen test basicsAndroid pen test basics
Android pen test basicsOWASPKerala
 
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...Consulthinkspa
 
Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamMohammed Adam
 
Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)ClubHack
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android ApplicationsCláudio André
 
2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development 2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development Cheng-Yi Yu
 
Hacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OSHacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OSEC-Council
 
Android Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android ApplicationsAndroid Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android Applicationsh4oxer
 
Android Security
Android SecurityAndroid Security
Android SecurityArqum Ahmad
 
The art of android hacking
The art of  android hackingThe art of  android hacking
The art of android hackingAbhinav Mishra
 
[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security WorkshopOWASP
 
Android Security
Android SecurityAndroid Security
Android SecurityLars Jacobs
 
[Wroclaw #2] iOS Security - 101
[Wroclaw #2] iOS Security - 101[Wroclaw #2] iOS Security - 101
[Wroclaw #2] iOS Security - 101OWASP
 
Android Hacking + Pentesting
Android Hacking + Pentesting Android Hacking + Pentesting
Android Hacking + Pentesting Sina Manavi
 
Android Security & Penetration Testing
Android Security & Penetration TestingAndroid Security & Penetration Testing
Android Security & Penetration TestingSubho Halder
 
Android Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsAndroid Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsBlrDroid
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft
 

Tendances (20)

Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
Android pen test basics
Android pen test basicsAndroid pen test basics
Android pen test basics
 
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...Consulthink @ GDG Meets U -  L'Aquila2014  - Codelab: Android Security -Il ke...
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
 
Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed Adam
 
Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
 
2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development 2015.04.24 Updated > Android Security Development - Part 1: App Development
2015.04.24 Updated > Android Security Development - Part 1: App Development
 
Hacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OSHacker Halted 2014 - Reverse Engineering the Android OS
Hacker Halted 2014 - Reverse Engineering the Android OS
 
Android Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android ApplicationsAndroid Security Overview and Safe Practices for Web-Based Android Applications
Android Security Overview and Safe Practices for Web-Based Android Applications
 
Android Security
Android SecurityAndroid Security
Android Security
 
The art of android hacking
The art of  android hackingThe art of  android hacking
The art of android hacking
 
[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop[Wroclaw #1] Android Security Workshop
[Wroclaw #1] Android Security Workshop
 
Android Security
Android SecurityAndroid Security
Android Security
 
[Wroclaw #2] iOS Security - 101
[Wroclaw #2] iOS Security - 101[Wroclaw #2] iOS Security - 101
[Wroclaw #2] iOS Security - 101
 
Hacking Mobile Apps
Hacking Mobile AppsHacking Mobile Apps
Hacking Mobile Apps
 
Android Hacking + Pentesting
Android Hacking + Pentesting Android Hacking + Pentesting
Android Hacking + Pentesting
 
Android Security & Penetration Testing
Android Security & Penetration TestingAndroid Security & Penetration Testing
Android Security & Penetration Testing
 
Android Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android ApplicationsAndroid Security - Common Security Pitfalls in Android Applications
Android Security - Common Security Pitfalls in Android Applications
 
Andriod Pentesting and Malware Analysis
Andriod Pentesting and Malware AnalysisAndriod Pentesting and Malware Analysis
Andriod Pentesting and Malware Analysis
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security Threats
 

Similaire à Hacking your Android (slides)

Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)ClubHack
 
I haz you and pwn your maal
I haz you and pwn your maalI haz you and pwn your maal
I haz you and pwn your maalHarsimran Walia
 
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud XiaoFruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud XiaoShakacon
 
Mobile platform security models
Mobile platform security modelsMobile platform security models
Mobile platform security modelsG Prachi
 
Outsmarting SmartPhones
Outsmarting SmartPhonesOutsmarting SmartPhones
Outsmarting SmartPhonessaurabhharit
 
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Jason Conger
 
Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On AndroidTeachMission
 
Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On AndroidTeachMission
 
Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Stephan Chenette
 
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-Platform
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-PlatformVisual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-Platform
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-PlatformStefano Ottaviani
 
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...Area41
 
android Security
android Security android Security
android Security darkC0de
 
Security News Bytes (Aug Sept 2017)
Security News Bytes (Aug Sept 2017)Security News Bytes (Aug Sept 2017)
Security News Bytes (Aug Sept 2017)Apurv Singh Gautam
 
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
2013 Toorcon San Diego Building Custom Android Malware for Penetration TestingStephan Chenette
 
How iOS and Android Handle Security Webinar
How iOS and Android Handle Security WebinarHow iOS and Android Handle Security Webinar
How iOS and Android Handle Security WebinarDenim Group
 

Similaire à Hacking your Android (slides) (20)

Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)
 
I haz you and pwn your maal
I haz you and pwn your maalI haz you and pwn your maal
I haz you and pwn your maal
 
I haz you and pwn your maal
I haz you and pwn your maalI haz you and pwn your maal
I haz you and pwn your maal
 
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud XiaoFruit vs Zombies:  Defeat Non-jailbroken iOS Malware by Claud Xiao
Fruit vs Zombies: Defeat Non-jailbroken iOS Malware by Claud Xiao
 
Mobile platform security models
Mobile platform security modelsMobile platform security models
Mobile platform security models
 
Outsmarting SmartPhones
Outsmarting SmartPhonesOutsmarting SmartPhones
Outsmarting SmartPhones
 
Android
AndroidAndroid
Android
 
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
 
Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On Android
 
Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On Android
 
Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013
 
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-Platform
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-PlatformVisual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-Platform
Visual Studio 2015: novità per gli sviluppatori iOS, Android e Cross-Platform
 
Malware cryptomining uploadv3
Malware cryptomining uploadv3Malware cryptomining uploadv3
Malware cryptomining uploadv3
 
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...
hashdays 2011: Tobias Ospelt - Reversing Android Apps - Hacking and cracking ...
 
android Security
android Security android Security
android Security
 
Security News Bytes (Aug Sept 2017)
Security News Bytes (Aug Sept 2017)Security News Bytes (Aug Sept 2017)
Security News Bytes (Aug Sept 2017)
 
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
 
Android security
Android securityAndroid security
Android security
 
How iOS and Android Handle Security Webinar
How iOS and Android Handle Security WebinarHow iOS and Android Handle Security Webinar
How iOS and Android Handle Security Webinar
 
Stealing sensitive data from android phones the hacker way
Stealing sensitive data from android phones   the hacker wayStealing sensitive data from android phones   the hacker way
Stealing sensitive data from android phones the hacker way
 

Plus de Justin Hoang

Tổng quan tài liệu Hướng dẫn hệ thống BMS
Tổng quan tài liệu Hướng dẫn hệ thống BMSTổng quan tài liệu Hướng dẫn hệ thống BMS
Tổng quan tài liệu Hướng dẫn hệ thống BMSJustin Hoang
 
Tam bien kieu Phap
Tam bien kieu PhapTam bien kieu Phap
Tam bien kieu PhapJustin Hoang
 
Huong dan su dung Adobe Presenter
Huong dan su dung Adobe PresenterHuong dan su dung Adobe Presenter
Huong dan su dung Adobe PresenterJustin Hoang
 
Giao trinh corel draw
Giao trinh corel drawGiao trinh corel draw
Giao trinh corel drawJustin Hoang
 
7. xu ly bat dong bo
7. xu ly bat dong bo7. xu ly bat dong bo
7. xu ly bat dong boJustin Hoang
 
5. broadcast receiver
5. broadcast receiver5. broadcast receiver
5. broadcast receiverJustin Hoang
 
3.thiet ke giao dien tren android
3.thiet ke giao dien tren android3.thiet ke giao dien tren android
3.thiet ke giao dien tren androidJustin Hoang
 
2.bat dau voi hello world
2.bat dau voi hello world2.bat dau voi hello world
2.bat dau voi hello worldJustin Hoang
 
1.gioi thieu ve android sdk
1.gioi thieu ve android sdk1.gioi thieu ve android sdk
1.gioi thieu ve android sdkJustin Hoang
 
Tutorial How to change the icon
Tutorial How to change the iconTutorial How to change the icon
Tutorial How to change the iconJustin Hoang
 
Android chapter 02 - Setup to emulator
Android chapter 02 - Setup to emulatorAndroid chapter 02 - Setup to emulator
Android chapter 02 - Setup to emulatorJustin Hoang
 
Giao trinh Corel Draw (By Hoang Ngoc Giao)
Giao trinh Corel Draw (By Hoang Ngoc Giao)Giao trinh Corel Draw (By Hoang Ngoc Giao)
Giao trinh Corel Draw (By Hoang Ngoc Giao)Justin Hoang
 
Giao trinh mang may tinh (Toan tap)
Giao trinh mang may tinh (Toan tap)Giao trinh mang may tinh (Toan tap)
Giao trinh mang may tinh (Toan tap)Justin Hoang
 
Universal modules TXM1.8x Siemens
Universal modules TXM1.8x SiemensUniversal modules TXM1.8x Siemens
Universal modules TXM1.8x SiemensJustin Hoang
 
Mod Two Homology and Cohomology (Jean Claude)
Mod Two Homology and Cohomology (Jean Claude)Mod Two Homology and Cohomology (Jean Claude)
Mod Two Homology and Cohomology (Jean Claude)Justin Hoang
 
Cach in file auto cad
Cach in file auto cadCach in file auto cad
Cach in file auto cadJustin Hoang
 

Plus de Justin Hoang (19)

Tổng quan tài liệu Hướng dẫn hệ thống BMS
Tổng quan tài liệu Hướng dẫn hệ thống BMSTổng quan tài liệu Hướng dẫn hệ thống BMS
Tổng quan tài liệu Hướng dẫn hệ thống BMS
 
Tam bien kieu Phap
Tam bien kieu PhapTam bien kieu Phap
Tam bien kieu Phap
 
Huong dan su dung Adobe Presenter
Huong dan su dung Adobe PresenterHuong dan su dung Adobe Presenter
Huong dan su dung Adobe Presenter
 
Giao trinh corel draw
Giao trinh corel drawGiao trinh corel draw
Giao trinh corel draw
 
7. xu ly bat dong bo
7. xu ly bat dong bo7. xu ly bat dong bo
7. xu ly bat dong bo
 
6. service
6. service6. service
6. service
 
5. broadcast receiver
5. broadcast receiver5. broadcast receiver
5. broadcast receiver
 
3.thiet ke giao dien tren android
3.thiet ke giao dien tren android3.thiet ke giao dien tren android
3.thiet ke giao dien tren android
 
2.bat dau voi hello world
2.bat dau voi hello world2.bat dau voi hello world
2.bat dau voi hello world
 
1.gioi thieu ve android sdk
1.gioi thieu ve android sdk1.gioi thieu ve android sdk
1.gioi thieu ve android sdk
 
Tutorial How to change the icon
Tutorial How to change the iconTutorial How to change the icon
Tutorial How to change the icon
 
Android chapter 02 - Setup to emulator
Android chapter 02 - Setup to emulatorAndroid chapter 02 - Setup to emulator
Android chapter 02 - Setup to emulator
 
Access Toan Tap
Access Toan TapAccess Toan Tap
Access Toan Tap
 
Autocad toan tap
Autocad toan tapAutocad toan tap
Autocad toan tap
 
Giao trinh Corel Draw (By Hoang Ngoc Giao)
Giao trinh Corel Draw (By Hoang Ngoc Giao)Giao trinh Corel Draw (By Hoang Ngoc Giao)
Giao trinh Corel Draw (By Hoang Ngoc Giao)
 
Giao trinh mang may tinh (Toan tap)
Giao trinh mang may tinh (Toan tap)Giao trinh mang may tinh (Toan tap)
Giao trinh mang may tinh (Toan tap)
 
Universal modules TXM1.8x Siemens
Universal modules TXM1.8x SiemensUniversal modules TXM1.8x Siemens
Universal modules TXM1.8x Siemens
 
Mod Two Homology and Cohomology (Jean Claude)
Mod Two Homology and Cohomology (Jean Claude)Mod Two Homology and Cohomology (Jean Claude)
Mod Two Homology and Cohomology (Jean Claude)
 
Cach in file auto cad
Cach in file auto cadCach in file auto cad
Cach in file auto cad
 

Dernier

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Dernier (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

Hacking your Android (slides)

  • 2. ./whoami • College Student • Security Researcher • NOT an expert • Grey Hat
  • 3. Agenda • Android OS Basics • Inside the APK • Android Security Model • Reversing the codes • Some case studies • Making our own malware • Malware = Money • Mobile App Pentesting
  • 4. What is Android • Software Stack including OS, middleware and applications • Developed by Google and OHA(Open Handset Alliance) • Largest Market Share, more than Symbian and IOS.
  • 5. Why Android • Everywhere! (TV, phones, tablets) • Easy to expl0it + Open Source • Runs on Linux 2.6.x kernel • Uses SQLite database • Huge community base • Official market containing over 4,00,000 apps
  • 7.
  • 8. Android Applications • .apk (Android Package) format • Nothing more than a zip file. • Written exclusively in Java, with native libraries in C/C++. • Composed of components such as Activities, Services, Broadcast Recievers, etc.
  • 9. Android Applications APK META-INF res AndroidManifest.xml Classes.dex resources
  • 10. ACTIVITY • Screen to let users interact • Consists of views ( Buttons, TextView, ImageView, Table view, List view etc) • “main” activity presented on start • Lifecycle is “LIFO”
  • 11. ACTIVITY • Follows the Activity Lifecycle. • Activity of one application can be accessed by other application*. • Permission has to be granted
  • 12. SERVICE • Performs the work in the background • Doesn’t comes with a UI • Can be either stated or bound(or both) • Example – playing music in the bg, network activities, file i/o operations etc.
  • 13. Other Components • Broadcast Reciever receives and responds to broadcast announcements Incoming SMS , Screen Off etc. • Intents Binds individual components at runtime • Content Providers Stores and retrieves the application data Data stored in an SQLite database
  • 14. • Preinstalled on all Android devices • Contains over 4.5 billion apps • Anyone can publish his/her app
  • 15. Permissions.. WTF? • Declared in AndroidManifest.xml • XML file containing all the components and permissions • Can only use the declared permissions
  • 16. Permissions.. WTF? • ACCESS_COARSE_LOCATION • ACCESS_FINE_LOCATION • BRICK • CALL_PHONE • INTERNET • GET_ACCOUNTS • PROCESS_OUTGOING_CALLS • READ_OWNER_DATA • READ_SMS • RECEIVE_SMS • SEND_SMS • USE_CREDENTIALS • WRITE_OWNER_DATA • RECORD_AUDIO
  • 17. Android Security Model • Each application is run within a Dalvik Virtual Machine • With unique UID:GID • By default no permission is granted • Permissions required by an application have to be approved by the user. • Apk files must be signed with a certificate.
  • 18. UID : 1000 Application 1 UID : 1001 Application 2 UID : 1003 Application 3 UID : 1004 Application 4 UID : 1005 Application 5 SYSTEM PROCESS ( UID : SYSTEM) LINUX KERNEL Dalvik VM Dalvik VM Dalvik VM Dalvik VM Dalvik VM Android Security Model
  • 20. Created by Dan Bornstein DVM vs JVM Virtual System to run the android apps Register based instead of stack based Runs the dex(Dalvik Executable) files
  • 22. Making of the APK .java .class .dex .apk Using dx(dexer) of Android SDK apkbuilder
  • 24. REVERSING THE APK Tools of the trade Dedexer Baksmali Undx JD-GUI Dex2JAR DexDump APKTool
  • 25. GETTING OUR HANDS DIRTY DEMO TIME
  • 26. ANDROID MALWARES Special thanks to Mila for his awesome website http://contagiodump.blogspot.com
  • 27. Memories of the Past Some famous Android Malwares • Trojan-SMS.AndroidOS.FakePlayer.a • Geinimi • Snake • DreamDroid • GGTracker
  • 28. Trojan-SMS.FakePlayer.a • Simplest malware till date. • Sends SMS to a premium rated number • $6-10/sms • Mainly distributed through porn/media apps • Stop watching porn? :O
  • 29. GEINIMI : THE HOTTEST MALWARE
  • 30. GEINIMI • Most sophisticated malware till date. • Botnet like capabilities • Multiple variants created on the same device • Obfuscated code • Strings decrypted at runtime • All network data encrypted ( DES with a key - 012345678)
  • 31. GEINIMI • Three ways of starting (Using service or Broadcast Receivers • Makes a connection with C&C server • Identifies each device with unique IMEI & IMSI • Can be in 5 states (Start, download, parse, transact, idle) • Info Stealer • Infected legitimate apps ( Sex Positions, MonkeyJump2 etc. ) (Another reason for not watching porn on mobile! )
  • 32. GEINIMI(continued) • Botnet Command Capabilities : o call – Call a number o Email – Send a email o Smsrecord – Sends all the sms’es to the server o Install – install an app o Shell – get a shell o Contactlist - get the contact list of the victim o Wallpaper – change the wallpaper etc.
  • 33. DREAMDROID • Infected legitimate software • Hosted at “Android Market” • Came with exploits namely Exploid ( CVE-2009-1185 ) and rageagainstthecage(CVE-2010-EASY) • Multi Staged Payload • XOR Encrypted data • Another malware with Botnet capabilities
  • 35. Agenda Taking a legitimate app (apk) Decompile it Insert our own codes Repackaging to get a infected APK PROFIT?
  • 36. CREATING A MALWARE Expected Time to be taken < 5 mins
  • 37. Vulnerable Applications • GMail App(in <Android v2.1 vuln to XSS :O From field: “ onload=window.location=‘http:// google.com’ “@yahoo.com” (Found by supernothing of spareclockcycles.org) • Use this to launch more exploits such as the Data Stealing Bug or Free Webkit Exploit • Steal Emails & SD Card Files
  • 38. Stored Passwords • Browser passwords stored in database called webview.db • Got r00t? #adbpull/data/data/com.android.browser/databases/webview.db #sqlitewebview.db >SELECT*FROMpassword;
  • 39. Insecure Data Storage # cd /data/data/com.evernote # ls cache databases shared_prefs lib # cd shared_prefs # ls com.evernote_preferences.xml # cat com.evernote_preferences.xml <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <string name="serviceHost"><string name="username">myusername</string> <boolean name="ACCOUNT_CHECKED" value="true" /> <string name="password">youcanthackme</string> <int name="servicePort" value="0" /> <boolean name="NotifyUploadStatus" value="true" /> </map> #
  • 40. Is that all? Webkit and platform vulnerabilities Android 2.0 ,2.1, 2.1.1 WebKit Use-After-Free Exploit Android 2.0/2.1 Use-After-Free Remote Code Execution on Webkit Vulnerabilities in Apps, SQLi, XSS, etc. Use platform vulns to get root & shell SD card information leakage XSSF Framework ROOTSTRAP Sniffing the network : ) Try MoshZuk & ANTI
  • 41. Is that all? Get the Android version Run matching exploits Install malicious app Spread Profit
  • 42. [$]Where is the money?[$] •Mobile App moolah by Jimmy Shah •Premium Rates SMSes •Make malwares for sale •Click Fraud, BlackHat SEO, Traffic generation, PPC Ads •Steal Accounts/CCs and sell them •Get personal information and blackmail the owner •Sign up to many services with your referral id •Make a bank phishing app [$$$]100% Illegal Ways to get rich! [$$$] Your phone has been hacked! Transfer $1000 to my account Or else……. Acc No : xxxxxxxxxxxxxxxxxxxx
  • 43. [$$]Spread Yourself![$$] • Forums • P2P • Send SMS’es/chat with your download link from the infected user’s phone • Make a blog of cracked full version of famous android apps! • Social Network viral scripts • Android Market • Amazon App Store
  • 45. The game is over! • Malware scanners developed for this platform. • Lookout(one of the best security solutions), AVG, Quick Heal, Kaspersky have come up with their security solutions. • Can detect most of the malwares of this platform.
  • 46. The game is over! The game is not over yet! • Can create a malware not detected by the scanners • Most of them signature based, so, can easily be bypassed. • Obfuscating code can bypass most of them. • Disable the AV • Encryption for network data. • Use your own “blackhat” creativity!
  • 48. MobileApp Pentesting FTW! • Decompile the apk after pulling it from the phone. adb pull /data/app(or app-private)/hello.apk unzip hello.apk dex2jar classes.dex jdgui classes2jar.jar or convert to smali and then analyse the code adb pull /data/app/hello.apk unzip hello.apk java –jar baksmali.jar –o C:pentestapp classes.dex OR apktool d hello.apk
  • 49. MobileApp Pentesting FTW! • Start Emulator with Proxy • Install the app in the emulator • Use Wireshark, Fiddler & Burp Suite to monitor traffic • Run the app and check logcat • WhisperMonitor – Android App to monitor outgoing traffic Emulator –avd MYAVD –http-proxy http://127.0.0.1:5001 avd install apptotest.apk
  • 50. MobileApp Pentesting FTW! Check the security mechanism and encryption used in a banking or payment app for network data Manifest Explorer Strace for debugging system calls and signals Check the location where the app stores the login credentials.