Proxy Like a Pro: interesting method of proxying non proxy-aware Android Apps
In this blog post, we'll explore several methods to enable proxying for Android apps that do not natively support proxies. We'll cover regular methods like Wi-Fi settings, ADB commands, and Frida scripts, and then delve into more advanced techniques such as using iptables and DNS manipulation.
Regular Methods to Enable Proxy
1. Enabling Proxy in Wi-Fi Settings
One of the simplest ways to set up a proxy on an Android device is through the Wi-Fi settings.
Go to Settings > Network & Internet > Wi-Fi.
Long press on your Wi-Fi network and select Modify network.
Enable Advanced options.
Set Proxy to Manual and enter the proxy hostname and port.
2. Using ADB Command
ADB (Android Debug Bridge) can be used to set a proxy for your Android device.
Connect your Android device to your computer.
Open a terminal and enter the following command:
adb shell settings put global http_proxy <proxy_host>:<proxy_port>To clear the proxy settings, use:
adb shell settings put global http_proxy :0
3. Proxy for an Individual App Using Frida Script or Objection Module
Frida and Objection can be used to hook into an app and force it to use a proxy.
Frida Script Example
Install Frida on your computer and device.
Write a Frida script to hook the app's network functions and redirect traffic through the proxy.
Execute the script while the app is running.
Objection Example
Install Objection and launch it against the target app:
objection --gadget <app_package> exploreUse the following command within Objection:
network monitor start --proxy <proxy_host>:<proxy_port>
Advanced Method: Using iptables
Setting Up iptables
Using iptables requires a rooted device. This method redirects all traffic through the proxy.
Gain root access on your device.
Use iptables to redirect traffic:
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination <proxy_host>:<proxy_port> iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination <proxy_host>:<proxy_port>Verify that the traffic is being redirected.
New approach: Proxy Using DNS
1. Setting Up DNSChef
DNSChef can be used to redirect DNS requests to a proxy server.
Install DNSChef on your computer:
pip install dnschefRun DNSChef to redirect traffic:
dnschef --fakeip <your_ip> --fakedomains <target_domain>Alternatively, redirect all traffic:
dnschef --fakeip <your_ip>
2. Configuring Android DNS Settings
Configure your Android device to use the DNSChef server.
Go to Settings > Network & Internet > Wi-Fi.
Long press on your Wi-Fi network and select Modify network.
Enable Advanced options.
Set IP settings to Static and enter your computer's IP address as the DNS server.
3. Enabling Transparent Proxy in Burp Suite
Finally, enable transparent proxying in Burp Suite to handle the incoming traffic.
Open Burp Suite and go to Proxy > Options.
Add a new proxy listener and enable Invisible proxying under Request Handling.
By following these steps, you can effectively proxy non proxy-aware Android apps using various methods tailored to your needs. Whether through simple Wi-Fi settings or more advanced DNS manipulation, each approach provides a way to monitor and intercept app traffic.
