Client-to-client traffic filtering
OS / Environment
Server: DigitalOcean droplet Clients: all
Summary of the problem
By default, the algo server allows IP traffic between multiple connected clients.
I did not check, but I assume using the included proxy will produce a similar problem if the Host: header points to an IP on vpn_network.
Steps to reproduce the behavior
Connect two clients to the same algo server and generate traffic from one to another.
The way of deployment (cloud or local)
cloud
Expected behavior
Connected clients should be unable to send packets with dst IPs on the algo DHCP subnet. Ideally, this behavior would be blocked by default and require setting a flag to allow it in config.cfg.
Sending traffic on port 55555 from .2 to .1, no response.
root@algo:/etc# tcpdump -n port 55555
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
18:00:24.759224 IP 10.19.48.2.52250 > 10.19.48.1.55555: Flags [S], seq 711864216, win 1024, options [mss 1460], length 0
18:00:27.377671 IP 10.19.48.2.47859 > 10.19.48.1.55555: Flags [S], seq 2533234179, win 1024, options [mss 1460], length 0
18:00:27.821591 IP 10.19.48.2.54904 > 10.19.48.1.55555: Flags [S], seq 2959710619, win 1024, options [mss 1460], length 0
Actual behavior
Sending traffic on port 55555 from .2 to .1. The SYN is received and a RST returned.
root@alg:/etc# tcpdump -n port 55555
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
17:58:44.258609 IP 10.19.48.2.54596 > 10.19.48.1.55555: Flags [S], seq 2163267968, win 1024, options [mss 1460], length 0
17:58:45.264705 IP 10.19.48.2.54597 > 10.19.48.1.55555: Flags [S], seq 2163333505, win 1024, options [mss 1460], length 0
17:58:45.649292 IP 10.19.48.1.55555 > 10.19.48.2.54596: Flags [R.], seq 0, ack 2163267969, win 0, length 0
17:58:45.649448 IP 10.19.48.1.55555 > 10.19.48.2.54597: Flags [R.], seq 0, ack 2163333506, win 0, length 0
Potential fix
As a simple fix that blocks it without giving the user an option to override, modifying the iptables rules works for IPv4. (Output shown above.)
https://github.com/trailofbits/algo/blob/master/roles/vpn/templates/rules.v4.j2#L24
...
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s {{ vpn_network }} -d {{ vpn_network }} -j REJECT
-A FORWARD -p tcp --dport 445 -j DROP
...
Similarly for v6 (untested):
https://github.com/trailofbits/algo/blob/master/roles/vpn/templates/rules.v6.j2#L30
-A FORWARD -s {{ vpn_network_ipv6 }} -d {{ vpn_network_ipv6 }} -j REJECT
Why is this bad? Who are the VPN peers supposed to communicate with if not each other?
We can remove the configuration option for this feature. Make it default block. I don't see a strong use case for keeping it.
the prompts removed https://github.com/trailofbits/algo/commit/efb78e27d4e2ee0f946c39ac679e6db89e55a0a9