simonw / til

Today I Learned
https://til.simonwillison.net
Apache License 2.0
1.02k stars 81 forks source link

SSH daemons bound to WireGuard interface only can still be accessed from non-WireGuard network #7

Open klyubin opened 4 years ago

klyubin commented 4 years ago

https://github.com/simonw/til/blob/master/tailscale/lock-down-sshd.md suggests binding SSH daemon to the WireGuard interface only. This security measure can be bypassed because most modern Linux hosts use the Weak Host Model (see rp_filter settings). Packets received on non-WireGuard (e.g., eth0) interface, with destination IP of the WireGuard interface, will be happily delivered to the SSH daemon, and its replies will go out of the non-WireGuard interface. This, in effect, bypasses WireGuard. See rp_filter and https://lwn.net/Articles/806546/ for more information.

Mitigations:

simonw commented 4 years ago

Do you know if the alternative pattern suggested by @bradfitz would fix this?

AllowUsers *@100.64.0.0/10