Pipeleak is a tool designed to scan CI/CD logs and artifacts for secrets.
It supports the following platforms:
- GitLab
- GitHub
- BitBucket
- Azure DevOps
To begin using Pipeleak, download the latest binary from the Releases page.
Run the following command to scan your e.g. GitLab instance:
pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com
In addition to logs, Pipeleak can also scan artifacts generated by your pipelines.
Note: Scanning artifacts uses a lot of memory!
pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com -a
The following confidence levels for scans are used by default:
low
medium
high
high-verified
these are validated by the corresponding TruffleHog validator.
However if you want to add custom ones, you can define any value in the rules.yml
file
To scan only for a specific level, you can specify it via CLI flag e.g --confidence=high,medium
. Define multiple by comma separating the values.
Note: high-verified
cannot be removed, but verification can be disabled using --truffleHogVerification=false
.
When you run Pipeleak for the first time, it generates a rules.yml
file based on this repository. You can customize your scan rules by modifying this file as needed.
In the scan
mode you can change interactively between log levels by pressing t
: Trace, d
: Debug, i
: Info, w
: Warn, e
: Error. Pressing s
will output the current queue status.
Dotenv artifacts are not accessible through the GitLab API. To scan these, you need to manually provide your session cookie after logging in via a web browser. The session cookie name is _gitlab_session
. The cookie should be valid for two weeks.
pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com -v -a -c [value-of-valid-_gitlab_session]
As the scanner processes a lot of resoures (especially when using --artifacts
) memory, CPU and disk usage can become hard to manage.
You can tweak --threads
, --max-artifact-size
and --job-limit
to obtain a customized performance and achieve stable processing.
shodan
command: use the Shodan command to identify gitlab instances that might allow for anyone to register. this command assumes a JSON file from a Shodan export. example query: product:"GitLab Self-Managed"
runners
command: Identify (shared) runners which are available globally or through a group where the user has at least developer access. Create projects with a default exploitation .gitlab-ci.yml
file.
register
command: Best effort automation to register a new user on an instance.
vuln
command: Check the installed version for CVEs in the NIST Vulnerability database
variables
command: Enumerate configured project/group/instance variables
secureFiles
command: Enumerate secure files
enum
command: Enumerate user permissions and accesss
Note: Proxying is currently supported only for GitLab commands.
Since Go binaries aren't compatible with Proxychains, you can set a proxy using the HTTP_PROXY environment variable.
For HTTP proxy (e.g., Burp Suite):
HTTP_PROXY=http://127.0.0.1:8080 pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com
For SOCKS5 proxy:
HTTP_PROXY=socks5://127.0.0.1:8080 pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com
Scan owned repositories including their artifacts
pipeleak gh scan --token github_pat_xxxxxxxxxxx --artifacts --owned
Scan repositories of an organization
pipeleak gh scan --token github_pat_xxxxxxxxxxx --artifacts --maxWorkflows 10 --org apache
Scan public repositories
pipeleak gh scan --token github_pat_xxxxxxxxxxx --artifacts --maxWorkflows 10 --public
Scan by search term
pipeleak gh scan --token github_pat_xxxxxxxxxxx --artifacts --maxWorkflows 10 --search iac
Scan repositories of a user
pipeleak gh scan --token github_pat_xxxxxxxxxxx --artifacts --user firefart
BitBucket does not offer a public API for artifacts. Only artifacts that were uploaded to the Downloads section can be scanned.
Scan your owned repositories and their artifacts
pipeleak bb scan --token xxxxxxxxxxx --username auser --owned --artifacts
Scan a workspace (find public ones here: https://bitbucket.org/repo/all/)
pipeleak bb scan --token xxxxxxxxxxx --username auser --workspace bitbucketpipelines
Scan all public repositories
If using
after
, the API becomes quite unreliable 👀
pipeleak bb scan --token xxxxxxxxxxx --username auser --public --maxPipelines 5 --after 2025-03-01T15:00:00+00:00
Scan all pipelines the current user has access to
pipeleak ad scan --token xxxxxxxxxxx --username auser --artifacts
Scan all pipelines of an organization
pipeleak ad scan --token xxxxxxxxxxx --username auser --artifacts --organization myOrganization
Scan all pipelines of a project e.g. https://dev.azure.com/PowerShell/PowerShell
pipeleak ad scan --token xxxxxxxxxxx --username auser --artifacts --organization powershell --project PowerShell
Create your PAT here: https://dev.azure.com/{yourproject}/_usersSettings/tokens
In the top right corner you can choose the scope (Global, Project etc.). Global in that case means per tenant. If you have access to multiple tentants you need to run a scan per tenant. Get you username from an HTTPS git clone url from the UI.
To easily analyze the results you can redirect the pipeleak output using nc
into Logstash.
Setup a local ELK stack using https://github.com/deviantony/docker-elk.
Then you can start a scan:
pipeleak gl scan --token glpat-xxxxxxxxxxx --gitlab https://gitlab.com --json | nc -q0 localhost 50000
Using Kibana you can filter for interesting messages, based on the JSON attributes of the output.
e.g. message.level=warn and message.confidence=verified
to find verified results.