Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
SCMKit — 源代码管理攻击工具包 | Kitploit
工具/GitHubGitHub/h4wkst3r/scmkit
权限提升侦察持久化机制渗透测试红队
GitHubh4wkst3r/scmkit

SCMKit

源代码管理攻击工具包

查看仓库
2295413年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

SCMKit

描述

源代码管理攻击工具包 – SCMKit 是一个可用于攻击 SCM 系统的工具包。SCMKIT 允许用户指定要使用的 SCM 系统和攻击模块,以及提供对应 SCM 系统的有效凭证(用户名/密码或 API 密钥)。目前 SCMKit 支持的 SCM 系统包括 GitHub Enterprise、GitLab Enterprise 和 Bitbucket Server。支持的攻击模块包括侦察、权限提升和持久化。SCMKIT 采用模块化方式构建,以便信息安全社区将来可以添加新的模块和 SCM 系统。

发布

  • SCMKit 1.2 版本可在 Releases 中找到

目录

  • SCMKit
  • 目录
  • 安装/构建
    • 使用的库
    • 预编译
    • 自行构建
  • 用法
    • 参数/选项
    • 系统
    • 模块
    • 模块详情表
  • 示例
    • 列出仓库
    • 搜索仓库
    • 搜索代码
    • 搜索文件
    • 列出代码片段
    • 列出运行器
    • 列出 Gist
    • 列出组织
    • 获取 API 密钥权限
    • 添加管理员
    • 移除管理员
    • 创建访问令牌
    • 列出访问令牌
    • 移除访问令牌
    • 创建 SSH 密钥
    • 列出 SSH 密钥
    • 移除 SSH 密钥
    • 列出管理员统计
    • 列出分支保护
  • 检测
  • 参考

安装/构建

使用的库

本项目使用了以下第三方库。

预编译

  • 使用 Releases 中的预编译二进制文件

自行构建

按照以下步骤设置 Visual Studio,以便自行编译项目。这需要 .NET 库,可从 NuGet 包管理器安装。

  • 加载 Visual Studio 项目,转到 "Tools" --> "NuGet Package Manager" --> "Package Manager Settings"
  • 转到 "NuGet Package Manager" --> "Package Sources"
  • 添加一个包源,URL 为 https://api.nuget.org/v3/index.json
  • 安装以下 NuGet 包
    • Install-Package Costura.Fody -Version 3.3.3
    • Install-Package Octokit
    • Install-Package GitLabApiClient
    • Install-Package Newtonsoft.Json
  • 之后你就可以自行构建项目了!

用法

参数/选项

  • -c, -credential - 认证凭证(username:password 或 apiKey)
  • -s, -system - 攻击的系统(github,gitlab,bitbucket)
  • -u, -url - GitHub Enterprise、GitLab Enterprise 或 Bitbucket Server 的 URL
  • -m, -module - 要运行的模块
  • -o, -option - 选项(适用时)

系统 (-s, -system)

  • github: GitHub Enterprise
  • gitlab: GitLab Enterprise
  • bitbucket: Bitbucket Server

模块 (-m, -module)

  • listrepo: 列出当前用户能看到的所有仓库
  • searchrepo: 搜索指定仓库
  • searchcode: 搜索包含关键词的代码
  • searchfile: 搜索包含关键词的文件名
  • listsnippet: 列出当前用户的所有代码片段
  • listrunner: 列出当前用户可用的所有 GitLab 运行器
  • listgist: 列出当前用户的所有 Gist
  • listorg: 列出当前用户所属的所有组织
  • privs: 获取当前 API 令牌的权限
  • addadmin: 将指定用户提升为管理员角色
  • removeadmin: 将指定用户从管理员角色降级
  • createpat: 为目标用户创建个人访问令牌
  • listpat: 列出目标用户的个人访问令牌
  • removepat: 移除目标用户的个人访问令牌
  • createsshkey: 为当前用户创建 SSH 密钥
  • listsshkey: 列出当前用户的 SSH 密钥
  • removesshkey: 移除当前用户的 SSH 密钥
  • adminstats: 获取管理员统计信息(用户、仓库、组织、Gist)
  • protection: 获取分支保护设置

模块详情表

下表显示了每个模块在哪些系统中受支持

示例

列出仓库

使用场景

发现特定 SCM 系统中使用的仓库

语法

提供 listrepo 模块,以及相关的认证信息和 URL。这将输出仓库名称和 URL。

