Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
SCMKit — Ferramenta de Ataque para Gerenciamento de Código Fonte | Kitploit
Ferramentas/GitHubGitHub/h4wkst3r/scmkit
Escalada de PrivilégiosReconhecimentoMecanismos de PersistênciaTestes de PenetraçãoRed Teaming
GitHubh4wkst3r/scmkit

SCMKit

Ferramenta de Ataque para Gerenciamento de Código Fonte

Ver Repositório
229541há 3 anosRevisado pelo Kitploit

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar

SCMKit

Descrição

Source Code Management Attack Toolkit - SCMKit é um kit de ferramentas que pode ser usado para atacar sistemas SCM. O SCMKit permite ao usuário especificar o sistema SCM e o módulo de ataque a ser usado, além de especificar credenciais válidas (nome de usuário/senha ou chave de API) para o respectivo sistema SCM. Atualmente, os sistemas SCM suportados pelo SCMKit são GitHub Enterprise, GitLab Enterprise e Bitbucket Server. Os módulos de ataque suportados incluem reconhecimento, escalonamento de privilégios e persistência. O SCMKit foi construído de forma modular, para que novos módulos e sistemas SCM possam ser adicionados no futuro pela comunidade de segurança da informação.

Lançamento

  • A versão 1.2 do SCMKit pode ser encontrada em Releases

Índice

  • SCMKit
  • Índice
  • Instalação/Compilação
    • Bibliotecas Utilizadas
    • Pré-Compilado
    • Compilação Manual
  • Uso
    • Argumentos/Opções
    • Sistemas
    • Módulos
    • Tabela de Detalhes dos Módulos
  • Exemplos
    • Listar Repositórios
    • Pesquisar Repositórios
    • Pesquisar Código
    • Pesquisar Arquivos
    • Listar Snippets
    • Listar Runners
    • Listar Gists
    • Listar Orgs
    • Obter Privilégios da Chave de API
    • Adicionar Administrador
    • Remover Administrador
    • Criar Token de Acesso
    • Listar Tokens de Acesso
    • Remover Token de Acesso
    • Criar Chave SSH
    • Listar Chaves SSH
    • Remover Chave SSH
    • Listar Estatísticas de Admin
    • Listar Proteção de Branch

Instalação/Compilação

Bibliotecas Utilizadas

As seguintes bibliotecas de terceiros são usadas neste projeto.

Pré-Compilado

  • Use o binário pré-compilado em Releases

Compilação Manual

Siga as etapas abaixo para configurar o Visual Studio e compilar o projeto você mesmo. Isso requer uma biblioteca .NET que pode ser instalada a partir do gerenciador de pacotes NuGet.

  • Carregue o projeto do Visual Studio e vá em "Tools" --> "NuGet Package Manager" --> "Package Manager Settings"
  • Vá em "NuGet Package Manager" --> "Package Sources"
  • Adicione uma origem de pacote com a URL https://api.nuget.org/v3/index.json
  • Instale os seguintes pacotes NuGet
    • Install-Package Costura.Fody -Version 3.3.3
    • Install-Package Octokit
    • Install-Package GitLabApiClient
    • Install-Package Newtonsoft.Json
  • Agora você pode compilar o projeto você mesmo!

Uso

Argumentos/Opções

  • -c, -credential - credencial para autenticação (username:password ou apiKey)
  • -s, -system - sistema a atacar (github, gitlab, bitbucket)
  • -u, -url - URL do GitHub Enterprise, GitLab Enterprise ou Bitbucket Server
  • -m, -module - módulo a executar
  • -o, -option - opções (quando aplicável)

Sistemas (-s, -system)

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

Módulos (-m, -module)

  • listrepo: listar todos os repositórios que o usuário atual pode ver
  • searchrepo: pesquisar um repositório específico
  • searchcode: pesquisar código contendo termo de pesquisa
  • searchfile: pesquisar nome de arquivo contendo termo de pesquisa
  • listsnippet: listar todos os snippets do usuário atual
  • listrunner: listar todos os runners do GitLab disponíveis para o usuário atual
  • listgist: listar todos os gists do usuário atual
  • listorg: listar todas as organizações a que o usuário atual pertence
  • privs: obter privilégios do token de API atual
  • addadmin: promover determinado usuário ao cargo de administrador
  • removeadmin: rebaixar determinado usuário do cargo de administrador
  • createpat: criar token de acesso pessoal para o usuário alvo
  • listpat: listar tokens de acesso pessoal de um usuário alvo
  • removepat: remover token de acesso pessoal de um usuário alvo
  • createsshkey: criar chave SSH para o usuário atual
  • listsshkey: listar chaves SSH do usuário atual
  • removesshkey: remover chave SSH do usuário atual
  • adminstats: obter estatísticas de administrador (usuários, repositórios, organizações, gists)
  • protection: obter configurações de proteção de branch

