Blog | G5 Cyber Security

Bettercap: TCP Proxy Upstream Server

TL;DR

This guide shows you how to set up an upstream server for Bettercap’s TCP proxy, allowing it to forward traffic through a specified host. This is useful for tunnelling traffic or using Bettercap with remote servers.

Setting Up the Upstream Server

  1. Understand the Concept: Bettercap’s TCP proxy normally intercepts and handles connections locally. An upstream server lets you send that intercepted traffic to another host (your chosen server) for further processing or routing.
  2. Configure Bettercap: You’ll use Bettercap’s proxy.upstream option to define the server address and port.
    bettercap -cfg proxy.upstream 192.168.1.100:8080

    Replace 192.168.1.100:8080 with the actual IP address and port of your upstream server.

  3. Start Bettercap in Proxy Mode: Launch Bettercap with the TCP proxy enabled.
    bettercap -proxy on
  4. Verify Traffic Forwarding:
    • Connect to a website or service while Bettercap is running.
    • On your upstream server, check if you’re receiving the forwarded traffic (e.g., using netstat, tcpdump, or your server’s logging).

Advanced Configuration

  1. Using a Different Interface: If you want Bettercap to listen on a specific network interface for proxy connections:
    bettercap -iface eth0 -proxy on

    Replace eth0 with your desired interface.

  2. Specifying the Upstream Server in a Config File: Edit Bettercap’s configuration file (usually located at ~/.config/bettercap/bettercap.conf) and add or modify the following line:
    proxy.upstream = 192.168.1.100:8080
  3. Handling HTTPS Traffic: Bettercap can proxy HTTPS traffic, but you’ll need to configure it correctly.
    • Ensure your upstream server is capable of handling SSL/TLS connections (e.g., using a reverse proxy like Nginx or Apache).
    • Consider using the proxy.ssl option in Bettercap if needed, but be aware of potential certificate issues and man-in-the-middle risks.

Troubleshooting

Exit mobile version