WebLogic 任意文件上传 远程代码执行漏洞 (CVE-2018-2894)------->>>任意文件上传检测POC

前言:

Oracle官方发布了7月份的关键补丁更新CPU(Critical Patch Update),其中针对可造成远程代码执行的高危漏洞 CVE-2018-2894 进行修复:

http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html

CVE-2018-2894 由中国国家互联网应急中心 CNCERT 的安全研究员 Mingxuan Song 和 Apple 公司的安全研究员 David Litchfield 同时提交发现。

今天 7 月 19 号国家互联网应急中心 CNCERT 发出通告,指出 CVE-2018-2894 本质上为任意文件上传漏洞:

https://mp.weixin.qq.com/s/y5JGmM-aNaHcs_6P9a-gRQ

 

思路:

思路一样。读取文件去除空格加上路径发起请求去掉过滤。提取出符合条件的URL

(能用一句话说完的事情不想浪费换行)

 

代码:

import requests
import threading
import os

error=['404','Not Found','找不到','安全狗','无权访问','403']
ok=[]
bad=[]
def exploit():
    headers={'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1'}
    path='/ws_utc/config.do'
    print('[+]Weblogic arbitrary file upload detection POC,data:https://mp.weixin.qq.com/s?__biz=MzIwMDk1MjMyMg==&mid=2247484311&idx=1&sn=14da21743a447449896292bb367a322e&chksm=96f41cfaa18395ec6182af2353ac55079ca9376ea8d2a2f8a1816c12e7e79b1081b0bc01d2fe&mpshare=1&scene=1&srcid=0719et8NMmpFCRlu8vcgqreh#rd')
    user=input('Imported files:')
    if os.path.exists(user):
        print('[+]file {} ok'.format(user))
    else:
        print('[-]Not Found {}'.format(user))
        exit()

    ops=open('{}'.format(user),'r')
    for o in ops.readlines():
        sc="".join(o.split('\n'))
        urls=sc+path
        try:
            reques=requests.get(url=urls,headers=headers,allow_redirects=False,timeout=3)
            for e in error:
                if reques.status_code==200 and e not in reques.text:
                    pd='[+]debug url:{}'.format(sc)
                    if pd in ok:continue
                    ok.append(pd)
                    print(pd)
                else:
                    nos='[-]Not debug url:{}'.format(sc)
                    if nos in bad:continue
                    bad.append(nos)
                    print(nos)
        except:
            pass
exploit()

 

测试结果如下:

github下载地址:https://github.com/422926799/python/tree/master/WebLogic%E4%BB%BB%E6%84%8F%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0

声明:如果你使用该脚本进行非法攻击,或者做黑产已本人无一丝关系。

请遵守法律。

posted on 2018-07-19 18:44  东京$  阅读(4532)  评论(0编辑  收藏  举报

导航