Tabela de Detalhes dos Módulos

A tabela abaixo mostra onde cada módulo é suportado

Exemplos

Listar Repositórios

Caso de Uso

Descobrir repositórios em uso em um sistema SCM específico

Sintaxe

Forneça o módulo listrepo, juntamente com qualquer informação de autenticação relevante e URL. Isso exibirá o nome do repositório e a URL.

GitHub Enterprise

Isso listará todos os repositórios que um usuário pode ver.

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

Isso listará todos os repositórios que um usuário pode ver.

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

Isso listará todos os repositórios que um usuário pode ver.

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

Exemplo de Saída```

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:~
### Procurar Repositórios

#### Caso de Uso

> *Pesquisar repositórios pelo nome do repositório em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `searchrepo` e seus critérios de pesquisa no switch de linha de comando `-o`, juntamente com qualquer informação de autenticação relevante e URL. Isso exibirá o nome e URL do repositório correspondente.

##### GitHub Enterprise

A pesquisa de repositórios do GitHub é uma pesquisa "contém" onde a string que você insere pesquisará por repositórios com nomes que contenham seu termo de pesquisa.

`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

A pesquisa de repositórios do GitLab é uma pesquisa "contém" onde a string que você insere pesquisará por repositórios com nomes que contenham seu termo de pesquisa.

`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

A pesquisa de repositórios do Bitbucket é uma pesquisa "começa com" onde a string que você insere pesquisará por repositórios com nomes que comecem com seu termo de pesquisa.

`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"`

#### Exemplo de Saída```

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

Pesquisar Código

Caso de Uso

Pesquisar código contendo uma determinada palavra-chave em um sistema SCM específico

Sintaxe

Forneça o módulo searchcode e seus critérios de pesquisa no switch de linha de comando -o, juntamente com qualquer informação de autenticação relevante e URL. Isso gerará a URL para o arquivo de código correspondente, juntamente com a linha no código que correspondeu.

GitHub Enterprise

A pesquisa de código do GitHub é uma pesquisa "contém" onde a string que você insere irá pesquisar código que contenha seu termo de pesquisa em qualquer linha.

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

A pesquisa de código do GitLab é uma pesquisa "contém" onde a string que você insere irá pesquisar código que contenha seu termo de pesquisa em qualquer linha.

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

A pesquisa de código do Bitbucket é uma pesquisa "contém" onde a string que você insere irá pesquisar código que contenha seu termo de pesquisa em qualquer linha.

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"

Exemplo de Saída```

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:~
### Pesquisar Arquivos

#### Caso de Uso

> *Pesquisar por arquivos em repositórios que contenham uma palavra-chave específica no nome do arquivo em um determinado sistema SCM*

#### Sintaxe

Forneça o módulo `searchfile` e seus critérios de pesquisa na opção de linha de comando `-o`, juntamente com as informações de autenticação relevantes e URL. Isso irá gerar o URL para o arquivo correspondente em seu respectivo repositório.

##### GitHub Enterprise

A pesquisa de arquivos do GitLab é uma pesquisa do tipo "contém", onde a string que você inserir irá procurar por arquivos que contenham o seu termo de pesquisa no nome do arquivo.

`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

A pesquisa de arquivos do GitLab é uma pesquisa do tipo "contém", onde a string que você inserir irá procurar por arquivos que contenham o seu termo de pesquisa no nome do arquivo.

`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

A pesquisa de arquivos do Bitbucket é uma pesquisa do tipo "contém", onde a string que você inserir irá procurar por arquivos que contenham o seu termo de pesquisa no nome do arquivo.

`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"`

#### Exemplo de Saída```

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

Listar Snippets

Caso de Uso

Listar snippets de propriedade do usuário atual no GitLab

Sintaxe

Forneça o módulo listsnippet, juntamente com qualquer informação de autenticação relevante e 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

Exemplo de Saída```

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:~
### Listar Executores

#### Caso de Uso

> *Listar todos os executores do GitLab disponíveis para o usuário atual no GitLab*

#### Sintaxe

Forneça o módulo `listrunner`, juntamente com qualquer informação de autenticação relevante e URL. Se o usuário for um administrador, você poderá listar todos os executores na instância do GitLab Enterprise, que inclui executores compartilhados e de grupo.

##### GitLab Enterprise

`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`

#### Exemplo de Saída```

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
    

List Gists

Caso de Uso

Listar gists de propriedade do usuário atual no GitHub

Sintaxe

Forneça o módulo listgist, juntamente com quaisquer informações de autenticação e URL relevantes.

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

Exemplo de Saída```

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:~
### Listar Organizações

#### Caso de Uso

> *Lista todas as organizações às quais o usuário atual pertence no GitHub*

#### Sintaxe

Forneça o módulo `listorg`, juntamente com qualquer informação de autenticação relevante e 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`

