Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
SCMKit — Toolkit di attacco per la gestione del codice sorgente | Kitploit
Strumenti/GitHubGitHub/h4wkst3r/scmkit
Escalation di PrivilegiRicognizioneMeccanismi di PersistenzaPenetration TestingRed Teaming
GitHubh4wkst3r/scmkit

SCMKit

Toolkit di attacco per la gestione del codice sorgente

Vedi Repository
2295413 anni faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

SCMKit

Descrizione

Source Code Management Attack Toolkit - SCMKit è un toolkit che può essere utilizzato per attaccare sistemi SCM. SCMKit permette all'utente di specificare il sistema SCM e il modulo di attacco da utilizzare, insieme alla specifica di credenziali valide (username/password o chiave API) per il rispettivo sistema SCM. Attualmente, i sistemi SCM supportati da SCMKit sono GitHub Enterprise, GitLab Enterprise e Bitbucket Server. I moduli di attacco supportati includono ricognizione, escalation dei privilegi e persistenza. SCMKit è stato costruito con un approccio modulare, in modo che nuovi moduli e sistemi SCM possano essere aggiunti in futuro dalla comunità della sicurezza informatica.

Rilasci

  • La versione 1.2 di SCMKit è disponibile nella sezione Releases

Indice dei contenuti

  • SCMKit
  • Indice dei contenuti
  • Installazione/Compilazione
    • Librerie utilizzate
    • Pre-compilato
    • Compilazione manuale
  • Utilizzo
    • Argomenti/Opzioni
    • Sistemi
    • Moduli
    • Tabella dei dettagli dei moduli
  • Esempi
    • Elenco repository
    • Ricerca repository
    • Ricerca codice
    • Ricerca file
    • Elenco snippet
    • Elenco runner
    • Elenco gist
    • Elenco organizzazioni
    • Ottenere privilegi del token API
    • Aggiungi amministratore
    • Rimuovi amministratore
    • Crea token di accesso
    • Elenco token di accesso
    • Rimuovi token di accesso
    • Crea chiave SSH
    • Elenco chiavi SSH
    • Rimuovi chiave SSH
    • Statistiche amministratore
    • Protezione rami
  • Rilevamento
  • Riferimenti

Installazione/Compilazione

Librerie utilizzate

Le seguenti librerie di terze parti sono utilizzate in questo progetto.

Pre-compilato

  • Usa il binario pre-compilato nella sezione Releases

Compilazione manuale

Segui i passaggi seguenti per configurare Visual Studio al fine di compilare il progetto da te. Ciò richiede una libreria .NET che può essere installata dal gestore pacchetti NuGet.

  • Carica il progetto di Visual Studio e vai su "Tools" --> "NuGet Package Manager" --> "Package Manager Settings"
  • Vai su "NuGet Package Manager" --> "Package Sources"
  • Aggiungi una fonte di pacchetti con l'URL https://api.nuget.org/v3/index.json
  • Installa i seguenti pacchetti NuGet
    • Install-Package Costura.Fody -Version 3.3.3
    • Install-Package Octokit
    • Install-Package GitLabApiClient
    • Install-Package Newtonsoft.Json
  • Ora puoi compilare il progetto da te!

Utilizzo

Argomenti/Opzioni

  • -c, -credential - credenziale per l'autenticazione (username:password o apiKey)
  • -s, -system - sistema da attaccare (github,gitlab,bitbucket)
  • -u, -url - URL per GitHub Enterprise, GitLab Enterprise o Bitbucket Server
  • -m, -module - modulo da eseguire
  • -o, -option - opzioni (quando applicabile)

Sistemi (-s, -system)

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

Moduli (-m, -module)

  • listrepo: elenca tutti i repository che l'utente corrente può vedere
  • searchrepo: cerca un repository specifico
  • searchcode: cerca codice contenente il termine di ricerca
  • searchfile: cerca file con nome contenente il termine di ricerca
  • listsnippet: elenca tutti gli snippet dell'utente corrente
  • listrunner: elenca tutti i runner GitLab disponibili per l'utente corrente
  • listgist: elenca tutti i gist dell'utente corrente
  • listorg: elenca tutte le organizzazioni a cui appartiene l'utente corrente
  • privs: ottieni i privilegi del token API corrente
  • addadmin: promuovi l'utente specificato al ruolo di amministratore
  • removeadmin: degrada l'utente specificato dal ruolo di amministratore
  • createpat: crea un personal access token per l'utente target
  • listpat: elenca i personal access token per un utente target
  • removepat: rimuovi un personal access token per un utente target
  • createsshkey: crea una chiave SSH per l'utente corrente
  • listsshkey: elenca le chiavi SSH per l'utente corrente
  • removesshkey: rimuovi una chiave SSH per l'utente corrente
  • adminstats: ottieni le statistiche amministratore (utenti, repository, organizzazioni, gist)
  • protection: ottieni le impostazioni di protezione dei rami

