← Beginner Android Penetration Testing
Task 1
Traffic Analysis - The Man-in-the-Middle
▾
Introduction
Most apps talk to a server. By sitting between the app and the internet, we can see everything it sends and receives. This is a Man-in-the-Middle (MitM) attack. We will use Burp Suite for this.
Prerequisite
- Emulator configured with Burp Proxy (from Room 2).
- Burp Suite running with "Invisible Proxy" enabled (Settings -> Proxy -> Options -> Edit -> Request Handling -> Support invisible proxying).
Practical Tasks
Task 1: Intercepting HTTP Traffic
- In Burp, go to the
Proxy->Intercepttab and ensure Intercept is OFF. - Go to your emulator, open a vulnerable app like
InsecureBankv2, and try to log in with any credentials. - Go back to Burp. Click on the
HTTP historytab. - Your Mission: Find the HTTP request that contains the login attempt. It will likely be a
POSTrequest to a URL like/login. You should see theusernameandpasswordin plain text!
Task 2: Intercepting and Modifying HTTPS Traffic
- Enable Intercept in Burp (
Intercept is on). - In the app, try to log in again.
- The request will appear in Burp. Press
Forwarda few times. - Problem: You might get a certificate error. You need to install Burp's CA certificate on the emulator.
- Solution:
- In Burp, go to
Proxy->Options->Import / export CA certificate->Export->Certificate in DER format. Save ascacert.der. - Rename it to
cacert.cer. - Push it to your emulator:
adb push cacert.cer /sdcard/. - On the emulator, go to
Settings->Security->Install from SD card. Select the certificate, name it "Burp", and chooseVPN and Apps. - Intercepted HTTPS traffic will now work!
- In Burp, go to
Task 3: Modifying a Response to Bypass a Login
- Find an app with a "Pro" or "Premium" feature that checks a server response.
- Intercept the response from the server.
- Your Mission: Find a parameter like
"is_premium": falseand change it to"is_premium": truebefore forwarding the response to the app. - Observe if the app grants you premium access.
Summary
- HTTP traffic is trivially intercepted.
- HTTPS can be intercepted after installing a custom CA certificate.
- By modifying requests and responses, you can bypass client-side checks, escalate privileges, and find injection flaws.