GitHub Enterprise

这将列出用户能看见的所有仓库。

SCMKit.exe -s github -m listrepo -c userName:password -u https://github.something.local

SCMKit.exe -s github -m listrepo -c apiKey -u https://github.something.local

GitLab Enterprise

这将列出用户能看见的所有仓库。

SCMKit.exe -s gitlab -m listrepo -c userName:password -u https://gitlab.something.local

SCMKit.exe -s gitlab -m listrepo -c apiKey -u https://gitlab.something.local

Bitbucket Server

这将列出用户能看见的所有仓库。

SCMKit.exe -s bitbucket -m listrepo -c userName:password -u https://bitbucket.something.local

SCMKit.exe -s bitbucket -m listrepo -c apiKey -u https://bitbucket.something.local

示例输出```

C:>SCMKit.exe -s gitlab -m listrepo -c username:password -u https://gitlab.hogwarts.local

================================================== Module: listrepo System: gitlab Auth Type: Username/Password Options: Target URL: https://gitlab.hogwarts.local

Timestamp: 1/14/2022 8:30:47 PM

root@kitploit:~
                                Name | Visibility |                                                URL

root@kitploit:~
                        MaraudersMap |    Private | https://gitlab.hogwarts.local/hpotter/maraudersmap
                        testingStuff |   Internal | https://gitlab.hogwarts.local/adumbledore/testingstuff
                           Spellbook |   Internal |    https://gitlab.hogwarts.local/hpotter/spellbook
   findShortestPathToGryffindorSword |   Internal | https://gitlab.hogwarts.local/hpotter/findShortestPathToGryffindorSword
                              charms |     Public |      https://gitlab.hogwarts.local/hgranger/charms
                       Secret-Spells |   Internal | https://gitlab.hogwarts.local/adumbledore/secret-spells
                          Monitoring |   Internal | https://gitlab.hogwarts.local/gitlab-instance-10590c85/Monitoring
root@kitploit:~
### 搜索仓库

#### 使用场景

> *在特定的 SCM 系统中按仓库名称搜索仓库*

#### 语法

提供 `searchrepo` 模块以及 `-o` 命令行开关中的搜索条件,并附上相关的身份验证信息和 URL。这将输出匹配的仓库名称和 URL。

##### GitHub Enterprise

GitHub 仓库搜索是一种“包含”搜索,您输入的字符串将搜索名称包含搜索条件的仓库。

`SCMKit.exe -s github -m searchrepo -c userName:password -u https://github.something.local -o "some search term"`

`SCMKit.exe -s github -m searchrepo -c apikey -u https://github.something.local -o "some search term"`

##### GitLab Enterprise

GitLab 仓库搜索是一种“包含”搜索,您输入的字符串将搜索名称包含搜索条件的仓库。

`SCMKit.exe -s gitlab -m searchrepo -c userName:password -u https://gitlab.something.local -o "some search term"`

`SCMKit.exe -s gitlab -m searchrepo -c apikey -u https://gitlab.something.local -o "some search term"`

##### Bitbucket Server

Bitbucket 仓库搜索是一种“开头匹配”搜索,您输入的字符串将搜索名称以搜索条件开头的仓库。

`SCMKit.exe -s bitbucket -m searchrepo -c userName:password -u https://bitbucket.something.local -o "some search term"`

`SCMKit.exe -s bitbucket -m searchrepo -c apikey -u https://bitbucket.something.local -o "some search term"`

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m searchrepo -c apiKey -u https://gitlab.hogwarts.local -o "spell"

==================================================
Module:         searchrepo
System:         gitlab
Auth Type:      API Key
Options:        spell
Target URL:     https://gitlab.hogwarts.local

Timestamp:      1/14/2022 8:32:30 PM
==================================================

                                    Name | Visibility |                                                URL
----------------------------------------------------------------------------------------------------------
                               Spellbook |   Internal |    https://gitlab.hogwarts.local/hpotter/spellbook
                           Secret-Spells |   Internal | https://gitlab.hogwarts.local/adumbledore/secret-spells

搜索代码

用例

在特定的SCM系统中搜索包含给定关键词的代码

语法

在-o命令行开关中提供searchcode模块和搜索条件,以及相关的认证信息和URL。这将输出匹配代码文件的URL以及代码中匹配的行。

GitHub Enterprise

GitHub代码搜索是一种"包含"搜索,您输入的字符串将搜索包含搜索词的所有行中的代码。

