Intercepting network traffic on Android

. 4 min read

In this blog post we are going to have a look at how to intercept an Android application network traffic using a proxy tool – in this case Burp Suite. Below are the things you’ll need:

  1. Burp Proxy – you can download a free version from here
  2. Rooted device/android emulator (Genymotion)
  3. Android SDK Tools installed (We’ll need ADB)

First run the burp proxy on the host machine, then click on **Proxy | Options **and in the Proxy Listener menu item, click on add interface .

Add **8080 **(or any other port for that matter where you want to capture the traffic) in the **Bind to port **option. This is simply a port number where the Burp proxy will be listening for the network traffic coming from the Android device.

In “Bind to address select simply select “Specific address” and in drop down menu select an ip address which is assigned to your host machine by virtual-box which is 192.168.1.9 in my case and click on OK

Add-interface

Start the android emulator (I am using android api version 4.4.4 KitKat in Genymotion)
After starting an android emulator, go to settings->WiFi then click and hold the active wifi connection and select modify network.

click on “Show advanced options” and in proxy (by default it is set to none) click on the drop down menu and select manual and now you should see more options like Proxy hostname and proxy port.

In the host name put the IP address of the Host machine where the burp is listening in my case it was 192.168.1.9 and port number was 8080 (port to which burp proxy is binded) and click on Save and now you will be able to intercept all the “HTTP” (unencrypted) traffic that is sent by the android applications.

Modify-network

But now a days most of the android application transmits data over SSL which you cannot normally intercept using the above step. So to intercept the SSL traffic you need to import a CA certificate (of your host machine proxy which will be intercepting the android traffic) to the android keystore.

To do this you need to perform additional steps given below:

  1. change the proxy setting in the browser and set the host to 127.0.0.1 and port to 8080 then go to http://burp/ and click on CA Certificate and it will download a CA certificate.

download-ca-cert

  1. Rename the CA certificate to cacert.crt and push it to the emulator SDCARD using the following commands:

  2. adb connect 192.168.56.101 2. adb push cacert.crt /mnt/sdcard/cacert.crt

push-ca-cert

  1. Now in the emulator / device go to “Settings->Security” in the Credential storage select “Install form SD Card” and then you can select the “cacert.crt” file present in the sd card and give the name cacert and click on ok and it will ask you to set a lock screen click on ok and select a type of lock screen and confirm (don’t forget the lock screen pattern)

Screen Shot 2015-08-24 at 12.42.52 pm

And thats it! Now you will be able to intercept the SSL traffic of the android applications.

Screen Shot 2015-08-24 at 1.05.51 pm

Is this the end ?? No.

Now a days most of the critical applications use a mechanism used SSL pinning.

What is SSL Pinning?

SSL pinning is basically checking if the server certificate matches with the certificate in the application. If not then it will give you an error and you wont be able to intercept the traffic.

By default when making an SSL connection, a client checks that the server’s certificate:

  1. Has a verifiable chain of trust back to a trusted (root) certificate.
  2. Matches the requested domain name.

Most of the developers wont implement proper SSL pinning mechanism which would sometime allow us to bypass the SSL Pinning mechanism by patching the instances where SSLPinning is implemented.

Another simple method to bypass SSL pinning is by Using a tool called “Android TrustKiller” developed by iSECPartners.

This tool uses Cydia Stubstrate to hook various methods in order to bypass certificate pinning by accepting any SSL Certificate.

To use this tool first you need to install

  1. Cydia Substrate available in android play store.
  2. Then Install apk available in Android TrustKiller

After installing Cydia Substrate and Android TrustKiller open Cydia substrate and select “Link Substrate files” and thats it ! now you will be able to intercept the SSL traffic even if SSL Pinning is implemented.



Get IoT Security Training

IoT Pentesting Exploitation Training

Tags

analog modulation Android android application security android hands on security and exploitation training android security Apktool application auditing application security auditing appsec usa appwatch arduino nano arm ARM binaries ARM course ARM exploitation book ARM exploitation video training ARM gadgets ARM Training attify attify badge attify training best security practices biggest iot attacks of all time binwalk blackberry pentesting blackhat ble BLE attacks BLE dangers BLE hacking and exploitation BLE security issues BLE sniffing BLE vulnerabilities bleah bluetooth technology box brut Exception BtleJuice capture radio traffic career in cybersecurity CCTV cameras challenges in iot retail chroot cloud based mobile application security scanner consulting CTF cyber attacks cybersecurity Damn Vulnerable iOS App dangers of iot DDoS attacks devops digital modulation dumping memory embedded hacking expert Exploit ARM devices exploitation exploiting ble exploiting smart devices firmadyne firmware analysis toolkit firmware emulation Firmware hacking firmware reverse engineering Flare-on frida getting started with firmware hacking GSMA guide to ARM exploitation hacked security IP cameras hacked smart devices hackers hackfest hacking smart devices healthcare business protection against iot threats healthcare cyber security how can healthcare fight iot threats How Mirai botnet infects your device How Mirai works how retail can prevent cyber attacks how to exploit ble how to hack radio waves how to protect iot devices how to secure iot device IDA internet of things Internet of Things Security internet security ios application security ios security iot iot attacks iot bots, malwares iot device IoT Devices IoT Exploitation iot hacking iot hacks IoT hacks on ARM devices iot penetration testing iot pentest iot pentesting iot security IoT security guidelines iot security training iot threats iot threats to healthcare industry iotsecurity IP cameras jtag jtag debugging latest iot attacks learn ARM exploitation measures to prevent cyber attacks on healthcare organisations Mirai Botnet mirai history mobile app mobile application security mobile application security testing mobile security monitor iot devices Mozilla network security in retail ninja recon technique NIST offensive iot exploitation ola cabs owasp owasp appsec penetration testers penetration testing pentesting pentesting mobile apps phishing attacks powerofcommunity PrinterSecurity privacy protection profession professional qemu quizup radio communication protocol radio coomunication radio waves hacking recent ARM attacks recent cyber attacks recent iot attacks recent security camera attacks retail iot Reversing safety measures to protect privacy sdr secure coding guidelines security security cameras security challenges in retail IoT security in healthcare iot security issue security issues faced by e-retailers security services security training security vulnerability setup smart devices smart user security social networking spi steps to prevent iot attacks on healthcare surveillance cameras hijacked threat modeling tools to exploit ble training uart Understanding Mirai Botnet virus vulnerabilities discovered in popular IoT IP cameras vulnerabilities in internet connected cameras vulnerability vulnerable ARM devices What is mirai botnet? why choose career in cybersecurity writeups xposed hooking zigbee zigbee exploitation zigbee security zwave

Instagram