#### Exemplo de Saída```

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
                      

Obter Privilégios do Token de API

Caso de Uso

Obter os privilégios atribuídos a um token de acesso sendo usado em um sistema SCM específico

Sintaxe

Forneça o módulo privs, juntamente com uma chave de API e 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

Exemplo de Saída```

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:~
### Adicionar Administrador

#### Caso de Uso

> *Promover um usuário normal para uma função administrativa em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `addadmin`, juntamente com quaisquer informações de autenticação relevantes e URL. Além disso, forneça o usuário alvo ao qual você deseja adicionar uma função administrativa.

##### 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

Apenas autenticação de nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket.

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

#### Exemplo de Saída```

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.

Remover Administrador

Caso de Uso

Rebaixar um usuário administrador para uma função de usuário normal em um sistema SCM específico

Sintaxe

Forneça o módulo removeadmin, juntamente com qualquer informação de autenticação relevante e URL. Além disso, forneça o usuário alvo do qual você deseja remover uma função administrativa.

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

Apenas a autenticação de nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket.

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

Exemplo de Saída```

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:~
### Criar Token de Acesso

#### Caso de Uso

> *Criar um token de acesso para ser usado em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `createpat`, juntamente com quaisquer informações de autenticação relevantes e URL. Além disso, forneça o usuário alvo para o qual você deseja criar um token de acesso.

##### GitLab Enterprise

Isso só pode ser feito como administrador. Você fornecerá o nome de usuário para o qual deseja criar um 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

Cria PAT para o usuário atual que está autenticando. No Bitbucket, você não pode criar um PAT para outro usuário, mesmo como administrador. Apenas autenticação por nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket. Anote o ID do PAT que é exibido após a criação. Você precisará dele quando precisar remover o PAT no futuro.

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

#### Exemplo de Saída

root@kitploit:~

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.


```
### Listar Tokens de Acesso

#### Caso de Uso

> *Listar tokens de acesso de um usuário em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `listpat`, juntamente com quaisquer informações de autenticação relevantes e URL.

##### GitLab Enterprise

Só requer administrador se você quiser listar os PATs de outro usuário. Um usuário comum pode listar seus próprios PATs.

`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 Server

Listar tokens de acesso do usuário atual. Apenas a autenticação de nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket.

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

Listar tokens de acesso de outro usuário (requer administrador). Apenas a autenticação de nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket.

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

#### Exemplo de Saída```

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
    
```
### Remover Token de Acesso

#### Caso de Uso

> *Remover um token de acesso para um utilizador num sistema SCM específico*

#### Sintaxe

Forneça o módulo `removepat`, juntamente com qualquer informação de autenticação relevante e URL. Além disso, forneça o ID do PAT do utilizador alvo para o qual pretende remover um token de acesso.

##### GitLab Enterprise

Apenas requer administrador se quiser remover o PAT de outro utilizador. Um utilizador normal pode remover o seu próprio PAT. Tem de fornecer o ID do PAT a remover. Este ID foi mostrado sempre que criou o PAT e também quando listou o 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 Server

Apenas a autenticação com nome de utilizador/palavra-passe é suportada para realizar ações não relacionadas com repositórios ou projetos no Bitbucket. Tem de fornecer o ID do PAT a remover. Este ID foi mostrado sempre que criou o PAT.

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

#### Exemplo de Saída```

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.

```
### Criar Chave SSH

#### Caso de Uso

> *Criar uma chave SSH para ser usada em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `createsshkey`, juntamente com quaisquer informações de autenticação relevantes e URL.

##### GitHub Enterprise

Cria chave SSH para o usuário atual autenticando como.

`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 Enterprise

Cria chave SSH para o usuário atual autenticando como. Anote o ID da chave SSH que é mostrado após a criação. Você precisará disso quando precisar remover a chave SSH no futuro.

`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 Server

Cria chave SSH para o usuário atual autenticando como. Apenas autenticação por nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket. Anote o ID da chave SSH que é mostrado após a criação. Você precisará disso quando precisar remover a chave SSH no futuro.

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

#### Exemplo de Saída```

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
------------
          16

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


```
### Listar Chaves SSH

#### Caso de Uso

> *Listar chaves SSH para um utilizador num determinado sistema SCM*

#### Sintaxe

Forneça o módulo `listsshkey`, juntamente com qualquer informação de autenticação e URL relevantes. 

##### GitHub Enterprise

Listar chaves SSH para o utilizador atual. Isto incluirá os IDs das chaves SSH, que são necessários quando se pretende remover uma chave 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

Listar chaves SSH para o utilizador atual.

`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

Listar chaves SSH para o utilizador atual. Apenas a autenticação por nome de utilizador/palavra-passe é suportada para realizar ações não relacionadas com repositórios ou projetos no Bitbucket.

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