Tabella dei dettagli dei moduli

La tabella seguente mostra dove ogni modulo è supportato

Esempi

Elenco repository

Caso d'uso

Scoprire i repository utilizzati in un particolare sistema SCM

Sintassi

Fornisci il modulo listrepo, insieme alle informazioni di autenticazione pertinenti e all'URL. Verranno restituiti il nome del repository e l'URL.

GitHub Enterprise

Questo elencherà tutti i repository che un utente può vedere.

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

Questo elencherà tutti i repository che un utente può vedere.

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

Questo elencherà tutti i repository che un utente può vedere.

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

Output di esempio```

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:~
### Cerca Repository

#### Caso d'Uso

> *Cerca repository per nome del repository in un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `searchrepo` e i criteri di ricerca nell'opzione `-o` da riga di comando, insieme a tutte le informazioni di autenticazione e URL pertinenti. Questo restituirà il nome del repository corrispondente e l'URL.

##### GitHub Enterprise

La ricerca dei repository di GitHub è una ricerca "contiene" in cui la stringa che inserisci cercherà repository con nomi che contengono il tuo termine di ricerca.

`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 ricerca dei repository di GitLab è una ricerca "contiene" in cui la stringa che inserisci cercherà repository con nomi che contengono il tuo termine di ricerca.

`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 ricerca dei repository di Bitbucket è una ricerca "inizia con" in cui la stringa che inserisci cercherà repository con nomi che iniziano con il tuo termine di ricerca.

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

#### Output di Esempio```

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

Ricerca del Codice

Caso d'Uso

Ricerca di codice contenente una determinata parola chiave in uno specifico sistema SCM

Sintassi

Fornisci il modulo searchcode e i tuoi criteri di ricerca nell'opzione -o della riga di comando, insieme a eventuali informazioni di autenticazione e URL pertinenti. Questo restituirà l'URL del file di codice corrispondente, insieme alla riga del codice che corrisponde.

GitHub Enterprise

La ricerca del codice su GitHub è una ricerca "contiene" in cui la stringa inserita cercherà il codice che contiene il termine di ricerca in qualsiasi riga.

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

La ricerca del codice su GitLab è una ricerca "contiene" in cui la stringa inserita cercherà il codice che contiene il termine di ricerca in qualsiasi riga.

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

La ricerca del codice su Bitbucket è una ricerca "contiene" in cui la stringa inserita cercherà il codice che contiene il termine di ricerca in qualsiasi riga.

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"

Output di Esempio```

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:~
### Cerca file

#### Caso d'uso

> *Cerca file nei repository che contengono una parola chiave specificata nel nome del file in un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `searchfile` e i criteri di ricerca nell'opzione `-o` da riga di comando, insieme a eventuali informazioni di autenticazione e URL. Verrà restituito l'URL del file corrispondente nel suo repository.

##### GitHub Enterprise

La ricerca file di GitLab è una ricerca "contiene" in cui la stringa inserita cercherà file che contengono il termine di ricerca nel nome del file.

`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 ricerca file di GitLab è una ricerca "contiene" in cui la stringa inserita cercherà file che contengono il termine di ricerca nel nome del file.

`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 ricerca file di Bitbucket è una ricerca "contiene" in cui la stringa inserita cercherà file che contengono il termine di ricerca nel nome del file.

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

#### Esempio di output```

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

Elenca Snippet

Caso d'Uso

Elenca gli snippet posseduti dall'utente corrente in GitLab

Sintassi

Fornisci il modulo listsnippet, insieme a qualsiasi informazione di autenticazione rilevante 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

Output di Esempio```

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:~
### Elenca Runner

#### Caso d'Uso

> *Elenca tutti i runner GitLab disponibili per l'utente corrente in GitLab*

#### Sintassi

Fornisci il modulo `listrunner`, insieme a tutte le informazioni di autenticazione e URL pertinenti. Se l'utente è un amministratore, sarà possibile elencare tutti i runner all'interno dell'istanza GitLab Enterprise, inclusi i runner condivisi e di gruppo. 

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

#### Esempio di Output```

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
    

Elenco Gist

Caso d'uso

Elenco dei gist posseduti dall'utente corrente su GitHub

Sintassi

Fornisci il modulo listgist, insieme a tutte le informazioni di autenticazione e URL pertinenti.

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

Output di esempio```

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:~
### Elenca Org

#### Caso d'uso

> *Elenca tutte le organizzazioni di cui l'utente corrente è membro in GitHub*

#### Sintassi

Fornisci il modulo `listorg`, insieme a eventuali informazioni di autenticazione 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`

#### Output di esempio```

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
                      

