sliver icon indicating copy to clipboard operation
sliver copied to clipboard

Feature/tcp stager interface support

Open smadi0x86 opened this issue 6 months ago • 0 comments

TCP Stager Interface Name Support

closes: #1880

Details

Added support for binding TCP stagers to specific network interfaces by name (e.g., "tun0", "eth0", etc...), this enhancement allows users to specify either an IP address or a network interface name when starting a TCP stager.

Changes

Core Implementation

// server/rpc/rpc-stager.go
if net.ParseIP(host) == nil {
    ifaceIP, err := getInterfaceIP(host)
    if err != nil {
        return nil, fmt.Errorf("failed to resolve interface %s: %v", host, err)
    }
    host = ifaceIP
}

Documentation Updates

// client/command/help/long-help.go
You can also specify a network interface name instead of an IP address:
stage-listener --url tcp://tun0:8080 --profile my-sliver-profile

Testing

Automated

  1. Unit tests for interface name resolution:
go test -tags=server,osusergo,netgo,go_sqlite ./server/c2

image

Manual

  1. Test with IP address:
generate stager -a amd64 -f ps1 -L 192.168.45.231 -l 8443
  1. Test with interface name:
generate stager -a amd64 -f ps1 -L tun0 -l 8443

Both commands successfully:

  • Start the TCP stager listener
  • Resolve the interface name to its IP address
  • Accept connections on the specified port

smadi0x86 avatar Apr 13 '25 20:04 smadi0x86