Skip to content

Conversation

@smadi0x86
Copy link

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 smadi0x86 requested a review from a team April 13, 2025 20:12
@smadi0x86 smadi0x86 marked this pull request as draft April 13, 2025 20:13
@smadi0x86 smadi0x86 marked this pull request as ready for review April 13, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamically pick up IP address by network interface

2 participants