Ottieni i privilegi del token API

Caso d'uso

Ottieni i privilegi assegnati a un token di accesso utilizzato in un particolare sistema SCM

Sintassi

Fornisci il modulo privs, insieme a una chiave API e un 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

Output di esempio```

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:~
### Aggiungi Amministratore

#### Caso d'Uso

> *Promuovi un utente normale a un ruolo amministrativo in un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `addadmin`, insieme a tutte le informazioni di autenticazione e l'URL pertinenti. Inoltre, fornisci l'utente target a cui desideri aggiungere un ruolo amministrativo.

##### 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 l'autenticazione con nome utente/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket.

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

#### Esempio di Output```

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.

Remove Admin

Caso d'Uso

Declassare un utente amministratore a un normale utente in un particolare sistema SCM

Sintassi

Fornisci il modulo removeadmin, insieme alle informazioni di autenticazione e all'URL pertinenti. Inoltre, specifica l'utente target a cui rimuovere il ruolo di amministratore.

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

Solo l'autenticazione con username/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket.

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

Esempio di Output```

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:~
### Creare un Token di Accesso

#### Caso d'Uso

> *Crea un token di accesso da utilizzare in un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `createpat`, insieme a eventuali informazioni di autenticazione e URL pertinenti. Inoltre, fornisci l'utente di destinazione per cui desideri creare un token di accesso.

##### GitLab Enterprise

Questa operazione può essere eseguita solo da un amministratore. Dovrai fornire il nome utente per cui desideri creare 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 per l'utente corrente che si sta autenticando. In Bitbucket non è possibile creare un PAT per un altro utente, nemmeno come amministratore. Solo l'autenticazione con nome utente/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket. Prendi nota dell'ID del PAT che viene mostrato dopo la creazione. Ti servirà quando dovrai rimuovere il PAT in futuro.

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

#### Output di Esempio```

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.


Elenca Token di Accesso

Caso d'Uso

Elenca i token di accesso per un utente su un particolare sistema SCM

Sintassi

Fornisci il modulo listpat, insieme alle informazioni di autenticazione pertinenti e all'URL.

GitLab Enterprise

Richiede l'admin solo se si vogliono elencare i PAT di un altro utente. Un utente normale può elencare i propri 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 Server

Elenca i token di accesso per l'utente corrente. Solo l'autenticazione con nome utente/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket.

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

Elenca i token di accesso per un altro utente (richiede admin). Solo l'autenticazione con nome utente/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket.

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

Output di Esempio```

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:~
### Rimuovi Token di Accesso

#### Caso d'Uso

> *Rimuovi un token di accesso per un utente in un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `removepat`, insieme a qualsiasi informazione di autenticazione rilevante e URL. Inoltre, fornisci l'ID PAT dell'utente target per cui desideri rimuovere un token di accesso.

##### GitLab Enterprise

Richiede solo l'admin se si desidera rimuovere il PAT di un altro utente. Un utente normale può rimuovere il proprio PAT. Devi fornire l'ID PAT da rimuovere. Questo ID veniva mostrato ogni volta che creavi il PAT e anche quando elencavi i 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 l'autenticazione username/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket. Devi fornire l'ID PAT da rimuovere. Questo ID veniva mostrato ogni volta che creavi il PAT.

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

#### Esempio di Output```

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.

Crea Chiave SSH

Caso d'Uso

Creare una chiave SSH da utilizzare in un particolare sistema SCM

Sintassi

Fornire il modulo createsshkey, insieme alle informazioni di autenticazione pertinenti e all'URL.

GitHub Enterprise

Crea una chiave SSH per l'utente corrente che si 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"

GitLab Enterprise

Crea una chiave SSH per l'utente corrente che si autentica. Prendi nota dell'ID della chiave SSH che viene mostrato dopo la creazione. Ti servirà quando dovrai rimuovere la chiave SSH in 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

Crea una chiave SSH per l'utente corrente che si autentica. Solo l'autenticazione con nome utente/password è supportata per eseguire azioni non relative ai repository o ai progetti in Bitbucket. Prendi nota dell'ID della chiave SSH che viene mostrato dopo la creazione. Ti servirà quando dovrai rimuovere la chiave SSH in futuro.

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

Output di Esempio```

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:~
### Elenca le chiavi SSH

#### Caso d'uso

> *Elenca le chiavi SSH per un utente su un particolare sistema SCM*

#### Sintassi

Fornisci il modulo `listsshkey`, insieme a qualsiasi informazione di autenticazione e URL pertinenti. 

##### GitHub Enterprise

Elenca le chiavi SSH per l'utente corrente. Questo includerà gli ID delle chiavi SSH, necessari quando si desidera rimuovere una chiave 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

Elenca le chiavi SSH per l'utente corrente.

`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

