Vulnerability Analysis
Gitleaks is an open-source SAST tool for detecting and preventing hardcoded secrets such as passwords, API keys and tokens in Git repositories, historical commits, files and standard input. It supports local reviews, pre-commit checks and CI pipelines so teams can find past or present credential exposure before it reaches production.
sudo apt install gitleaks
gitleaks git -v
Gitleaks is an MIT-licensed SAST secret scanner written in Go. It detects hardcoded passwords, API keys, tokens and related secrets in Git repositories, ordinary files, directories and standard input. The `git` command examines repository history through `git log -p`, while `dir` evaluates current filesystem content without requiring Git metadata. Reports can be exported as JSON, CSV, JUnit, SARIF or a custom Go text/template.
The tool is designed for prevention as well as investigation. Developers can install the documented pre-commit hook, teams can run the Gitleaks Action in GitHub workflows, and security reviewers can create baseline reports that suppress known historical findings while preserving visibility into new ones. Project-specific `.gitleaks.toml` files can extend the default configuration, define custom rules, add allowlists and select individual rule IDs.
Gitleaks does not verify whether a candidate secret is accepted by its service. Every result therefore needs contextual triage, but raw findings must still be treated as sensitive because they can contain live credentials. Rotate or revoke an exposed credential before focusing on source cleanup, and never paste it into chat or an unrestricted report. Scan only repositories and files you own or are authorized to assess.
The maintainer has stated: "Gitleaks is feature complete. I'm not merging new features into Gitleaks. Future releases will be security patches only. I'm shifting my focus to Betterleaks." The latest verified release is v8.30.1, published 2026-03-21. Pin a reviewed release or container version so local and CI results remain reproducible while still applying future security patches.
| Command | Purpose |
|---|---|
gitleaks git -v | Scan the current Git repository and print verbose finding details. |
gitleaks git -v --log-opts="--all" path_to_repo | Scan all refs available in an authorized local repository.Ensure the clone contains the branches and commits you intend to review. |
gitleaks dir path_to_directory | Scan an authorized directory without requiring Git history. |
cat some_file | gitleaks -v stdin | Stream authorized data into Gitleaks through standard input. |
gitleaks git --report-path gitleaks-report.json && gitleaks git --baseline-path gitleaks-report.json --report-path findings.json | Create a baseline and report only findings that are new relative to it. |
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest dir /path | Scan an authorized mounted folder with the Docker Hub image. |
sudo apt install gitleaksInstall the official Kali Linux Gitleaks package.brew install gitleaksInstall Gitleaks through Homebrew on macOS or Linux.docker pull zricethezav/gitleaks:latest && docker pull ghcr.io/gitleaks/gitleaks:latestPull the documented Gitleaks images from Docker Hub and GitHub Container Registry.docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest dir /pathScan an authorized host folder with the Docker Hub Gitleaks image.docker run -v ${path_to_host_folder_to_scan}:/path ghcr.io/gitleaks/gitleaks:latest dir /pathScan an authorized host folder with the GitHub Container Registry Gitleaks image.git clone https://github.com/gitleaks/gitleaks.git && cd gitleaks && make buildClone the official repository and build Gitleaks from source.gitleaks --versionPrint the installed Gitleaks version for setup and audit records.gitleaks --helpDisplay current Gitleaks commands and global options.gitleaks git -vScan the current Git repository and print verbose finding details.gitleaks git path_to_repoScan the history of a named local Git repository.gitleaks git -v --log-opts="--all commitA..commitB" path_to_repoScan the selected Git revision range across all refs in an authorized repository.gitleaks dir path_to_directoryScan an authorized directory without requiring Git history.gitleaks dir path_to_fileScan one authorized file for secret candidates.cat some_file | gitleaks -v stdinStream an authorized file into Gitleaks through standard input.gitleaks git --report-format json --report-path gitleaks-report.jsonScan the current Git repository and save findings as JSON.gitleaks dir path_to_directory --report-format csv --report-path gitleaks-report.csvScan a directory and write findings in CSV format.gitleaks git --report-format sarif --report-path gitleaks-report.sarifCreate a SARIF report for ingestion by compatible code-scanning systems.gitleaks git --report-format junit --report-path gitleaks-report.xmlWrite Git findings as a JUnit report for compatible CI systems.gitleaks dir ~/leaky-repo/ --report-path "report.json" --report-format template --report-template testdata/report/jsonextra.tmplRender a directory scan with a Go text/template report file.gitleaks git --exit-code 2Return exit code 2 instead of the default leaks-found code when findings are detected.gitleaks git --config path_to_config.tomlScan the current Git repository with an explicit Gitleaks configuration file.GITLEAKS_CONFIG=path_to_config.toml gitleaks git -vSelect a configuration through the GITLEAKS_CONFIG environment variable.gitleaks git --enable-rule generic-api-keyRun the Git scan with only the named generic-api-key rule enabled.gitleaks git --report-path gitleaks-report.json && gitleaks git --baseline-path gitleaks-report.json --report-path findings.jsonCreate a baseline report and then report only findings that are new relative to it.gitleaks git --gitleaks-ignore-path path_to_projectUse the .gitleaksignore file found in the specified file or folder location.gitleaks dir path_to_directory --ignore-gitleaks-allowReport candidates even when their lines contain gitleaks:allow comments.gitleaks git --redact=100Redact all detected secret text from logs and standard output.gitleaks dir path_to_directory --max-decode-depth 2 --max-archive-depth 2Decode supported encoded text and traverse nested archives to the selected depths.gitleaks dir path_to_directory --log-level debug --timeout 60 --max-target-megabytes 10Run a debug-level directory scan with a 60-second timeout and a per-file size limit.pre-commit autoupdate && pre-commit installUpdate the configured Gitleaks pre-commit hook revision and install the hook in the current repository.Inspect current and historical revisions in an authorized Git repository for hardcoded passwords, API keys and tokens, with commit metadata identifying where a candidate entered history.
Scan directories or individual files that are not stored in Git, including deployment bundles, source exports and configuration backups covered by the assessment scope.
Install the documented pre-commit hook so secret candidates can be reviewed before they become part of repository history.
Run Gitleaks in an authorized CI workflow, save a machine-readable report and use the configured leaks-found exit code to block unsafe changes.
Generate a baseline for accepted historical findings and report only candidates that appear after the baseline was created.
Enable decoding and archive traversal when an approved review must inspect encoded content or files nested inside zip and tar archives.
Yes. The `git` command uses `git log -p` under the hood, allowing Gitleaks to inspect historical patches as well as content associated with the selected repository range.
Use `--log-opts` with an appropriate Git log selection such as `-1` for the latest commit, or use `gitleaks dir .` when only current working-tree files should be scanned without historical metadata.
Run `sudo apt install gitleaks`, then verify the installed executable with `gitleaks --version` and pin the approved release used by your workflow.
Gitleaks detects likely passwords, API keys, tokens and related secrets in Git repositories, files, directories and standard input.
Mount an authorized host folder into either the Docker Hub or GHCR image and scan its container path with the `git` or `dir` command.
Gitleaks is lighter and well suited to Git-focused pre-commit checks, while TruffleHog adds broader source coverage and live verification for supported secrets.
Vulnerability Analysis
TruffleHog is an open-source secrets discovery, classification, verification and analysis tool by Truffle Security. It scans Git history, GitHub, filesystems, Docker images, cloud storage and other supported sources for API keys, passwords, private keys and related machine credentials.
Vulnerability Analysis
Nuclei is used to send requests across targets based on templates, allowing zero false positives and providing rapid scanning over large infrastructure footprints.
Password Attacks
Learn how to use Hashcat in Kali Linux as a beginner, from checking the install and selecting the right modes to running a wordlist crack and reading results.
Vulnerability Analysis
OpenVAS (Open Vulnerability Assessment System) is a full-featured vulnerability scanner providing a comprehensive architectural network engine that checks endpoints against thousands of active vulnerability feeds.
Vulnerability Analysis
Lynis is a battle-tested security auditing tool for systems running Linux, macOS, or Unix-based operating systems. It performs an in-depth local scan to discover security weaknesses, configuration flaws, and system hardening opportunities.
Vulnerability Analysis
SSLScan queries SSL/TLS services (such as HTTPS) to determine supported ciphers, key exchanges, and security flaws like Heartbleed or broken protocol configurations.
Learn how to use BloodHound and SharpHound for Active Directory reconnaissance, attack path analysis, privilege escalation detection, and security assessment.
Security · IntermediateLearn about credential stuffing attacks that use leaked credentials from data breaches to automate account takeover across different services.
Tools · BeginnerHow to use WPScan in Kali Linux: install it, save your free API token, run your first WordPress vulnerability scan — cheat sheet, 15 FAQs.
Maltego · IntermediateDeep dive into Maltego's transform engine. Understand transform architecture, categories, chaining, the Transform Hub, TREST API, and how to create custom transforms.
Gitleaks reports structured fields for each detected secret candidate. In the official README sample, Finding is `export BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef`, Secret is `cafebabe:deadbeef`, RuleID is `sidekiq-secret`, Entropy is `2.609850`, File is `cmd/generate/config/rules/sidekiq.go`, Line is `23`, Commit is `cd5226711335c68be1e720b318b7bc3135a30eb2`, Author is `John`, Email is `john@users.noreply.github.com`, Date is `2022-08-03T12:31:40Z`, and Fingerprint is `cd5226711335c68be1e720b318b7bc3135a30eb2:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:23`. Finding shows the matching source context, Secret is the sensitive substring, RuleID identifies the rule, Entropy records the calculated randomness score, File and Line locate the text, and the Git-specific fields identify the introducing revision and author metadata. Fingerprint provides a stable identifier used by `.gitleaksignore`. Exit code 0 means no leaks were present, exit code 1 means leaks or an error were encountered, and exit code 126 means an unknown flag was supplied; `--exit-code` changes the leaks-found code. `--redact` hides a selected percentage of secret text from logs and standard output, with 100 percent as the default. A scan with no finding records and exit code 0 means Gitleaks found no matches under the active configuration and selected scope, not that the repository is guaranteed to contain no secret.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.