SCMKit.exe -s github -m searchcode -c userName:password -u https://github.something.local -o "some search term"

SCMKit.exe -s github -m searchcode -c apikey -u https://github.something.local -o "some search term"

GitLab Enterprise

GitLab代码搜索是一种"包含"搜索,您输入的字符串将搜索包含搜索词的所有行中的代码。

SCMKit.exe -s gitlab -m searchcode -c userName:password -u https://gitlab.something.local -o "some search term"

SCMKit.exe -s gitlab -m searchcode -c apikey -u https://gitlab.something.local -o "some search term"

Bitbucket Server

Bitbucket代码搜索是一种"包含"搜索,您输入的字符串将搜索包含搜索词的所有行中的代码。

SCMKit.exe -s bitbucket -m searchcode -c userName:password -u https://bitbucket.something.local -o "some search term"

SCMKit.exe -s bitbucket -m searchcode -c apikey -u https://bitbucket.something.local -o "some search term"

示例输出```

C:>SCMKit.exe -s gitlab -m searchcode -c username:password -u https://gitlab.hogwarts.local -o "api_key"

================================================== Module: searchcode System: gitlab Auth Type: Username/Password Options: api_key Target URL: https://gitlab.hogwarts.local

Timestamp: 1/14/2022 8:34:14 PM

[>] URL: https://gitlab.hogwarts.local/adumbledore/secret-spells/stuff.txt |_ API_KEY=abc123

Total number of items matching code search: 1

root@kitploit:~
### 搜索文件

#### 使用场景

> *在特定 SCM 系统的仓库中,根据文件名中包含的关键字搜索文件*

#### 语法

在 `-o` 命令行开关中提供 `searchfile` 模块和搜索条件,以及相关的认证信息和 URL。这将输出匹配文件在其各自仓库中的 URL。

##### GitHub Enterprise

GitLab 文件搜索是“包含”搜索,您输入的字符串将搜索文件名中包含该搜索词的文件。

`SCMKit.exe -s github -m searchfile -c userName:password -u https://github.something.local -o "some search term"`

`SCMKit.exe -s github -m searchfile -c apikey -u https://github.something.local -o "some search term"`

##### GitLab Enterprise

GitLab 文件搜索是“包含”搜索,您输入的字符串将搜索文件名中包含该搜索词的文件。

`SCMKit.exe -s gitlab -m searchfile -c userName:password -u https://gitlab.something.local -o "some search term"`

`SCMKit.exe -s gitlab -m searchfile -c apikey -u https://gitlab.something.local -o "some search term"`

##### Bitbucket Server

Bitbucket 文件搜索是“包含”搜索,您输入的字符串将搜索文件名中包含该搜索词的文件。

`SCMKit.exe -s bitbucket -m searchfile -c userName:password -u https://bitbucket.something.local -o "some search term"`

`SCMKit.exe -s bitbucket -m searchfile -c apikey -u https://bitbucket.something.local -o "some search term"`

#### 示例输出```

C:\source\SCMKit\SCMKit\bin\Release>SCMKit.exe -s bitbucket -m searchfile -c apikey -u http://bitbucket.hogwarts.local:7990 -o jenkinsfile

==================================================
Module:         searchfile
System:         bitbucket
Auth Type:      API Key
Options:        jenkinsfile
Target URL:     http://bitbucket.hogwarts.local:7990

Timestamp:      1/14/2022 10:17:59 PM
==================================================


[>] REPO: http://bitbucket.hogwarts.local:7990/scm/~HPOTTER/hpotter
    [>] FILE: Jenkinsfile

[>] REPO: http://bitbucket.hogwarts.local:7990/scm/STUD/cred-decryption
    [>] FILE: subDir/Jenkinsfile

Total matching results: 2

列出代码片段

用例

列出当前用户在GitLab中拥有的代码片段

语法

提供listsnippet模块,以及任何相关的认证信息和URL。

GitLab Enterprise

SCMKit.exe -s gitlab -m listsnippet -c userName:password -u https://gitlab.something.local

SCMKit.exe -s gitlab -m listsnippet -c apikey -u https://gitlab.something.local

