Skip to content

Instantly share code, notes, and snippets.

@gameFace22
Last active November 5, 2020 10:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gameFace22/3afedd1309960249fa7fcb1360e40fd3 to your computer and use it in GitHub Desktop.
Save gameFace22/3afedd1309960249fa7fcb1360e40fd3 to your computer and use it in GitHub Desktop.
Port Forwarding + Burp = Win!

Why Port Forwarding?

Most of the applications we pentest respect the system proxy set in the device. There are some exceptions though, like Xamarain (-.-) , where the proxy set in the device is ignored. It makes interception harder. By using Port Forwarding, we can almost intercept any application. Though, the mentioned commands might slightly vary on different flavors of Operating System.

Requirements

  1. Macbook/Linux Machine
  2. Mobile Device to tether Internet with USB/Bluetooth or dongle (much easier!)
  3. pfctl/iptables for port forwarding
  4. Testing device

Behind The Hood

Basically, we are connecting our machine from which we want to intercept and the testing device to the same interface. Internet connection from a machine can be shared through Bluetooth/USB/Ethernet. The medium does not matter as long it is not WiFi because there will be a conflict while we connect to a WiFi AP + try to set a AP in the same machine. Once we are done with the setup, just forward the machine's traffic to Burp. And, Voila!

Setup

iOS

  1. Using a mobile device/dongle, tether Internet. Tethering can be done using USB/Bluetooth. WiFi is not preferred because there would be conflict when we create a hotspot from the Mac.
  2. Connect the machine to the tethered Internet from System Preferences -> Network
  3. System Preferences -> Sharing -> Internet Sharing
  4. Choose the 'Share From' accordingly and 'To Computers Using' to 'WiFi'
  5. Connect to the AP which got created from Macbook
  6. From the machine, port forward with rdr pass on bridge100 inet proto tcp from any to any -> 127.0.0.1 port 8080 Here the bridge100 is the interface which is created once we tether.
  7. Flush the old and enable the new rule using sudo pfctl -f pf.rules
  8. In Burp, make sure proxy is bind using 'All interfaces' and 'Support invisible proxying' is enabled from Proxy -> Options -> Edit Proxy Listener -> Request handling
  9. Install Burp certificate in your testing device by visiting http://ip:port
  10. Pwn!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment