Skip to content

Commit

Permalink
Ensure Wireguard endpoint is valid before trying to use it
Browse files Browse the repository at this point in the history
Fixes #931
  • Loading branch information
jamesgol committed Dec 6, 2022
1 parent 8a28bf4 commit 2fefb63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions implant/sliver/transports/wireguard/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ func WGConnect(address string, port uint16) (net.Conn, *device.Device, error) {
// bringUpWGInterface - First creates an inet.af network stack.
// then creates a Wireguard device/interface and applies configuration
func bringUpWGInterface(address string, port uint16, implantPrivKey string, serverPubKey string, netstackTunIP string) (tun.Device, *device.Device, *netstack.Net, error) {
if netstackTunIP == "" {
err := errors.New("[wireguard] Cannot connect to empty IP address")
return nil, nil, nil, err
}

tun, tNet, err := netstack.CreateNetTUN(
[]netip.Addr{netip.MustParseAddr(netstackTunIP)},
[]netip.Addr{netip.MustParseAddr("127.0.0.1")}, // We don't use DNS in the WG implant. Yet.
Expand Down

0 comments on commit 2fefb63

Please sign in to comment.