示例输出```

C:>SCMKit.exe -s gitlab -m listsnippet -c username:password -u https://gitlab.hogwarts.local

================================================== Module: listsnippet System: gitlab Auth Type: Username/Password Options: Target URL: https://gitlab.hogwarts.local

Timestamp: 1/14/2022 9:17:36 PM

root@kitploit:~
           Title |                                                                Raw URL

root@kitploit:~
    spell-script |                         https://gitlab.hogwarts.local/-/snippets/2/raw
root@kitploit:~
### 列出运行器

#### 使用场景

> *列出当前用户在 GitLab 中可用的所有 GitLab 运行器*

#### 语法

提供 `listrunner` 模块,以及任何相关的身份验证信息和 URL。如果用户是管理员,则可以列出 GitLab 企业实例中的所有运行器,包括共享运行器和组运行器。

##### GitLab 企业版

`SCMKit.exe -s gitlab -m listrunner -c userName:password -u https://gitlab.something.local`

`SCMKit.exe -s gitlab -m listrunner -c apikey -u https://gitlab.something.local`

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m listrunner -c username:password -u https://gitlab.hogwarts.local

==================================================
Module:         listrunner
System:         gitlab
Auth Type:      Username/Password
Options:
Target URL:     https://gitlab.hogwarts.local

Timestamp:      1/25/2022 11:40:08 AM
==================================================

   ID |                 Name |                                      Repo Assigned
---------------------------------------------------------------------------------
    2 |        gitlab-runner | https://gitlab.hogwarts.local/hpotter/spellbook.git
    3 |        gitlab-runner | https://gitlab.hogwarts.local/hpotter/maraudersmap.git
    

列出 Gist

用例

列出当前用户在 GitHub 上拥有的 Gist

语法

提供 listgist 模块,以及相关的身份验证信息和 URL。

GitHub Enterprise

SCMKit.exe -s github -m listgist -c userName:password -u https://github.something.local

SCMKit.exe -s github -m listgist -c apikey -u https://github.something.local

示例输出```

C:>SCMKit.exe -s github -m listgist -c username:password -u https://github-enterprise.hogwarts.local

================================================== Module: listgist System: github Auth Type: Username/Password Options: Target URL: https://github-enterprise.hogwarts.local

Timestamp: 1/14/2022 9:43:23 PM

root@kitploit:~
                         Description | Visibility |                                                URL

root@kitploit:~
        Shell Script to Decode Spell |     public | https://github-enterprise.hogwarts.local/gist/c11c6bb3f47fe67183d5bc9f048412a1
        
root@kitploit:~
### 列出组织

#### 用例

> 列出当前用户在 GitHub 中所属的所有组织

#### 语法

提供 `listorg` 模块,以及相关的认证信息和 URL。

##### GitHub Enterprise

`SCMKit.exe -s github -m listorg -c userName:password -u https://github.something.local`

`SCMKit.exe -s github -m listorg -c apiKey -u https://github.something.local`

#### 示例输出```

C:\>SCMKit.exe -s github -m listorg -c username:password -u https://github-enterprise.hogwarts.local

==================================================
Module:         listorg
System:         github
Auth Type:      Username/Password
Options:
Target URL:     https://github-enterprise.hogwarts.local

Timestamp:      1/14/2022 9:44:48 PM
==================================================

                          Name |                                                URL
-----------------------------------------------------------------------------------
                      Hogwarts | https://github-enterprise.hogwarts.local/api/v3/orgs/Hogwarts/repos
                      

Get Privileges of API Token

Use Case

获取在特定 SCM 系统中使用的访问令牌所分配的权限

Syntax

提供 privs 模块,以及 API 密钥和 URL。

GitHub Enterprise

SCMKit.exe -s github -m privs -c apiKey -u https://github.something.local

GitLab Enterprise

SCMKit.exe -s gitlab -m privs -c apiKey -u https://gitlab.something.local

Example Output```

C:>SCMKit.exe -s gitlab -m privs -c apikey -u https://gitlab.hogwarts.local

================================================== Module: privs System: gitlab Auth Type: API Key Options: Target URL: https://gitlab.hogwarts.local

Timestamp: 1/14/2022 9:18:27 PM

root@kitploit:~
      Token Name |    Active? |            Privilege |                                                            Description

hgranger-api-token | True | api | Read-write for the complete API, including all groups and projects, the Container Registry, and the Package Registry. hgranger-api-token | True | read_user | Read-only for endpoints under /users. Essentially, access to any of the GET requests in the Users API. hgranger-api-token | True | read_api | Read-only for the complete API, including all groups and projects, the Container Registry, and the Package Registry. hgranger-api-token | True | read_repository | Read-only (pull) for the repository through git clone. hgranger-api-token | True | write_repository | Read-write (pull, push) for the repository through git clone. Required for accessing Git repositories over HTTP when 2FA is enabled.

root@kitploit:~
### 添加管理员

#### 使用场景

> *将普通用户提升为特定SCM系统中的管理角色*

#### 语法

提供 `addadmin` 模块,以及相关的认证信息和URL。此外,提供您希望添加管理角色的目标用户。

##### GitHub Enterprise

`SCMKit.exe -s github -m addadmin -c userName:password -u https://github.something.local -o targetUserName`

