源代码管理攻击工具箱SCMKit
作者:Sec-Labs | 发布时间:
工具介绍
源代码管理攻击工具箱 - SCMKit是一个可用于攻击SCM系统的工具箱。SCMKit 允许用户指定要使用的 SCM 系统和攻击模块,同时指定相应 SCM 系统的有效凭证(用户名/密码或 API 密钥)。目前,SCMKit支持的SCM系统有GitHub Enterprise、GitLab Enterprise和Bitbucket Server。支持的攻击模块包括侦察、权限升级和持久化。SCMKit 是以模块化的方式建立的,因此信息安全社区可以在未来添加新的模块和 SCM 系统。
工具地址
https://github.com/h4wkst3r/SCMKit
安装/构建
使用的库
本项目中使用了以下第三方库
| Library | URL | License |
|---|---|---|
| Octokit | https://github.com/octokit/octokit.net | MIT License |
| Fody | https://github.com/Fody/Fody | MIT License |
| GitLabApiClient | https://github.com/nmklotas/GitLabApiClient | MIT License |
| Newtonsoft.Json | https://github.com/JamesNK/Newtonsoft.Json | MIT License |
预编译
在Release中使用预编译的二进制文件
构建
采取下面的步骤来设置Visual Studio,以便自己编译项目。这需要一个.NET库,可以从NuGet包管理器中安装。
- 加载Visual Studio项目并进入 "工具"-->"NuGet包管理器"-->"包管理器设置"
- 进入 "NuGet包管理器"-->"包源"。
- 添加一个包源,网址是
https://api.nuget.org/v3/index.json - 安装以下NuGet软件包
Install-Package Costura.Fody -Version 3.3.3Install-Package OctokitInstall-Package GitLabApiClientInstall-Package Newtonsoft.Json
- 你现在可以自己建造这个项目了!
使用
参数选项
- -c, -credential - 用于认证的凭证(用户名:密码或apiKey)
- -s, -system - 攻击系统(github、gitlab、bitbucket)
- -u, -url - GitHub企业版、GitLab企业版或Bitbucket服务器的URL
- -m, -module - 选择模块
- -o, -option - 选项(适用时)
系统 (-s, -system)
- github: GitHub企业版
- gitlab: GitLab企业版
- bitbucket: Bitbucket服务器
模块(-m, -module)
- listrepo: 列出当前用户可以看到的所有仓库
- searchrepo: 搜索一个给定的 repo
- searchcode: 搜索包含关键字搜索词的代码
- searchfile: 搜索含有关键字搜索词的文件名
- listsnippet: 列出当前用户的所有片段
- listrunner: 列出当前用户可用的所有GitLab运行程序
- listgist: 列出当前用户的所有Gists
- listorg: 列出当前用户所属的所有组织
- privs: 获取当前API令牌的权限
- addadmin: 提升给定用户为管理员角色
- removeadmin: 将给定的用户从管理角色中降级
- createpat: 为目标用户创建个人访问令牌
- listpat: 列出目标用户的个人访问令牌
- removepat: 删除目标用户的个人访问令牌
- createsshkey: 为当前用户创建SSH密钥
- listsshkey: 列出当前用户的SSH密钥
- removesshkey: 删除当前用户的SSH密钥
- adminstats: 获取管理员统计信息(用户、仓库、组织、清单)。
模块详细表
下表显示了每个模块支持的功能
| Attack Scenario | Module | Requires Admin? | GitHub Enterprise | GitLab Enterprise | Bitbucket Server |
|---|---|---|---|---|---|
| Reconnaissance | listrepo |
No | X | X | X |
| Reconnaissance | searchrepo |
No | X | X | X |
| Reconnaissance | searchcode |
No | X | X | X |
| Reconnaissance | searchfile |
No | X | X | X |
| Reconnaissance | listsnippet |
No | X | ||
| Reconnaissance | listrunner |
No | X | ||
| Reconnaissance | listgist |
No | X | ||
| Reconnaissance | listorg |
No | X | ||
| Reconnaissance | privs |
No | X | X | |
| Persistence | listsshkey |
No | X | X | X |
| Persistence | removesshkey |
No | X | X | X |
| Persistence | createsshkey |
No | X | X | X |
| Persistence | listpat |
No | X | X | |
| Persistence | removepat |
No | X | X | |
| Persistence | createpat |
Yes (GitLab Enterprise only) | X | X | |
| Privilege Escalation | addadmin |
Yes | X | X | X |
| Privilege Escalation | removeadmin |
Yes | X | X | X |
| Reconnaissance | adminstats |
Yes | X |
标签:工具分享, 敏感信息查询工具, 代码泄露, 代码管理