SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
March 14&15, 2023
Gabrielle Botbol
Is powered by &
Android Applications and
APIs Hacking
Who am I?
Gabrielle Botbol
@Gabrielle_BGB
/in/gabriellebotbol
https://csbygb.github.io/
From blogger to pentester
«Apprenance» is:
«a lasting set of dispositions… favourable to the act of
learning… in all situations: formal or informal, experiential or
didactic, self-directed or not, intentional or accidental».
Philippe Carré, 2005.
CTF
Conferences MOOC
Summer Schools
Volunteering
Internship
From blogger to pentester
What is Android
What is Android App Pentest?
Why Android App Pentest?
July 13th 2022
Some figures
Source: https://www.zimperium.com/global-mobile-threat-report/
New Mobile Malware
Samples Detected in the
Wild in 2021
Increase in Exploited,
Zero-Day Mobile
Vulnerabilities
Enterprises Reported
Mobile Devices and Web
Apps Led To A Security
Incident
Phishing Sites
Specifically
Targeted Mobile
Devices
Of Mobile Devices
Encountered Malicious
Applications
Worldwide
10M+
466%
2,034,217+
Mobile Endpoints
Impacted
By Threats
42% 75% 23%
What about Android APIs?
Why dev use APIs?
- Manipulate data from remote locations
- Third party services
- Improve performance
- Code Reuse
- Flexible and scalable
- They can also make their own APIs
Android App pentest process
We’ll dive into these together
Planning
Reco
-naissance
Static Analysis
Dynamic
Analysis Report
1 2
3
4
5
The importance of the lab
What you will need
- Jadx
- apktool
- ADB
- Android
Studio
- Burp Suite
Tools:
Set up the lab - Installs
Install Jadx
Install adb
Install apktool
https://ibotpeaches.github.io/Apktool/install/
Install Android Studio Download https://developer.android.com/studio
Install Burp Suite
Download and install the version according to your system here
https://portswigger.net/burp/releases/professional-community-2021-12-1?requestededition
=community
For more info on these installs
- JADX https://github.com/skylot/jadx
- ADB https://www.xda-developers.com/install-adb-windows-macos-linux/
sudo apt install default-jdk
sudo apt install jadx
./jadx-gui
sudo apt-get install adb
Set up the lab - Create an emulator
Set up the lab - Configure burp
How to Bypass certificate
pinning:
https://csbygb.gitbook.io/penti
ps/mobile-app-pentest/androi
d#how-to-bypass-certificate-p
inning
Practical examples of
bypass of cert pinning:
https://csbygb.gitbook.io/penti
ps/writeups/htbtracks/htb-intr
o-to-android-exploitation-trac
k
=> Challenge: Pinned
=> Challenge: Anchored
Vuln Apps used for the examples
Get PIVAA here:
https://github.com/HTBridge/pivaa
Purposefully Insecure and Vulnerable Android
Application.
Get InjuredAndroid here:
https://github.com/B3nac/InjuredAndroid
/releases/tag/v1.0.12
Static Analysis
What to check:
- AndroidManifest.xml
- Strings.xml
- Enumerate Database
- Search for secrets and sensitive data
How to check the code
Jadx ./jadx-gui
apktool apktool d app.apk
Decompiled files with apktool
Example PIVAA - AndroidManifest 1
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
- List of permissions here: https://developer.android.com/reference/android/Manifest.permission
- List of permissions considered Dangerous:
https://mas.owasp.org/MASTG/Android/0x05h-Testing-Platform-Interaction/#android-permission
s
Example PIVAA - AndroidManifest 2
android:allowBackup="true"
android:debuggable="true"
OWASP MSTG-STORAGE-8:
https://github.com/OWASP/owasp-mstg/blob/8d67a609ecd095d1bb00aa6a3e211791af5642e8/Document/0x05d-Testing-Dat
a-Storage.md#static-analysis-7
OWASP MSTG-CODE-2:
https://github.com/OWASP/owasp-mstg/blob/53ebd2ccc428623df7eaf2361d44b2e7e31c05b9/Document/0x05i-Testing-C
ode-Quality-and-Build-Settings.md#testing-whether-the-app-is-debuggable-mstg-code-2
(ON by default)
(OFF by default)
Static Analysis: Find the API endpoints
- Search for keywords “http”, “https”, etc.
- Look for function or classes (requests &
responses)
- Manifest: permissions for network
communications
- Check the JS files or AIDL files
Static Analysis: How are APIs called - Example
[STRIPPED]
public class ApiCallTask extends AsyncTask<String, Void, String> {
[STRIPPED]
try {
URL url = new URL(apiUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
Log.d(TAG, "API response code: " + responseCode);
BufferedReader in = new BufferedReader(new
InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer responseBuffer = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
responseBuffer.append(inputLine);
}
in.close();
response = responseBuffer.toString();
} catch (IOException e) {
Log.e(TAG, "API call failed", e);
}
return response;
}
[STRIPPED]
new
ApiCallTask().execute("http
s://api.example.com/data");
Class used and
executed in an
instance
Static Analysis: Fetch API Javascript - Example
function fetchData() {
var apiUrl = "https://api.example.com/data";
var xhr = new XMLHttpRequest();
xhr.open("GET", apiUrl, true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
displayData(data);
}
};
xhr.send();
}
Static Analysis: API vulnerabilities
2022 2019
“This is a private key! WTF, man!” - Alissa Knight - 2019
How I hacked 30 mobile banking apps & the future of API Security,
Alissa Knight
Thousands of Android apps leak hard-coded secrets, research
shows - Cybernews
Example with InjuredAndroid - Strings
<string
name="google_api_key">AIzaSyCUImEIOSvqAswLqFak75xhskkB6illd7A</string>
<string
name="google_app_id">1:430943006316:android:d97db57e11e42a1a037249</str
ing>
<string
name="google_crash_reporting_api_key">AIzaSyCUImEIOSvqAswLqFak75xhskkB6
illd7A</string>
<string
name="google_storage_bucket">injuredandroid.appspot.com</string>
/res/values/strings.xml
General Tips for static analysis
Grep it!
/uploads directory
apktool d app.apk
grep -r “unsafe secret”
More tips on grep here:
https://csbygb.gitbook.io/pentips/digital-skills/us
eful-linux#grep
Tools for static analysis
- Firebase Enum Github:
https://github.com/Sambal0x/firebaseEnum
- FireBaseScanner:
https://github.com/shivsahni/FireBaseScanner
- Cloud Enum https://github.com/initstring/cloud_enum
Dynamic Analysis
What to check:
- Tapjacking
- Can you capture screens with sensitive data
- OWASP Top 10
- Analyse traffic with burp to find odd things
Dynamic Analysis: Find API endpoint
/api
/api/v1
/v1
/docs
/rest
/v1
/v2
/v3
/swagger
/swagger.json
/doc/graphql
Use a wordlist and FUZZ:
https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/
api/api-endpoints.txt
Example with PIVAA - BG capture
Automatic tools
- MobSF
https://github.com/MobSF/Mobile-Security-Framework-Mo
bSF
- Qark https://github.com/linkedin/qark
General tips: Common API vulnerabilities to look for
- API1:2019 Broken Object Level Authorization
- API3: 2019 Excessive Data Exposure
- API7:2019 Security Misconfiguration
- API9:2019 Improper Assets Management
Find more here:
https://github.com/OWASP/API-Security/tree/master/2019/en/src
More tips on API pentest here: https://csbygb.gitbook.io/pentips/web-pentesting/api
General tips: Use checklists
MindAPI - David Sopas: https://dsopas.github.io/MindAPI/play/
Official OWASP MAS Checklist: https://mas.owasp.org/MAS_checklist/
How to report
How to report - Example
Broken Object Access Control
Severity: Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N
Description
A BOLA (Broken Object Level Authorization) vulnerability is a security issue that allows an
attacker to access or manipulate sensitive data or functionality in an application by
modifying the object ID in the API requests. This vulnerability arises when the application
lacks proper authorization checks and fails to enforce access control restrictions on user
input.
In our context, we identified a BOLA vulnerability in the API of the application. This
vulnerability could allow an attacker to bypass the access control measures and gain
unauthorized access to sensitive data or functionality in the application.
How to report - Example
Broken Object Access Control
Remediation
We recommend that the development team implement proper authorization checks
in the API to prevent this vulnerability from being exploited. Additionally, we
suggest conducting a thorough review of the application's access control
mechanisms to identify and address any other potential BOLA vulnerabilities.
Resource
https://github.com/OWASP/API-Security/blob/master/2019/en/src/0xa1-broken-obje
ct-level-authorization.md
Get these slides and all the resources
https://csbygb.gitbook.io/
Android tips and BIG list of FREE
resources:
https://csbygb.gitbook.io/pentips/mobile-
app-pentest/android
Android Application Pentest Article - Pentest Magazine
- My article about Android Application Pentest
https://pentestmag.com/product/pentest-play-in-yo
ur-own-pentest-lab-in-2022/
Quiz to go
Check out the quiz about this
presentation here:
https://forms.gle/GPymC3RrsmCRLxY
C6
Special shout out
https://www.apisecuniversity.com/
Thanks

Contenu connexe

Tendances

AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
Ajin Abraham
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
Denim Group
 

Tendances (20)

Pentesting Android Apps
Pentesting Android AppsPentesting Android Apps
Pentesting Android Apps
 
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
 
Getting started with Android pentesting
Getting started with Android pentestingGetting started with Android pentesting
Getting started with Android pentesting
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
 
Security testing in mobile applications
Security testing in mobile applicationsSecurity testing in mobile applications
Security testing in mobile applications
 
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
 
Practical Application of the API Security Top Ten: A Tester's Perspective
Practical Application of the API Security Top Ten: A Tester's PerspectivePractical Application of the API Security Top Ten: A Tester's Perspective
Practical Application of the API Security Top Ten: A Tester's Perspective
 
OWASP API Security Top 10 - API World
OWASP API Security Top 10 - API WorldOWASP API Security Top 10 - API World
OWASP API Security Top 10 - API World
 
Android pentesting the hackers-meetup
Android pentesting the hackers-meetupAndroid pentesting the hackers-meetup
Android pentesting the hackers-meetup
 
API Security Best Practices & Guidelines
API Security Best Practices & GuidelinesAPI Security Best Practices & Guidelines
API Security Best Practices & Guidelines
 
API Security Fundamentals
API Security FundamentalsAPI Security Fundamentals
API Security Fundamentals
 
APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...
APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...
APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...
 
Mobile Application Security Testing (Static Code Analysis) of Android App
Mobile Application Security Testing (Static Code Analysis) of Android AppMobile Application Security Testing (Static Code Analysis) of Android App
Mobile Application Security Testing (Static Code Analysis) of Android App
 
SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
OWASP Top 10 for Mobile
OWASP Top 10 for MobileOWASP Top 10 for Mobile
OWASP Top 10 for Mobile
 
Serverless Siege: AWS Lambda Pentesting - OWASP Top 10 Serverless C0c0n 2023
Serverless Siege: AWS Lambda Pentesting - OWASP Top 10 Serverless C0c0n 2023Serverless Siege: AWS Lambda Pentesting - OWASP Top 10 Serverless C0c0n 2023
Serverless Siege: AWS Lambda Pentesting - OWASP Top 10 Serverless C0c0n 2023
 
Bug bounty
Bug bountyBug bounty
Bug bounty
 
Mobile Application Penetration Testing
Mobile Application Penetration TestingMobile Application Penetration Testing
Mobile Application Penetration Testing
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
 

Similaire à APIsecure 2023 - Android Applications and API Hacking, Gabrielle Botbol

Similaire à APIsecure 2023 - Android Applications and API Hacking, Gabrielle Botbol (20)

apidays New York 2023 - Android Applications and APIs Hacking, Gabrielle Botb...
apidays New York 2023 - Android Applications and APIs Hacking, Gabrielle Botb...apidays New York 2023 - Android Applications and APIs Hacking, Gabrielle Botb...
apidays New York 2023 - Android Applications and APIs Hacking, Gabrielle Botb...
 
Securing android applications
Securing android applicationsSecuring android applications
Securing android applications
 
Cyber Security Workshop @SPIT- 3rd October 2015
Cyber Security Workshop @SPIT- 3rd October 2015Cyber Security Workshop @SPIT- 3rd October 2015
Cyber Security Workshop @SPIT- 3rd October 2015
 
Attacking android insecurity
Attacking android insecurityAttacking android insecurity
Attacking android insecurity
 
2018 android-security-udacity-morrison chang
2018 android-security-udacity-morrison chang2018 android-security-udacity-morrison chang
2018 android-security-udacity-morrison chang
 
Denys iaremenko - Automation for mobile applications: WHYs and HOWs.
Denys iaremenko - Automation for mobile applications: WHYs and HOWs.Denys iaremenko - Automation for mobile applications: WHYs and HOWs.
Denys iaremenko - Automation for mobile applications: WHYs and HOWs.
 
從 Google i/o 2015 看下半年 mobile 應用發展趨勢
從 Google i/o 2015 看下半年 mobile 應用發展趨勢從 Google i/o 2015 看下半年 mobile 應用發展趨勢
從 Google i/o 2015 看下半年 mobile 應用發展趨勢
 
hacking_ble_smartwatch @idsecconf2019 cirebon
hacking_ble_smartwatch @idsecconf2019 cirebonhacking_ble_smartwatch @idsecconf2019 cirebon
hacking_ble_smartwatch @idsecconf2019 cirebon
 
apidays LIVE Singapore 2021 - Why verifying user identity Is not enough In 20...
apidays LIVE Singapore 2021 - Why verifying user identity Is not enough In 20...apidays LIVE Singapore 2021 - Why verifying user identity Is not enough In 20...
apidays LIVE Singapore 2021 - Why verifying user identity Is not enough In 20...
 
SYSTEM CALL DEPENDENCE GRAPH BASED BEHAVIOR DECOMPOSITION OF ANDROID APPLICAT...
SYSTEM CALL DEPENDENCE GRAPH BASED BEHAVIOR DECOMPOSITION OF ANDROID APPLICAT...SYSTEM CALL DEPENDENCE GRAPH BASED BEHAVIOR DECOMPOSITION OF ANDROID APPLICAT...
SYSTEM CALL DEPENDENCE GRAPH BASED BEHAVIOR DECOMPOSITION OF ANDROID APPLICAT...
 
Hacking ble smartwatch
Hacking ble smartwatch Hacking ble smartwatch
Hacking ble smartwatch
 
Android pentesting
Android pentestingAndroid pentesting
Android pentesting
 
Secure Android Apps- nVisium Security
Secure Android Apps- nVisium SecuritySecure Android Apps- nVisium Security
Secure Android Apps- nVisium Security
 
Why should you do a pentest?
Why should you do a pentest?Why should you do a pentest?
Why should you do a pentest?
 
Securing Mobile Apps - Appfest Version
Securing Mobile Apps - Appfest VersionSecuring Mobile Apps - Appfest Version
Securing Mobile Apps - Appfest Version
 
Mobile Banking Security: Challenges, Solutions
Mobile Banking Security: Challenges, SolutionsMobile Banking Security: Challenges, Solutions
Mobile Banking Security: Challenges, Solutions
 
Top Mobile Application Penetration Testing Tools for Android and iOS.pdf
Top Mobile Application Penetration Testing Tools for Android and iOS.pdfTop Mobile Application Penetration Testing Tools for Android and iOS.pdf
Top Mobile Application Penetration Testing Tools for Android and iOS.pdf
 
Stephanie Vanroelen - Mobile Anti-Virus apps exposed
Stephanie Vanroelen - Mobile Anti-Virus apps exposedStephanie Vanroelen - Mobile Anti-Virus apps exposed
Stephanie Vanroelen - Mobile Anti-Virus apps exposed
 
From Reversing to Exploitation: Android Application Security in Essence
From Reversing to Exploitation: Android Application Security in EssenceFrom Reversing to Exploitation: Android Application Security in Essence
From Reversing to Exploitation: Android Application Security in Essence
 
5 Steps for End-to-End Mobile Security with Consumer Apps
5 Steps for End-to-End Mobile Security with Consumer Apps5 Steps for End-to-End Mobile Security with Consumer Apps
5 Steps for End-to-End Mobile Security with Consumer Apps
 

Plus de apidays

Plus de apidays (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
 
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, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
 
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
 
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
 
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
 
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
 
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
 
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
 
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
 
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
 
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
 
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
 

Dernier

Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 

APIsecure 2023 - Android Applications and API Hacking, Gabrielle Botbol

  • 1. March 14&15, 2023 Gabrielle Botbol Is powered by & Android Applications and APIs Hacking
  • 2. Who am I? Gabrielle Botbol @Gabrielle_BGB /in/gabriellebotbol https://csbygb.github.io/
  • 3. From blogger to pentester «Apprenance» is: «a lasting set of dispositions… favourable to the act of learning… in all situations: formal or informal, experiential or didactic, self-directed or not, intentional or accidental». Philippe Carré, 2005.
  • 6. What is Android App Pentest?
  • 7. Why Android App Pentest? July 13th 2022
  • 8. Some figures Source: https://www.zimperium.com/global-mobile-threat-report/ New Mobile Malware Samples Detected in the Wild in 2021 Increase in Exploited, Zero-Day Mobile Vulnerabilities Enterprises Reported Mobile Devices and Web Apps Led To A Security Incident Phishing Sites Specifically Targeted Mobile Devices Of Mobile Devices Encountered Malicious Applications Worldwide 10M+ 466% 2,034,217+ Mobile Endpoints Impacted By Threats 42% 75% 23%
  • 9. What about Android APIs? Why dev use APIs? - Manipulate data from remote locations - Third party services - Improve performance - Code Reuse - Flexible and scalable - They can also make their own APIs
  • 10. Android App pentest process We’ll dive into these together Planning Reco -naissance Static Analysis Dynamic Analysis Report 1 2 3 4 5
  • 11. The importance of the lab
  • 12. What you will need - Jadx - apktool - ADB - Android Studio - Burp Suite Tools:
  • 13. Set up the lab - Installs Install Jadx Install adb Install apktool https://ibotpeaches.github.io/Apktool/install/ Install Android Studio Download https://developer.android.com/studio Install Burp Suite Download and install the version according to your system here https://portswigger.net/burp/releases/professional-community-2021-12-1?requestededition =community For more info on these installs - JADX https://github.com/skylot/jadx - ADB https://www.xda-developers.com/install-adb-windows-macos-linux/ sudo apt install default-jdk sudo apt install jadx ./jadx-gui sudo apt-get install adb
  • 14. Set up the lab - Create an emulator
  • 15. Set up the lab - Configure burp How to Bypass certificate pinning: https://csbygb.gitbook.io/penti ps/mobile-app-pentest/androi d#how-to-bypass-certificate-p inning Practical examples of bypass of cert pinning: https://csbygb.gitbook.io/penti ps/writeups/htbtracks/htb-intr o-to-android-exploitation-trac k => Challenge: Pinned => Challenge: Anchored
  • 16. Vuln Apps used for the examples Get PIVAA here: https://github.com/HTBridge/pivaa Purposefully Insecure and Vulnerable Android Application. Get InjuredAndroid here: https://github.com/B3nac/InjuredAndroid /releases/tag/v1.0.12
  • 17. Static Analysis What to check: - AndroidManifest.xml - Strings.xml - Enumerate Database - Search for secrets and sensitive data
  • 18. How to check the code Jadx ./jadx-gui apktool apktool d app.apk Decompiled files with apktool
  • 19. Example PIVAA - AndroidManifest 1 <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.READ_PROFILE"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.NFC"/> <uses-permission android:name="android.permission.CALL_PHONE"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> - List of permissions here: https://developer.android.com/reference/android/Manifest.permission - List of permissions considered Dangerous: https://mas.owasp.org/MASTG/Android/0x05h-Testing-Platform-Interaction/#android-permission s
  • 20. Example PIVAA - AndroidManifest 2 android:allowBackup="true" android:debuggable="true" OWASP MSTG-STORAGE-8: https://github.com/OWASP/owasp-mstg/blob/8d67a609ecd095d1bb00aa6a3e211791af5642e8/Document/0x05d-Testing-Dat a-Storage.md#static-analysis-7 OWASP MSTG-CODE-2: https://github.com/OWASP/owasp-mstg/blob/53ebd2ccc428623df7eaf2361d44b2e7e31c05b9/Document/0x05i-Testing-C ode-Quality-and-Build-Settings.md#testing-whether-the-app-is-debuggable-mstg-code-2 (ON by default) (OFF by default)
  • 21. Static Analysis: Find the API endpoints - Search for keywords “http”, “https”, etc. - Look for function or classes (requests & responses) - Manifest: permissions for network communications - Check the JS files or AIDL files
  • 22. Static Analysis: How are APIs called - Example [STRIPPED] public class ApiCallTask extends AsyncTask<String, Void, String> { [STRIPPED] try { URL url = new URL(apiUrl); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); Log.d(TAG, "API response code: " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer responseBuffer = new StringBuffer(); while ((inputLine = in.readLine()) != null) { responseBuffer.append(inputLine); } in.close(); response = responseBuffer.toString(); } catch (IOException e) { Log.e(TAG, "API call failed", e); } return response; } [STRIPPED] new ApiCallTask().execute("http s://api.example.com/data"); Class used and executed in an instance
  • 23. Static Analysis: Fetch API Javascript - Example function fetchData() { var apiUrl = "https://api.example.com/data"; var xhr = new XMLHttpRequest(); xhr.open("GET", apiUrl, true); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { var data = JSON.parse(xhr.responseText); displayData(data); } }; xhr.send(); }
  • 24. Static Analysis: API vulnerabilities 2022 2019 “This is a private key! WTF, man!” - Alissa Knight - 2019 How I hacked 30 mobile banking apps & the future of API Security, Alissa Knight Thousands of Android apps leak hard-coded secrets, research shows - Cybernews
  • 25. Example with InjuredAndroid - Strings <string name="google_api_key">AIzaSyCUImEIOSvqAswLqFak75xhskkB6illd7A</string> <string name="google_app_id">1:430943006316:android:d97db57e11e42a1a037249</str ing> <string name="google_crash_reporting_api_key">AIzaSyCUImEIOSvqAswLqFak75xhskkB6 illd7A</string> <string name="google_storage_bucket">injuredandroid.appspot.com</string> /res/values/strings.xml
  • 26. General Tips for static analysis
  • 27. Grep it! /uploads directory apktool d app.apk grep -r “unsafe secret” More tips on grep here: https://csbygb.gitbook.io/pentips/digital-skills/us eful-linux#grep
  • 28. Tools for static analysis - Firebase Enum Github: https://github.com/Sambal0x/firebaseEnum - FireBaseScanner: https://github.com/shivsahni/FireBaseScanner - Cloud Enum https://github.com/initstring/cloud_enum
  • 29. Dynamic Analysis What to check: - Tapjacking - Can you capture screens with sensitive data - OWASP Top 10 - Analyse traffic with burp to find odd things
  • 30. Dynamic Analysis: Find API endpoint /api /api/v1 /v1 /docs /rest /v1 /v2 /v3 /swagger /swagger.json /doc/graphql Use a wordlist and FUZZ: https://github.com/danielmiessler/SecLists/blob/master/Discovery/Web-Content/ api/api-endpoints.txt
  • 31. Example with PIVAA - BG capture
  • 33. General tips: Common API vulnerabilities to look for - API1:2019 Broken Object Level Authorization - API3: 2019 Excessive Data Exposure - API7:2019 Security Misconfiguration - API9:2019 Improper Assets Management Find more here: https://github.com/OWASP/API-Security/tree/master/2019/en/src More tips on API pentest here: https://csbygb.gitbook.io/pentips/web-pentesting/api
  • 34. General tips: Use checklists MindAPI - David Sopas: https://dsopas.github.io/MindAPI/play/ Official OWASP MAS Checklist: https://mas.owasp.org/MAS_checklist/
  • 36. How to report - Example Broken Object Access Control Severity: Medium CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N Description A BOLA (Broken Object Level Authorization) vulnerability is a security issue that allows an attacker to access or manipulate sensitive data or functionality in an application by modifying the object ID in the API requests. This vulnerability arises when the application lacks proper authorization checks and fails to enforce access control restrictions on user input. In our context, we identified a BOLA vulnerability in the API of the application. This vulnerability could allow an attacker to bypass the access control measures and gain unauthorized access to sensitive data or functionality in the application.
  • 37. How to report - Example Broken Object Access Control Remediation We recommend that the development team implement proper authorization checks in the API to prevent this vulnerability from being exploited. Additionally, we suggest conducting a thorough review of the application's access control mechanisms to identify and address any other potential BOLA vulnerabilities. Resource https://github.com/OWASP/API-Security/blob/master/2019/en/src/0xa1-broken-obje ct-level-authorization.md
  • 38. Get these slides and all the resources https://csbygb.gitbook.io/ Android tips and BIG list of FREE resources: https://csbygb.gitbook.io/pentips/mobile- app-pentest/android
  • 39. Android Application Pentest Article - Pentest Magazine - My article about Android Application Pentest https://pentestmag.com/product/pentest-play-in-yo ur-own-pentest-lab-in-2022/
  • 40. Quiz to go Check out the quiz about this presentation here: https://forms.gle/GPymC3RrsmCRLxY C6