`SCMKit.exe -s github -m addadmin -c apikey -u https://github.something.local -o targetUserName`

##### GitLab Enterprise

`SCMKit.exe -s gitlab -m addadmin -c userName:password -u https://gitlab.something.local -o targetUserName`

`SCMKit.exe -s gitlab -m addadmin -c apikey -u https://gitlab.something.local -o targetUserName`

##### Bitbucket Server

仅支持用户名/密码认证来执行与 Bitbucket 仓库或项目无关的操作。

`SCMKit.exe -s bitbucket -m addadmin -c userName:password -u https://bitbucket.something.local -o targetUserName`

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m addadmin -c apikey -u https://gitlab.hogwarts.local -o hgranger

==================================================
Module:         addadmin
System:         gitlab
Auth Type:      API Key
Options:        hgranger
Target URL:     https://gitlab.hogwarts.local

Timestamp:      1/14/2022 9:19:32 PM
==================================================


[+] SUCCESS: The hgranger user was successfully added to the admin role.

移除管理员

用例

将某个管理员用户降级为特定 SCM 系统中的普通用户角色

语法

提供 removeadmin 模块,以及相关的身份验证信息和 URL。此外,提供你想要移除管理员角色的目标用户。

GitHub Enterprise

SCMKit.exe -s github -m removeadmin -c userName:password -u https://github.something.local -o targetUserName

SCMKit.exe -s github -m removeadmin -c apikey -u https://github.something.local -o targetUserName

GitLab Enterprise

SCMKit.exe -s gitlab -m removeadmin -c userName:password -u https://gitlab.something.local -o targetUserName

SCMKit.exe -s gitlab -m removeadmin -c apikey -u https://gitlab.something.local -o targetUserName

Bitbucket Server

在 Bitbucket 中,执行与仓库或项目无关的操作仅支持用户名/密码认证。

SCMKit.exe -s bitbucket -m removeadmin -c userName:password -u https://bitbucket.something.local -o targetUserName

示例输出```

C:>SCMKit.exe -s gitlab -m removeadmin -c username:password -u https://gitlab.hogwarts.local -o hgranger

================================================== Module: removeadmin System: gitlab Auth Type: Username/Password Options: hgranger Target URL: https://gitlab.hogwarts.local

Timestamp: 1/14/2022 9:20:12 PM

[+] SUCCESS: The hgranger user was successfully removed from the admin role.

root@kitploit:~
### 创建访问令牌

#### 用例

> *创建一个用于特定SCM系统的访问令牌*

#### 语法

提供 `createpat` 模块,以及任何相关的身份验证信息和URL。此外,提供您要为其创建访问令牌的目标用户。

##### GitLab Enterprise

此操作只能由管理员执行。您需要提供要为其创建PAT的用户名。

`SCMKit.exe -s gitlab -m createpat -c userName:password -u https://gitlab.something.local -o targetUserName`

`SCMKit.exe -s gitlab -m createpat -c apikey -u https://gitlab.something.local -o targetUserName`

##### Bitbucket Server

为当前正在认证的用户创建PAT。在Bitbucket中,即使作为管理员,也不能为其他用户创建PAT。只有用户名/密码认证被支持,用于执行与Bitbucket仓库或项目无关的操作。请注意创建后显示的PAT ID。将来需要删除PAT时,将需要这个ID。

`SCMKit.exe -s bitbucket -m createpat -c userName:password -u https://bitbucket.something.local `

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m createpat -c username:password -u https://gitlab.hogwarts.local -o hgranger

==================================================
Module:         createpat
System:         gitlab
Auth Type:      Username/Password
Options:        hgranger
Target URL:     https://gitlab.hogwarts.local

Timestamp:      1/20/2022 1:51:23 PM
==================================================

   ID |         Name |                          Token
-----------------------------------------------------
   59 | SCMKIT-AaCND |           R3ySx_8HUn6UQ_6onETx