#### Exemplo de Saída```

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
    
```
### Remover Chave SSH

#### Caso de Uso

> *Remover uma chave SSH para um usuário em um sistema SCM específico*

#### Sintaxe

Forneça o módulo `removesshkey`, juntamente com qualquer informação de autenticação relevante e URL. Além disso, forneça o ID da chave SSH do usuário alvo a ser removido.

##### GitHub Enterprise

Você deve fornecer o ID da chave SSH a ser removida. Este ID foi mostrado sempre que você lista as chaves 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

 Você deve fornecer o ID da chave SSH a ser removida. Este ID foi mostrado quando você criou a chave SSH e também é mostrado ao listar as chaves 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

Apenas a autenticação com nome de usuário/senha é suportada para realizar ações não relacionadas a repositórios ou projetos no Bitbucket. Você deve fornecer o ID da chave SSH a ser removida. Este ID foi mostrado quando você criou a chave SSH e também é mostrado ao listar as chaves SSH.

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

#### Exemplo de Saída```

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.

```
### Listar Estatísticas de Admin

#### Caso de Uso

> *Listar estatísticas de administrador no GitHub Enterprise*

#### Sintaxe

Forneça o módulo `adminstats`, juntamente com qualquer informação de autenticação relevante e URL. É necessário acesso de administrador do site no GitHub Enterprise para usar este módulo

##### 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`

#### Exemplo de Saída```

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
               
```
### Listar Proteção de Ramo

#### Caso de Uso

> *Listar proteções de ramo no GitHub Enterprise*

#### Sintaxe

Forneça o módulo `protection`, juntamente com qualquer informação de autenticação relevante e URL. Opcionalmente, forneça uma string no parâmetro de opções para retornar resultados correspondentes contidos nos nomes dos repositórios.

##### 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`

#### Exemplo de Saída```
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
==================================================

                     Repo |                    Branch |                                         Protection
----------------------------------------------------------------------------------------------------------
              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
```
## Detecção

Abaixo estão assinaturas estáticas para o uso específico desta ferramenta em seu estado padrão:

* GUID do Projeto - `{266C644A-69B1-426B-A47C-1CF32B211F80}`
  * Veja [Regra Yara do SCMKit](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.yar) neste repositório.
* String de User Agent - `SCMKIT-5dc493ada400c79dd318abbe770dac7c`
  * Veja [Regra Snort do SCMKit](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.rules) neste repositório.
* Nomes de Token de Acesso e Chave SSH - Tokens de acesso e chaves SSH criados usando a ferramenta são prefixados com `SCMKIT-` no nome.

Para orientação de detecção das técnicas usadas pela ferramenta, consulte a [postagem do blog](https://securityintelligence.com/posts/abusing-source-code-management-systems) da X-Force Red.

## Referências
* Documentação da API do Bitbucket
  * https://developer.atlassian.com/server/bitbucket/reference/rest-api/
* Documentação do Octokit
  * https://octokitnet.readthedocs.io/en/latest/
  * https://github.com/octokit/octokit.net
* Documentação da API do GitHub
  * https://docs.github.com/en/rest/overview
* Documentação da API do GitLab
  * https://docs.gitlab.com/ee/api/api_resources.html
* Documentação do Pacote Nuget GitLabApiClient
  * https://github.com/nmklotas/GitLabApiClient
Baixar ferramenta
BibliotecaURLLicença
Octokithttps://github.com/octokit/octokit.netMIT License
Fodyhttps://github.com/Fody/FodyMIT License
GitLabApiClienthttps://github.com/nmklotas/GitLabApiClientMIT License
Newtonsoft.Jsonhttps://github.com/JamesNK/Newtonsoft.JsonMIT License
Cenário de AtaqueMóduloRequer Admin?GitHub EnterpriseGitLab EnterpriseBitbucket Server
ReconhecimentolistrepoNãoXXX
ReconhecimentosearchrepoNãoXXX
ReconhecimentosearchcodeNãoXXX
ReconhecimentosearchfileNãoXXX
ReconhecimentolistsnippetNãoX
ReconhecimentolistrunnerNãoX
ReconhecimentolistgistNãoX
ReconhecimentolistorgNãoX
ReconhecimentoprivsNãoXX
ReconhecimentoprotectionNãoX
PersistêncialistsshkeyNãoXXX
PersistênciaremovesshkeyNãoXXX
PersistênciacreatesshkeyNãoXXX
PersistêncialistpatNãoXX
PersistênciaremovepatNãoXX
PersistênciacreatepatSim (apenas GitLab Enterprise)XX
Escalonamento de PrivilégiosaddadminSimXXX
Escalonamento de PrivilégiosremoveadminSimXXX
ReconhecimentoadminstatsSimX