Elenca le chiavi SSH per l'utente corrente. Solo l'autenticazione con nome utente/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket.

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


#### Output di esempio```

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
    

Rimuovi chiave SSH

Caso d'uso

Rimuovi una chiave SSH per un utente in un particolare sistema SCM

Sintassi

Fornisci il modulo removesshkey, insieme a qualsiasi informazione di autenticazione e URL pertinenti. Inoltre, fornisci l'ID della chiave SSH dell'utente target da rimuovere.

GitHub Enterprise

Devi fornire l'ID della chiave SSH da rimuovere. Questo ID viene mostrato ogni volta che elenchi le chiavi 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

Devi fornire l'ID della chiave SSH da rimuovere. Questo ID viene mostrato ogni volta che crei la chiave SSH ed è anche mostrato quando elenchi le chiavi 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

Solo l'autenticazione username/password è supportata per eseguire azioni non relative a repository o progetti in Bitbucket. Devi fornire l'ID della chiave SSH da rimuovere. Questo ID viene mostrato ogni volta che crei la chiave SSH ed è anche mostrato quando elenchi le chiavi SSH.

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

Output di esempio```

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:~
### Elenca le statistiche di amministrazione

#### Caso d'uso

> *Elenca le statistiche di amministrazione in GitHub Enterprise*

#### Sintassi

Fornisci il modulo `adminstats`, insieme a qualsiasi informazione di autenticazione rilevante e URL. Per utilizzare questo modulo è richiesto l'accesso come amministratore del sito in 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`

#### Esempio di output```

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
               

Elenca Protezione Branch

Caso d'uso

Elenca le protezioni dei branch in GitHub Enterprise

Sintassi

Fornisci il modulo protection, insieme alle informazioni di autenticazione e all'URL pertinenti. Opzionalmente, fornisci una stringa nel parametro delle opzioni per restituire risultati corrispondenti contenuti nei nomi dei repo.

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

Esempio di Output```

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:~
## Rilevamento

Di seguito sono riportate le firme statiche per l'utilizzo specifico di questo strumento nel suo stato predefinito:

* GUID del progetto - `{266C644A-69B1-426B-A47C-1CF32B211F80}`
  * Vedi la [Regola Yara di SCMKit](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.yar) in questo repository.
* Stringa User Agent - `SCMKIT-5dc493ada400c79dd318abbe770dac7c`
  * Vedi la [Regola Snort di SCMKit](https://github.com/h4wkst3r/scmkit/blob/main/Detections/SCMKit.rules) in questo repository.
* Nomi dei token di accesso e delle chiavi SSH - I token di accesso e le chiavi SSH creati con lo strumento hanno il prefisso `SCMKIT-` nel nome.

Per una guida al rilevamento delle tecniche utilizzate dallo strumento, consulta l'[articolo del blog](https://securityintelligence.com/posts/abusing-source-code-management-systems) di X-Force Red.

## Riferimenti
* Documentazione API Bitbucket 
  * https://developer.atlassian.com/server/bitbucket/reference/rest-api/
* Documentazione Octokit
  * https://octokitnet.readthedocs.io/en/latest/
  * https://github.com/octokit/octokit.net
* Documentazione API GitHub
  * https://docs.github.com/en/rest/overview
* Documentazione API GitLab
  * https://docs.gitlab.com/ee/api/api_resources.html
* Documentazione del pacchetto Nuget GitLabApiClient
  * https://github.com/nmklotas/GitLabApiClient
Scarica lo strumento
LibreriaURLLicenza
Octokithttps://github.com/octokit/octokit.netLicenza MIT
Fodyhttps://github.com/Fody/FodyLicenza MIT
GitLabApiClienthttps://github.com/nmklotas/GitLabApiClientLicenza MIT
Newtonsoft.Jsonhttps://github.com/JamesNK/Newtonsoft.JsonLicenza MIT
Scenario di attaccoModuloRichiede Admin?GitHub EnterpriseGitLab EnterpriseBitbucket Server
RicognizionelistrepoNoXXX
RicognizionesearchrepoNoXXX
RicognizionesearchcodeNoXXX
RicognizionesearchfileNoXXX
RicognizionelistsnippetNoX
RicognizionelistrunnerNoX
RicognizionelistgistNoX
RicognizionelistorgNoX
RicognizioneprivsNoXX
RicognizioneprotectionNoX
PersistenzalistsshkeyNoXXX
PersistenzaremovesshkeyNoXXX
PersistenzacreatesshkeyNoXXX
PersistenzalistpatNoXX
PersistenzaremovepatNoXX
PersistenzacreatepatSì (solo GitLab Enterprise)XX
Escalation dei privilegiaddadminSìXXX
Escalation dei privilegiremoveadminSìXXX
RicognizioneadminstatsSìX