[+] SUCCESS: The hgranger user personal access token was successfully added.


列出访问令牌

用例

列出特定 SCM 系统上用户的访问令牌

语法

提供 listpat 模块以及相关的认证信息和 URL。

GitLab 企业版

仅当您想列出其他用户的 PAT 时才需要管理员权限。普通用户可以列出自己的 PAT。

SCMKit.exe -s gitlab -m listpat -c userName:password -u https://gitlab.something.local -o targetUser

SCMKit.exe -s gitlab -m listpat -c apikey -u https://gitlab.something.local -o targetUser

Bitbucket 服务器

列出当前用户的访问令牌。仅支持用户名/密码认证来执行与 Bitbucket 仓库或项目无关的操作。

SCMKit.exe -s bitbucket -m listpat -c userName:password -u https://bitbucket.something.local

列出其他用户的访问令牌(需要管理员权限)。仅支持用户名/密码认证来执行与 Bitbucket 仓库或项目无关的操作。

SCMKit.exe -s bitbucket -m listpat -c userName:password -u https://bitbucket.something.local -o targetUser

示例输出```

C:>SCMKit.exe -s gitlab -m listpat -c username:password -u https://gitlab.hogwarts.local -o hgranger

================================================== Module: listpat System: gitlab Auth Type: Username/Password Options: hgranger Target URL: https://gitlab.hogwarts.local

Timestamp: 1/20/2022 1:54:41 PM

ID | Name | Active? | Scopes

59 | SCMKIT-AaCND | True | api, read_repository, write_repository

root@kitploit:~
### 移除访问令牌

#### 用例

> *移除用户在特定 SCM 系统中的访问令牌*

#### 语法

提供 `removepat` 模块,以及任何相关的身份验证信息和 URL。此外,提供你想要移除访问令牌的目标用户 PAT ID。

##### GitLab 企业版

如果要移除其他用户的 PAT,仅需管理员权限。普通用户可以移除自己的 PAT。你必须提供要移除的 PAT ID。该 ID 在你创建 PAT 时显示,也在你列出 PAT 时显示。

`SCMKit.exe -s gitlab -m removepat -c userName:password -u https://gitlab.something.local -o patID`

`SCMKit.exe -s gitlab -m removepat -c apikey -u https://gitlab.something.local -o patID`

##### Bitbucket 服务器

仅支持用户名/密码身份验证来执行 Bitbucket 中与仓库或项目无关的操作。你必须提供要移除的 PAT ID。该 ID 在你创建 PAT 时显示。

`SCMKit.exe -s bitbucket -m removepat -c userName:password -u https://bitbucket.something.local -o patID`

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m removepat -c apikey -u https://gitlab.hogwarts.local -o 58

==================================================
Module:         removepat
System:         gitlab
Auth Type:      API Key
Options:        59
Target URL:     https://gitlab.hogwarts.local

Timestamp:      1/20/2022 1:56:47 PM
==================================================



[*] INFO: Revoking personal access token of ID: 59


[+] SUCCESS: The personal access token of ID 59 was successfully revoked.

创建 SSH 密钥

使用场景

为特定 SCM 系统创建 SSH 密钥

语法

提供 createsshkey 模块及相关认证信息和 URL.

GitHub 企业版

为当前认证用户创建 SSH 密钥。

SCMKit.exe -s github -m createsshkey -c userName:password -u https://github.something.local -o "ssh public key"

SCMKit.exe -s github -m createsshkey -c apiToken -u https://github.something.local -o "ssh public key"

GitLab 企业版

为当前认证用户创建 SSH 密钥。请注意创建后显示的 SSH 密钥 ID。将来需要移除该 SSH 密钥时,你将需要这个 ID。

SCMKit.exe -s gitlab -m createsshkey -c userName:password -u https://gitlab.something.local -o "ssh public key"

SCMKit.exe -s gitlab -m createsshkey -c apiToken -u https://gitlab.something.local -o "ssh public key"

Bitbucket 服务器

为当前认证用户创建 SSH 密钥。在 Bitbucket 中,只有用户名/密码认证支持执行与仓库或项目无关的操作。请注意创建后显示的 SSH 密钥 ID。将来需要移除该 SSH 密钥时,你将需要这个 ID。

SCMKit.exe -s bitbucket -m createsshkey -c userName:password -u https://bitbucket.something.local -o "ssh public key"

