If you want to redirect you Android devices traffic to your Burp instance, you’ll just have to use DNAT and MASQUERADING. I was more detailed about this topic in this post. And since the Internet is full of misleading information these are the steps to get it working. A small side remark: Most articles show you how to route the devices traffic through another machine (hosting the Burp instance). In that case one could:
- force the traffic redirection using arp spoofing
- connect the Android device to a software (WiFi) access point forwarding everything to the hosting machine
In both cases you’ll be using the PREROUTING
chain and DNAT
on your Burp machine in order to make sure
that arriving packets will be forwarded/redirected to Burp’s socket. In my case I won’t be using PREROUTING
since I’ll try to redirect all locally generated packets to another host. To be more specific: All outbound
traffic (OUTPUT
chain) (destinated at a certain port) will be redirected to the Burp machine.
{% blockdiag blockdiag { Client [label=“Android\n192.x.x.3”, shape=cisco.pda]; NAT [label=“NAT\n192.x.x.3”, shape=cisco.router]; Server [label=“Burp\n192.x.x.2”, shape=cisco.www_server]; Internet [shape=cloud]; CN [label=“Packet\n\nTo: x.x.x.x:80”, height=80, width=170, color=“orange”]; NS [label=“Packet\n\nFrom: 192.x.x.3\nTo: 192.x.x.2:8080”, height=80, width=170, color=“orange”];
Client -> CN -> NAT [color="orange"];
NAT -> NS -> Server [color="orange"];
Server -> Internet;
}
%}
Supposing your Android device (192.168.0.3) and the machine Burp is listening on (192.168.0.2:8080) are in the same WiFi-Network, you may have sth like this:
{% blockdiag nwdiag { internet [shape = cloud]; internet – router;
network internal {
address = "192.x.x.x/24";
router [address = "192.x.x.1", shape=cisco.router];
burp [address = "192.x.x.2", shape=cisco.pc];
android-client [address = "192.x.x.3", shape=cisco.pda];
}
}
%}
Let’s begin:
Flush iptables NAT table
|
|
Redirect HTTP traffic to Burp
|
|
Redirect HTTPS traffic to Burp
|
|
Activate Masquerading
|
|
That’s it. You can test it by making a HTTPS connection to paypal.com
:
|
|
This happens because Burp is presenting the client (curl) it’s own certificate. If you see that, then you’re successfully redirecting your HTTP(s) traffic to Burp.
This should also work for other ports/protocols.