1. 程式人生 > >WebLogic 任意文件上傳 遠程代碼執行漏洞 (CVE-2018-2894)------->>>任意文件上傳檢測POC

WebLogic 任意文件上傳 遠程代碼執行漏洞 (CVE-2018-2894)------->>>任意文件上傳檢測POC

htm input ade print out vcg exc ops 上傳

前言:

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

聲明:如果你使用該腳本進行非法攻擊,或者做黑產已本人無一絲關系。

請遵守法律。

WebLogic 任意文件上傳 遠程代碼執行漏洞 (CVE-2018-2894)------->>>任意文件上傳檢測POC