示例输出```

C:>SCMKit.exe -s bitbucket -m createsshkey -c username:password -u https://bitbucket.hogwarts.local -o "ssh-rsa..."

================================================== Module: createsshkey System: bitbucket Auth Type: Username/Password Options: ssh-rsa ... Target URL: http://bitbucket.hogwarts.local:7990

Timestamp: 2/7/2022 1:02:31 PM

SSH Key ID

root@kitploit:~
      16

[+] SUCCESS: The hpotter user SSH key was successfully added.

root@kitploit:~
### 列出 SSH 密钥

#### 使用场景

> *列出特定 SCM 系统上某个用户的 SSH 密钥*

#### 语法

提供 `listsshkey` 模块,以及任何相关的认证信息和 URL。

##### GitHub Enterprise

列出当前用户的 SSH 密钥。这将包括 SSH 密钥的 ID,当您想要移除 SSH 密钥时需要用到。

`SCMKit.exe -s github -m listsshkey -c userName:password -u https://github.something.local`

`SCMKit.exe -s github -m listsshkey -c apiToken -u https://github.something.local`

##### GitLab Enterprise

列出当前用户的 SSH 密钥。

`SCMKit.exe -s gitlab -m listsshkey -c userName:password -u https://gitlab.something.local`

`SCMKit.exe -s gitlab -m listsshkey -c apiToken -u https://gitlab.something.local`

##### Bitbucket Server

列出当前用户的 SSH 密钥。Bitbucket 中仅支持用户名/密码认证来执行与仓库或项目无关的操作。

`SCMKit.exe -s bitbucket -m listsshkey -c userName:password -u https://bitbucket.something.local`

#### 示例输出```

C:\>SCMKit.exe -s gitlab -m listsshkey -u http://gitlab.hogwarts.local -c apiToken

==================================================
Module:         listsshkey
System:         gitlab
Auth Type:      API Key
Options:
Target URL:     https://gitlab.hogwarts.local

Timestamp:      2/7/2022 4:09:40 PM
==================================================

  SSH Key ID |             SSH Key Value |                Title
---------------------------------------------------------------
           9 | .....p50edigBAF4lipVZkAM= |         SCMKIT-RLzie
          10 | .....vGJLPGHiTwIxW9i+xAs= |         SCMKIT-muFGU
    

移除 SSH 密钥

用例

为某个 SCM 系统中的用户移除 SSH 密钥

语法

提供 removesshkey 模块,以及相关的认证信息和 URL。此外,还需要提供要移除的目标用户 SSH 密钥 ID。

GitHub Enterprise

你必须提供要移除的 SSH 密钥 ID。该 ID 在列出 SSH 密钥时会显示。

SCMKit.exe -s github -m removesshkey -c userName:password -u https://github.something.local -o sshKeyID

SCMKit.exe -s github -m removesshkey -c apiToken -u https://github.something.local -o sshKeyID

GitLab Enterprise

你必须提供要移除的 SSH 密钥 ID。该 ID 在创建 SSH 密钥时显示,并且在列出 SSH 密钥时也会显示。

SCMKit.exe -s gitlab -m removesshkey -c userName:password -u https://gitlab.something.local -o sshKeyID

SCMKit.exe -s gitlab -m removesshkey -c apiToken -u https://gitlab.something.local -o sshKeyID

Bitbucket Server

在 Bitbucket 中执行与仓库或项目无关的操作时,仅支持用户名/密码认证。你必须提供要移除的 SSH 密钥 ID。该 ID 在创建 SSH 密钥时显示,并且在列出 SSH 密钥时也会显示。

SCMKit.exe -s bitbucket -m removesshkey -c userName:password -u https://bitbucket.something.local -o sshKeyID

示例输出```

C:>SCMKit.exe -s bitbucket -m removesshkey -u http://bitbucket.hogwarts.local:7990 -c username:password -o 16

================================================== Module: removesshkey System: bitbucket Auth Type: Username/Password Options: 16 Target URL: http://bitbucket.hogwarts.local:7990

Timestamp: 2/7/2022 1:48:03 PM

[+] SUCCESS: The SSH key of ID 16 was successfully revoked.

root@kitploit:~
### 列出管理员统计信息

#### 用例

> *在 GitHub Enterprise 中列出管理员统计信息*

#### 语法

提供 `adminstats` 模块,以及任何相关的认证信息和 URL。使用此模块需要在 GitHub Enterprise 中具有站点管理员权限。

##### GitHub Enterprise

`SCMKit.exe -s github -m adminstats -c userName:password -u https://github.something.local`

