SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Hack The Mob
Modifying closed-source apps
What is this talk about?
● Let’s talk about what is Android
● Let’s learn how to download APKs from Play Store
● Let’s modify those APKs
● Let’s push them back to our phone
`whoami`
Gil Megidish
CTO @ TestFairy
1337
Terminology 101
● What makes an Android app?
● Which languages can Android run?
Anatomy of an Android APK
$ unzip -v “FlappyFish.apk”
Length Method Size Ratio Date Time CRC-32 Name
-------- ------ ------- ----- ---- ---- ------ ----
18580 Defl:N 3812 80% 08-02-15 00:57 cf40f8ff AndroidManifest.xml
8518360 Defl:N 3391501 60% 08-02-15 00:57 0e1cd99f classes.dex
395404 Defl:N 122825 69% 08-02-15 00:57 7bffff87 META-INF/MANIFEST.MF
395433 Defl:N 123483 69% 08-02-15 00:57 a657bd16 META-INF/CERT.SF
1139 Defl:N 1039 9% 08-02-15 00:57 6744aa28 META-INF/CERT.RSA
Getting APK from Play Store
$ adb shell pm list packages -f
package:/system/app/Gallery.apk=com.android.gallery
package:/data/app/com.fiverr.fiverr-1.apk=com.fiverr.fiverr
package:/data/app/com.touchtype.swiftkey-1.apk=com.touchtype.swiftkey
package:/data/app/com.scoompa.facechanger-1.apk=com.scoompa.facechanger
$ adb pull /data/app/com.fiverr.fiverr-1.apk
6620 KB/s (11723728 bytes in 1.729s)
Introducing Smali & Baksmali
● Decompiles and compiles Dalvik (DEX) files
● Written and maintained by Ben Gruver (@JesusFreke)
● https://bitbucket.org/JesusFreke/smali/
Instructions include:
invoke-virtual if-eq new-instance
goto return-void add-int
Sample Java code
package com.testfairy.app;
public class SecretCookie
{
private String privateKey;
public SecretCookie(String privateKey) {
this.privateKey = privateKey;
}
public boolean verifyPrivateKey(String otherKey) {
return privateKey.equals(otherKey);
}
}
Same code in Smali
.class public Lcom/amazing/app/SecretCookie;
.super Ljava/lang/Object;
.
.
.
# virtual methods
.method public verifyPrivateKey(Ljava/lang/String;)Z
.registers 3
iget-object v0, p0, Lcom/testfairy/app/SecretCookie;->privateKey:Ljava/lang/String;
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
return v0
.end method
Let’s do this! =]
$ java -jar baksmali-2.0.6.jar FlappyBird.apk
# modify smali code #
$ java -jar smali-2.0.6.jar -o classes.dex out
$ zip FlappyBird.apk classes.dex
$ zip -d FlappyBird.apk META-INF/*
$ jarsigner -keystore ~/.android/debug.keystore
-storepass android -signedjar “patched.apk”
“FlappyBird.apk” “androiddebugkey”
Demo Time ™ !
Let’s shove an entire sdk!
Demo Time ™ !
(two apps, one dex)
What’s next?
● Changing resources
(images, texts)
● 3rd Party APIs (Google
Maps and Facebook)
● Modifying
AndroidManifest.xml
Linkz!
smali/baksmali
https://github.com/JesusFreke/smali
apktool
https://ibotpeaches.github.io/Apktool
Looking For Your Next Challenge?
https://www.testfairy.com/jobs/

Contenu connexe

Similaire à Hack The Mob: Modifying Closed-source Android Apps

OnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildOnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildDavid Rosen
 
Mobile Software Diagnostics
Mobile Software DiagnosticsMobile Software Diagnostics
Mobile Software DiagnosticsDmitry Vostokov
 
Kostiantyn Grygoriev "Wrapping C++ for Python"
Kostiantyn Grygoriev "Wrapping C++ for Python"Kostiantyn Grygoriev "Wrapping C++ for Python"
Kostiantyn Grygoriev "Wrapping C++ for Python"LogeekNightUkraine
 
Introduction to Java Profiling
Introduction to Java ProfilingIntroduction to Java Profiling
Introduction to Java ProfilingJerry Yoakum
 
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...Tero Aaltonen
 
The Joys of Clean Data with Matt Dowle
The Joys of Clean Data with Matt DowleThe Joys of Clean Data with Matt Dowle
The Joys of Clean Data with Matt DowleSri Ambati
 
Kranky geeklondon build an app
Kranky geeklondon build an appKranky geeklondon build an app
Kranky geeklondon build an appTim Panton
 
Technology Risk Modeling and Analysis Seminar - Exchange Trading
Technology Risk Modeling and Analysis Seminar - Exchange TradingTechnology Risk Modeling and Analysis Seminar - Exchange Trading
Technology Risk Modeling and Analysis Seminar - Exchange TradingIosif Itkin
 
Exactpro: Non-functional testing approach
Exactpro: Non-functional testing approachExactpro: Non-functional testing approach
Exactpro: Non-functional testing approach Iosif Itkin
 
Vos App avec Fabric & Twitter
Vos App avec Fabric & TwitterVos App avec Fabric & Twitter
Vos App avec Fabric & TwitterLaFrenchMobile
 
Using Cluster Analysis for Characteristics Detection in Software Defect Reports
Using Cluster Analysis for Characteristics Detection in Software Defect ReportsUsing Cluster Analysis for Characteristics Detection in Software Defect Reports
Using Cluster Analysis for Characteristics Detection in Software Defect ReportsIosif Itkin
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keithm j
 
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summer
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summerDEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summer
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summerFelipe Prado
 
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
TMPA-2017: Defect Report Classification in Accordance with Areas of TestingTMPA-2017: Defect Report Classification in Accordance with Areas of Testing
TMPA-2017: Defect Report Classification in Accordance with Areas of TestingIosif Itkin
 
VictoriaMetrics December 2023 Meetup: Community Update
VictoriaMetrics December 2023 Meetup: Community UpdateVictoriaMetrics December 2023 Meetup: Community Update
VictoriaMetrics December 2023 Meetup: Community UpdateVictoriaMetrics
 
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)Amazon Web Services Korea
 
Doug Sillars on App Optimization
Doug Sillars on App OptimizationDoug Sillars on App Optimization
Doug Sillars on App Optimizationwipjam
 
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data Exfiltration
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data ExfiltrationMind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data Exfiltration
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data ExfiltrationCheckmarx
 

Similaire à Hack The Mob: Modifying Closed-source Android Apps (20)

OnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildOnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform Build
 
Mobile Software Diagnostics
Mobile Software DiagnosticsMobile Software Diagnostics
Mobile Software Diagnostics
 
Kostiantyn Grygoriev "Wrapping C++ for Python"
Kostiantyn Grygoriev "Wrapping C++ for Python"Kostiantyn Grygoriev "Wrapping C++ for Python"
Kostiantyn Grygoriev "Wrapping C++ for Python"
 
Introduction to Java Profiling
Introduction to Java ProfilingIntroduction to Java Profiling
Introduction to Java Profiling
 
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...
Overcoming Obstacles in Bringing Android Automotive Infotainment Systems to M...
 
The Joys of Clean Data with Matt Dowle
The Joys of Clean Data with Matt DowleThe Joys of Clean Data with Matt Dowle
The Joys of Clean Data with Matt Dowle
 
Debugging TV Frame 0x33
Debugging TV Frame 0x33Debugging TV Frame 0x33
Debugging TV Frame 0x33
 
Zero to Automated in Under a Year
Zero to Automated in Under a YearZero to Automated in Under a Year
Zero to Automated in Under a Year
 
Kranky geeklondon build an app
Kranky geeklondon build an appKranky geeklondon build an app
Kranky geeklondon build an app
 
Technology Risk Modeling and Analysis Seminar - Exchange Trading
Technology Risk Modeling and Analysis Seminar - Exchange TradingTechnology Risk Modeling and Analysis Seminar - Exchange Trading
Technology Risk Modeling and Analysis Seminar - Exchange Trading
 
Exactpro: Non-functional testing approach
Exactpro: Non-functional testing approachExactpro: Non-functional testing approach
Exactpro: Non-functional testing approach
 
Vos App avec Fabric & Twitter
Vos App avec Fabric & TwitterVos App avec Fabric & Twitter
Vos App avec Fabric & Twitter
 
Using Cluster Analysis for Characteristics Detection in Software Defect Reports
Using Cluster Analysis for Characteristics Detection in Software Defect ReportsUsing Cluster Analysis for Characteristics Detection in Software Defect Reports
Using Cluster Analysis for Characteristics Detection in Software Defect Reports
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keith
 
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summer
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summerDEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summer
DEF CON 27 - D4KRM4TTER MIKE SPICER - I know what you did last summer
 
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
TMPA-2017: Defect Report Classification in Accordance with Areas of TestingTMPA-2017: Defect Report Classification in Accordance with Areas of Testing
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
 
VictoriaMetrics December 2023 Meetup: Community Update
VictoriaMetrics December 2023 Meetup: Community UpdateVictoriaMetrics December 2023 Meetup: Community Update
VictoriaMetrics December 2023 Meetup: Community Update
 
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)
AWS re:Invent 2017 주요 신규 서비스 분야별 요약 - 윤석찬 (AWS테크에반젤리스트)
 
Doug Sillars on App Optimization
Doug Sillars on App OptimizationDoug Sillars on App Optimization
Doug Sillars on App Optimization
 
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data Exfiltration
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data ExfiltrationMind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data Exfiltration
Mind the (Air)Gap: Checkmarx Research into NFC and Smart Bulb Data Exfiltration
 

Plus de Gil Megidish

My Adventures in Twitch Dev
My Adventures  in Twitch DevMy Adventures  in Twitch Dev
My Adventures in Twitch DevGil Megidish
 
0x4841434b45525a – H4x0r presentation for n00bs
0x4841434b45525a – H4x0r presentation for n00bs0x4841434b45525a – H4x0r presentation for n00bs
0x4841434b45525a – H4x0r presentation for n00bsGil Megidish
 
Crash Course in Perl – Perl tutorial for C programmers
Crash Course in Perl – Perl tutorial for C programmersCrash Course in Perl – Perl tutorial for C programmers
Crash Course in Perl – Perl tutorial for C programmersGil Megidish
 
Small Teams Kick Ass
Small Teams Kick AssSmall Teams Kick Ass
Small Teams Kick AssGil Megidish
 
Game Development With HTML5
Game Development With HTML5Game Development With HTML5
Game Development With HTML5Gil Megidish
 

Plus de Gil Megidish (6)

My Adventures in Twitch Dev
My Adventures  in Twitch DevMy Adventures  in Twitch Dev
My Adventures in Twitch Dev
 
I Heart Stuxnet
I Heart StuxnetI Heart Stuxnet
I Heart Stuxnet
 
0x4841434b45525a – H4x0r presentation for n00bs
0x4841434b45525a – H4x0r presentation for n00bs0x4841434b45525a – H4x0r presentation for n00bs
0x4841434b45525a – H4x0r presentation for n00bs
 
Crash Course in Perl – Perl tutorial for C programmers
Crash Course in Perl – Perl tutorial for C programmersCrash Course in Perl – Perl tutorial for C programmers
Crash Course in Perl – Perl tutorial for C programmers
 
Small Teams Kick Ass
Small Teams Kick AssSmall Teams Kick Ass
Small Teams Kick Ass
 
Game Development With HTML5
Game Development With HTML5Game Development With HTML5
Game Development With HTML5
 

Dernier

Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 

Dernier (20)

Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 

Hack The Mob: Modifying Closed-source Android Apps

  • 1. Hack The Mob Modifying closed-source apps
  • 2. What is this talk about? ● Let’s talk about what is Android ● Let’s learn how to download APKs from Play Store ● Let’s modify those APKs ● Let’s push them back to our phone
  • 4. Terminology 101 ● What makes an Android app? ● Which languages can Android run?
  • 5. Anatomy of an Android APK $ unzip -v “FlappyFish.apk” Length Method Size Ratio Date Time CRC-32 Name -------- ------ ------- ----- ---- ---- ------ ---- 18580 Defl:N 3812 80% 08-02-15 00:57 cf40f8ff AndroidManifest.xml 8518360 Defl:N 3391501 60% 08-02-15 00:57 0e1cd99f classes.dex 395404 Defl:N 122825 69% 08-02-15 00:57 7bffff87 META-INF/MANIFEST.MF 395433 Defl:N 123483 69% 08-02-15 00:57 a657bd16 META-INF/CERT.SF 1139 Defl:N 1039 9% 08-02-15 00:57 6744aa28 META-INF/CERT.RSA
  • 6. Getting APK from Play Store $ adb shell pm list packages -f package:/system/app/Gallery.apk=com.android.gallery package:/data/app/com.fiverr.fiverr-1.apk=com.fiverr.fiverr package:/data/app/com.touchtype.swiftkey-1.apk=com.touchtype.swiftkey package:/data/app/com.scoompa.facechanger-1.apk=com.scoompa.facechanger $ adb pull /data/app/com.fiverr.fiverr-1.apk 6620 KB/s (11723728 bytes in 1.729s)
  • 7. Introducing Smali & Baksmali ● Decompiles and compiles Dalvik (DEX) files ● Written and maintained by Ben Gruver (@JesusFreke) ● https://bitbucket.org/JesusFreke/smali/ Instructions include: invoke-virtual if-eq new-instance goto return-void add-int
  • 8. Sample Java code package com.testfairy.app; public class SecretCookie { private String privateKey; public SecretCookie(String privateKey) { this.privateKey = privateKey; } public boolean verifyPrivateKey(String otherKey) { return privateKey.equals(otherKey); } }
  • 9. Same code in Smali .class public Lcom/amazing/app/SecretCookie; .super Ljava/lang/Object; . . . # virtual methods .method public verifyPrivateKey(Ljava/lang/String;)Z .registers 3 iget-object v0, p0, Lcom/testfairy/app/SecretCookie;->privateKey:Ljava/lang/String; invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v0 return v0 .end method
  • 10. Let’s do this! =] $ java -jar baksmali-2.0.6.jar FlappyBird.apk # modify smali code # $ java -jar smali-2.0.6.jar -o classes.dex out $ zip FlappyBird.apk classes.dex $ zip -d FlappyBird.apk META-INF/* $ jarsigner -keystore ~/.android/debug.keystore -storepass android -signedjar “patched.apk” “FlappyBird.apk” “androiddebugkey”
  • 12.
  • 13. Let’s shove an entire sdk!
  • 14.
  • 15. Demo Time ™ ! (two apps, one dex)
  • 16. What’s next? ● Changing resources (images, texts) ● 3rd Party APIs (Google Maps and Facebook) ● Modifying AndroidManifest.xml
  • 18. Looking For Your Next Challenge? https://www.testfairy.com/jobs/