
Kit de herramientas de ataque para gestión de código fuente
Source Code Management Attack Toolkit - SCMKit es un conjunto de herramientas que se puede utilizar para atacar sistemas SCM. SCMKit permite al usuario especificar el sistema SCM y el módulo de ataque a utilizar, junto con la especificación de credenciales válidas (nombre de usuario/contraseña o clave API) para el sistema SCM correspondiente. Actualmente, los sistemas SCM que admite SCMKit son GitHub Enterprise, GitLab Enterprise y Bitbucket Server. Los módulos de ataque compatibles incluyen reconocimiento, escalada de privilegios y persistencia. SCMKit se construyó de forma modular, para que la comunidad de seguridad de la información pueda agregar nuevos módulos y sistemas SCM en el futuro.
Las siguientes bibliotecas de terceros se utilizan en este proyecto.
Siga los pasos siguientes para configurar Visual Studio y compilar el proyecto usted mismo. Esto requiere una biblioteca .NET que se puede instalar desde el administrador de paquetes NuGet.
https://api.nuget.org/v3/index.jsonInstall-Package Costura.Fody -Version 3.3.3Install-Package OctokitInstall-Package GitLabApiClientInstall-Package Newtonsoft.JsonLa siguiente tabla muestra dónde es compatible cada módulo
Descubrir repositorios utilizados en un sistema SCM particular
Proporcione el módulo listrepo, junto con la información de autenticación relevante y la URL. Esto mostrará el nombre del repositorio y la URL.
Esto listará todos los repositorios que un usuario puede 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
Esto listará todos los repositorios que un usuario puede 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
Esto listará todos los repositorios que un usuario puede 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
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
Name | Visibility | URL
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
### Buscar Repositorios
#### Caso de Uso
> *Buscar repositorios por nombre de repositorio en un sistema SCM específico*
#### Sintaxis
Proporcione el módulo `searchrepo` y sus criterios de búsqueda en el interruptor de línea de comandos `-o`, junto con cualquier información de autenticación y URL relevante. Esto mostrará el nombre y la URL del repositorio coincidente.
##### GitHub Enterprise
La búsqueda de repositorios de GitHub es una búsqueda de "contiene" donde la cadena que ingrese buscará repositorios con nombres que contengan su término de búsqueda.
`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
La búsqueda de repositorios de GitLab es una búsqueda de "contiene" donde la cadena que ingrese buscará repositorios con nombres que contengan su término de búsqueda.
`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
La búsqueda de repositorios de Bitbucket es una búsqueda de "comienza con" donde la cadena que ingrese buscará repositorios con nombres que comiencen con su término de búsqueda.
`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"`
#### Ejemplo de Salida```
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
Buscar código que contenga una palabra clave determinada en un sistema SCM específico
Proporcione el módulo searchcode y sus criterios de búsqueda en el interruptor de línea de comandos -o, junto con cualquier información de autenticación relevante y URL. Esto mostrará la URL del archivo de código coincidente, junto con la línea del código que coincidió.
La búsqueda de código de GitHub es una búsqueda de "contiene" donde la cadena que ingresa buscará código que contenga su término de búsqueda en cualquier línea.
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"
La búsqueda de código de GitLab es una búsqueda de "contiene" donde la cadena que ingresa buscará código que contenga su término de búsqueda en cualquier línea.
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"
La búsqueda de código de Bitbucket es una búsqueda de "contiene" donde la cadena que ingresa buscará código que contenga su término de búsqueda en cualquier línea.
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
[>] URL: https://gitlab.hogwarts.local/adumbledore/secret-spells/stuff.txt |_ API_KEY=abc123
Total number of items matching code search: 1
### Buscar Archivos
#### Caso de uso
> *Buscar archivos en repositorios que contengan una palabra clave determinada en el nombre del archivo en un sistema SCM específico*
#### Sintaxis
Proporcione el módulo `searchfile` y sus criterios de búsqueda en el interruptor de línea de comandos `-o`, junto con cualquier información de autenticación relevante y la URL. Esto generará la URL del archivo coincidente en su repositorio respectivo.
##### GitHub Enterprise
La búsqueda de archivos de GitLab es una búsqueda de "contiene" donde la cadena que ingrese buscará archivos que contengan su término de búsqueda en el nombre del archivo.
`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
La búsqueda de archivos de GitLab es una búsqueda de "contiene" donde la cadena que ingrese buscará archivos que contengan su término de búsqueda en el nombre del archivo.
`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
La búsqueda de archivos de Bitbucket es una búsqueda de "contiene" donde la cadena que ingrese buscará archivos que contengan su término de búsqueda en el nombre del archivo.
`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"`
#### Ejemplo de salida```
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 propiedad del usuario actual en GitLab
Proporcione el módulo listsnippet, junto con cualquier información de autenticación relevante y la URL.
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
Title | Raw URL
spell-script | https://gitlab.hogwarts.local/-/snippets/2/raw
### Listar Runners
#### Caso de uso
> *Listar todos los runners de GitLab disponibles para el usuario actual en GitLab*
#### Sintaxis
Proporcione el módulo `listrunner`, junto con cualquier información de autenticación y URL relevante. Si el usuario es administrador, podrá listar todos los runners dentro de la instancia de GitLab Enterprise, que incluye runners compartidos y 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`
#### Ejemplo de salida```
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
Lista los gists propiedad del usuario actual en GitHub
Proporcione el módulo listgist, junto con cualquier información de autenticación relevante y URL.
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
Description | Visibility | URL
Shell Script to Decode Spell | public | https://github-enterprise.hogwarts.local/gist/c11c6bb3f47fe67183d5bc9f048412a1
### Listar Organizaciones
#### Caso de Uso
> *Listar todas las organizaciones a las que pertenece el usuario actual en GitHub*
#### Sintaxis
Proporcione el módulo `listorg`, junto con cualquier información de autenticación y URL relevante.
##### 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`
#### Ejemplo de Salida```
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
Obtener los privilegios asignados a un token de acceso que se está utilizando en un sistema SCM particular
Proporcione el módulo privs, junto con una clave API y una URL.
SCMKit.exe -s github -m privs -c apiKey -u https://github.something.local
SCMKit.exe -s gitlab -m privs -c apiKey -u https://gitlab.something.local
PS C:\> .\SCMKit.exe -s gitlab -m privs -c abc123 -u https://gitlab.example.com
[+] Token Privileges:
- api
- read_user
- read_repository
- write_repository
- read_registry
- sudo
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
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.
### Añadir Administrador
#### Caso de Uso
> *Promover un usuario normal a un rol de administrador en un sistema SCM específico*
#### Sintaxis
Proporcione el módulo `addadmin`, junto con cualquier información de autenticación relevante y la URL. Además, proporcione el usuario objetivo al que desea añadir un rol de administrador.
##### 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
Solo se admite la autenticación de nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket.
`SCMKit.exe -s bitbucket -m addadmin -c userName:password -u https://bitbucket.something.local -o targetUserName`
#### Ejemplo de Salida```
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.
Degradar a un usuario administrativo a un rol de usuario normal en un sistema SCM específico
Proporcione el módulo removeadmin, junto con cualquier información de autenticación relevante y la URL. Además, proporcione el usuario objetivo del que desea eliminar un rol administrativo.
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
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
Solo se admite la autenticación de nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en 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
[+] SUCCESS: The hgranger user was successfully removed from the admin role.
### Crear Token de Acceso
#### Caso de Uso
> *Crear un token de acceso para ser usado en un sistema SCM específico*
#### Sintaxis
Proporcione el módulo `createpat`, junto con cualquier información de autenticación relevante y URL. Además, proporcione el usuario objetivo para el cual desea crear un token de acceso.
##### GitLab Enterprise
Esto solo puede ser realizado por un administrador. Proporcione el nombre de usuario para el cual desea crear un 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
Crea un PAT para el usuario actual que se autentica. En Bitbucket no se puede crear un PAT para otro usuario, incluso siendo administrador. Solo se admite autenticación con nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket. Anote el ID del PAT que se muestra después de crearlo. Lo necesitará cuando deba eliminar el PAT en el futuro.
`SCMKit.exe -s bitbucket -m createpat -c userName:password -u https://bitbucket.something.local `
#### Salida de Ejemplo```
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 acceso para un usuario en un sistema SCM particular
Proporcione el módulo listpat, junto con cualquier información de autenticación relevante y la URL.
Solo requiere administrador si desea listar los PAT de otro usuario. Un usuario normal puede listar sus propios 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
Listar tokens de acceso para el usuario actual. Solo se admite la autenticación con nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket.
SCMKit.exe -s bitbucket -m listpat -c userName:password -u https://bitbucket.something.local
Listar tokens de acceso para otro usuario (requiere administrador). Solo se admite la autenticación con nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en 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
59 | SCMKIT-AaCND | True | api, read_repository, write_repository
### Eliminar Token de Acceso
#### Caso de Uso
> *Eliminar un token de acceso para un usuario en un sistema SCM específico*
#### Sintaxis
Proporcione el módulo `removepat`, junto con cualquier información de autenticación relevante y la URL. Además, proporcione el ID del PAT del usuario objetivo del que desea eliminar un token de acceso.
##### GitLab Enterprise
Solo requiere administrador si desea eliminar el PAT de otro usuario. Un usuario normal puede eliminar su propio PAT. Debe proporcionar el ID del PAT a eliminar. Este ID se mostraba al crear el PAT y también al listar los 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
Solo se admite autenticación con nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket. Debe proporcionar el ID del PAT a eliminar. Este ID se mostraba al crear el PAT.
`SCMKit.exe -s bitbucket -m removepat -c userName:password -u https://bitbucket.something.local -o patID`
#### Ejemplo de Salida```
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.
Crear una clave SSH para ser utilizada en un sistema SCM específico
Proporcione el módulo createsshkey, junto con cualquier información de autenticación relevante y la URL.
Crea una clave SSH para el usuario actual que se autentica.
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"
Crea una clave SSH para el usuario actual que se autentica. Tome nota del ID de la clave SSH que se muestra después de crearla. Lo necesitará cuando deba eliminar la clave SSH en el 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"
Crea una clave SSH para el usuario actual que se autentica. Solo se admite la autenticación por nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket. Tome nota del ID de la clave SSH que se muestra después de crearla. Lo necesitará cuando deba eliminar la clave SSH en el futuro.
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
16
[+] SUCCESS: The hpotter user SSH key was successfully added.
### Listar Claves SSH
#### Caso de Uso
> *Listar claves SSH para un usuario en un sistema SCM particular*
#### Sintaxis
Proporcione el módulo `listsshkey`, junto con cualquier información de autenticación relevante y la URL.
##### GitHub Enterprise
Lista las claves SSH para el usuario actual. Esto incluirá los IDs de las claves SSH, que son necesarios cuando se desea eliminar una clave 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
Lista las claves SSH para el usuario actual.
`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
Lista las claves SSH para el usuario actual. Solo se admite la autenticación con nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket.
`SCMKit.exe -s bitbucket -m listsshkey -c userName:password -u https://bitbucket.something.local`
#### Salida de Ejemplo```
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
Eliminar una clave SSH para un usuario en un sistema SCM particular
Proporcione el módulo removesshkey, junto con cualquier información de autenticación relevante y URL. Además, proporcione el ID de la clave SSH del usuario objetivo a eliminar.
Debe proporcionar el ID de la clave SSH a eliminar. Este ID se mostró siempre que enumera las claves 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
Debe proporcionar el ID de la clave SSH a eliminar. Este ID se mostró cuando creó la clave SSH y también se muestra al enumerar las claves 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
Solo se admite la autenticación de nombre de usuario/contraseña para realizar acciones no relacionadas con repositorios o proyectos en Bitbucket. Debe proporcionar el ID de la clave SSH a eliminar. Este ID se mostró cuando creó la clave SSH y también se muestra al enumerar las claves 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
[+] SUCCESS: The SSH key of ID 16 was successfully revoked.
### Estadísticas de Administrador (Listado)
#### Caso de Uso
> *Listar estadísticas de administrador en GitHub Enterprise*
#### Sintaxis
Proporcione el módulo `adminstats`, junto con cualquier información de autenticación relevante y URL. Se requiere acceso de administrador del sitio en 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`
#### Ejemplo de Salida```
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 las protecciones de ramas en GitHub Enterprise
Proporcione el módulo protection, junto con cualquier información de autenticación relevante y la URL. Opcionalmente, proporcione una cadena en el parámetro de opciones para devolver resultados coincidentes contenidos en nombres de repositorios.
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
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
## Detección
A continuación se presentan las firmas estáticas para el uso específico de esta herramienta en su estado predeterminado:
* GUID del proyecto - `{266C644A-69B1-426B-A47C-1CF32B211F80}`
* Consulte la [Regla Yara de SCMKit](https://github.com/h4wkst3r/scmkit/blob/HEAD/Detections/SCMKit.yar) en este repositorio.
* Cadena de User Agent - `SCMKIT-5dc493ada400c79dd318abbe770dac7c`
* Consulte la [Regla Snort de SCMKit](https://github.com/h4wkst3r/scmkit/blob/HEAD/Detections/SCMKit.rules) en este repositorio.
* Nombres de tokens de acceso y claves SSH - Los tokens de acceso y las claves SSH que se crean con la herramienta se anteponen con `SCMKIT-` para el nombre.
Para obtener orientación sobre la detección de las técnicas utilizadas por la herramienta, consulte la [publicación del blog](https://securityintelligence.com/posts/abusing-source-code-management-systems) de X-Force Red.
## Referencias
* Documentación de la API de Bitbucket
* https://developer.atlassian.com/server/bitbucket/reference/rest-api/
* Documentación de Octokit
* https://octokitnet.readthedocs.io/en/latest/
* https://github.com/octokit/octokit.net
* Documentación de la API de GitHub
* https://docs.github.com/en/rest/overview
* Documentación de la API de GitLab
* https://docs.gitlab.com/ee/api/api_resources.html
* Documentación del paquete Nuget GitLabApiClient
* https://github.com/nmklotas/GitLabApiClient
| Biblioteca | URL | Licencia |
|---|
| Octokit | https://github.com/octokit/octokit.net | Licencia MIT |
| Fody | https://github.com/Fody/Fody | Licencia MIT |
| GitLabApiClient | https://github.com/nmklotas/GitLabApiClient | Licencia MIT |
| Newtonsoft.Json | https://github.com/JamesNK/Newtonsoft.Json | Licencia MIT |
| Escenario de ataque | Módulo | ¿Requiere admin? | GitHub Enterprise | GitLab Enterprise | Bitbucket Server |
|---|
| Reconocimiento | listrepo | No | X | X | X |
| Reconocimiento | searchrepo | No | X | X | X |
| Reconocimiento | searchcode | No | X | X | X |
| Reconocimiento | searchfile | No | X | X | X |
| Reconocimiento | listsnippet | No | X | ||
| Reconocimiento | listrunner | No | X | ||
| Reconocimiento | listgist | No | X | ||
| Reconocimiento | listorg | No | X | ||
| Reconocimiento | privs | No | X | X | |
| Reconocimiento | protection | No | X | ||
| Persistencia | listsshkey | No | X | X | X |
| Persistencia | removesshkey | No | X | X | X |
| Persistencia | createsshkey | No | X | X | X |
| Persistencia | listpat | No | X | X | |
| Persistencia | removepat | No | X | X | |
| Persistencia | createpat | Sí (solo GitLab Enterprise) | X | X | |
| Escalada de privilegios | addadmin | Sí | X | X | X |
| Escalada de privilegios | removeadmin | Sí | X | X | X |
| Reconocimiento | adminstats | Sí | X |