`SCMKit.exe -s github -m adminstats -c apikey -u https://github.something.local`

#### 示例输出```

C:\>SCMKit.exe -s github -m adminstats -c username:password -u https://github-enterprise.hogwarts.local

==================================================
Module:         adminstats
System:         github
Auth Type:      Username/Password
Options:
Target URL:     https://github-enterprise.hogwarts.local

Timestamp:      1/14/2022 9:45:50 PM
==================================================

     Admin Users |  Suspended Users |      Total Users
------------------------------------------------------
               1 |                0 |                5


     Total Repos |      Total Wikis
-----------------------------------
               4 |                0


      Total Orgs |   Total Team Members |      Total Teams
----------------------------------------------------------
               1 |                    0 |                0


   Private Gists |     Public Gists
-----------------------------------
               0 |                1
               

列出分支保护

使用场景

列出 GitHub Enterprise 中的分支保护

语法

提供 protection 模块,以及相关的认证信息和 URL。可选地,在参数中提供一个字符串,以返回包含该字符串的仓库名称中的匹配结果。

GitHub Enterprise

SCMKit.exe -s github -m protection -c userName:password -u https://github.something.local

SCMKit.exe -s github -m protection -c apikey -u https://github.something.local

SCMKit.exe -s github -m protection -c apikey -u https://github.something.local -o reponame

示例输出```

C:>.\SCMKit.exe -u http://github.hogwarts.local -s github -c apiToken -m protection -o public-r

================================================== Module: protection System: github Auth Type: API Key Options: public-r Target URL: http://github.hogwarts.local

Timestamp: 8/29/2022 2:02:42 PM

root@kitploit:~
                 Repo |                    Branch |                                         Protection

root@kitploit:~
          public-repo |                       dev | Protected: True
                                                    Status checks must pass before merge:
                                                      Branch must be up-to-date before merge: True
                                                    Owner review required before merge: True
                                                    Approvals required before merge: 2
                                                    Protections apply to repo admins: True
          public-repo |                      main | Protected: False
root@kitploit:~
## 检测

以下是该工具在默认状态下具体使用的静态签名:

* 项目GUID - `{266C644A-69B1-426B-A47C-1CF32B211F80}`
  * 请参见本仓库中的[SCMKit Yara规则](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.yar)。
* 用户代理字符串 - `SCMKIT-5dc493ada400c79dd318abbe770dac7c`
  * 请参见本仓库中的[SCMKit Snort规则](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.rules)。
* 访问令牌和SSH密钥名称 - 使用该工具创建的访问令牌和SSH密钥,其名称均以`SCMKIT-`为前缀。

有关该工具所用技术的检测指导,请参见X-Force Red的[博客文章](https://securityintelligence.com/posts/abusing-source-code-management-systems)。

## 参考文献
* Bitbucket API 文档
  * https://developer.atlassian.com/server/bitbucket/reference/rest-api/
* Octokit 文档
  * https://octokitnet.readthedocs.io/en/latest/
  * https://github.com/octokit/octokit.net
* GitHub API 文档
  * https://docs.github.com/en/rest/overview
* GitLab API 文档
  * https://docs.gitlab.com/ee/api/api_resources.html
* GitLabApiClient Nuget 包文档
  * https://github.com/nmklotas/GitLabApiClient
下载工具
库URL许可证
Octokithttps://github.com/octokit/octokit.netMIT 许可证
Fodyhttps://github.com/Fody/FodyMIT 许可证
GitLabApiClienthttps://github.com/nmklotas/GitLabApiClientMIT 许可证
Newtonsoft.Jsonhttps://github.com/JamesNK/Newtonsoft.JsonMIT 许可证
攻击场景模块需要管理员?GitHub EnterpriseGitLab EnterpriseBitbucket Server
侦察listrepo否XXX
侦察searchrepo否XXX
侦察searchcode否XXX
侦察searchfile否XXX
侦察listsnippet否X
侦察listrunner否X
侦察listgist否X
侦察listorg否X
侦察privs否XX
侦察protection否X
持久化listsshkey否XXX
持久化removesshkey否XXX
持久化createsshkey否XXX
持久化listpat否XX
持久化removepat否XX
持久化createpat是(仅 GitLab Enterprise)XX
权限提升addadmin是XXX
权限提升removeadmin是XXX
侦察adminstats是X