Lect_12&13 - Deekshith19/Android_Security GitHub Wiki

Frida Tool

Frida is a dynamic instrumentation toolkit designed for developers, reverse engineers, and security researchers. It allows you to inject scripts into running processes to inspect and modify their behavior on the fly.

Use Cases

  • Security Testing: Inspect and modify the behavior of applications to find vulnerabilities and test security mechanisms.
  • Reverse Engineering: Understand how applications work internally by examining and modifying their runtime behavior.
  • Debugging: Debug applications by injecting scripts to track down bugs and performance issues.
  • Bypassing Restrictions: Modify app behavior to bypass certain restrictions or implement additional features.

How Frida Works

Frida uses an injector to load a shared library into the target process. This library provides a JavaScript runtime environment where user scripts are executed. The scripts can hook into various functions, manipulate memory, and interact with the app in real-time.

Frida is powerful for:

  • Dynamic Instrumentation: Injecting scripts into running processes.
  • Function Hooking: Hooking into functions to intercept and modify their behavior.
  • Memory Manipulation: Allowing manipulation of memory in real-time.
  • Interprocess Communication: Enabling communication between scripts and target processes.

image

image

image

image

With Burp Suite:

image

image

Search for CA Certificate

image

Burp Suite for android:

Configuring an Android Device to Work with Burp Suite

Step 1: Configure a Dedicated Proxy Listener in Burp

To enable Burp to intercept the HTTP traffic generated by the Android device, we need to configure a proxy listener and bind it to an open port.

  1. In Burp, open the Settings dialog.
  2. Go to Tools > Proxy.
  3. Under Proxy Listeners, click Add.
  4. On the Binding tab, set "Bind to port" to any available port.
  5. Set "Bind to address" to All interfaces.
  6. Click OK and confirm the entries when prompted.

Burp is now ready to receive HTTP traffic on the assigned port and forward it to the target web server.

Step 2: Configure Your Device to Proxy Traffic Through Burp

  1. On your Android device, go to the network and internet settings.
  2. Open the network details for the Wi-Fi network that you want to use for testing.
  3. Enter edit mode.
  4. In the advanced settings, choose the option to configure a proxy manually.
  5. Set the Proxy hostname to the IP address of the machine you're using to run Burp.
  6. Set the Proxy port to the port you assigned to the new proxy listener you configured in Burp.
  7. Save your changes and then connect to the Wi-Fi network. Your device's web traffic is now proxied through Burp.

Step 3: Add Burp's CA Certificate to Your Device's Trust Store

Each installation of Burp has its own built-in certificate authority (CA). To work with any HTTPS traffic in Burp, we need to add the associated CA certificate to your device's trust store. This enables Burp to impersonate the target web server during the TLS handshake, allowing us to read and modify HTTPS traffic.

  1. In Burp, open the Settings dialog.
    • Go to Tools > Proxy.
    • Under Proxy Listeners, click "Import / export CA certificate."
  2. In CA Certificate dialog, select "Export > Certificate in DER format" and click Next.
  3. Enter a filename and location for the certificate, explicitly including the .der file extension.
  4. Click Next. The dialog indicates that the certificate was successfully exported.
  5. Add the certificate to your device's trust store.

Step 4: Test the Configuration

  1. In Burp, go to the Proxy > Intercept tab.
  2. Use the button to turn the Intercept feature on.
  3. On your Android device, open the browser.
  4. Browse to any site using HTTPS. If you've completed the configuration successfully, the page should load without any security warnings, and you should see your traffic in Burp on the Proxy > HTTP history tab.