Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker contributes malicious report template
-
DeliveryVictim runs Gitleaks in CI/CD with that template
-
ExploitSprig env/expandenv reads host and scan secrets
-
ExecutiongetHostByName encodes secrets into DNS queries
-
ImpactAttacker-controlled DNS server captures exfiltrated credentials
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V1 - Encoding and Sanitization Template injection prevention
|
| Exploitation Conditions | Exploitation requires that Gitleaks be run with the report template (custom output template) feature using a template the attacker can supply or influence, and that the template invoke the non-hermetic Sprig functions env, expandenv, or getHostByName - this specific feature and function usage IS the condition. Limiting factors: the vector is local (AV:L) and requires active user interaction (UI:A) - a victim must actually execute Gitleaks against the malicious template, so it is not remotely self-triggering; value comes only when the host process environment or scan actually contains secrets (typical in CI/CD but not guaranteed); and outbound DNS resolution must be permitted for the getHostByName exfiltration path. It does not apply to installations that never use custom/attacker-influenced report templates. |
| Impact | The CVSS 4.0 vector (AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N, base 8.1) frames this accurately: exploitation is local and requires active user interaction (a victim must run Gitleaks with the attacker-influenced template), but confidentiality impact is high on both the vulnerable system (VC:H) and a subsequent system (SC:H, reflecting exfiltration of scanned/host secrets), with no integrity or availability impact. This is a confidentiality-only, exfiltration-focused issue, not a code-execution flaw. Realistically the interesting exploitation path is supply-chain-style: a poisoned template committed to a repo or shared config runs inside a privileged CI/CD job. No EPSS score, SSVC decision, or KEV entry was provided; a public technique write-up exists but there is no evidence of automated, widespread exploitation. Note a nuance worth verifying: the CVSS vector marks PR:N (no privileges) because the attacker supplies the template, yet the attack still depends on a victim invoking Gitleaks with that template - the UI:A metric, not authentication, is what gates it. |
| Exploit ScenarioDerived | An attacker submits a pull request to a repository that adds or modifies a Gitleaks report template containing Sprig calls like getHostByName combined with env/expandenv. When the CI/CD pipeline runs Gitleaks on the branch, the template renders inside the runner, reads CI secrets and any secrets found during the scan, and encodes them into DNS queries to an attacker-controlled domain, silently exfiltrating them; a public write-up demonstrates this technique. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 21, 2026
Sensitive data exfiltration in Gitleaks before 8.30.1 lets an attacker who controls the report template read arbitrary host environment variables through non-hermetic Sprig functions (env, expandenv, getHostByName) and smuggle them out via attacker-triggered DNS lookups. Because Gitleaks runs in CI/CD with broad access to credentials, tokens, and API keys - including the very secrets it just discovered during a scan - a malicious template turns the scanner into an exfiltration channel. A detailed public write-up describing the technique and the fix exists; there is no CISA KEV listing, so this reflects a demonstrated technique rather than confirmed active exploitation.
RemediationAI
Upgrade to Gitleaks 8.30.1 or later, which restricts the template engine so non-hermetic Sprig functions can no longer reach host environment variables or perform DNS resolution (Vendor-released patch: 8.30.1; fix in commit 83d9cd684c87d95d656c1458ef04895a7f1cbd8e). Until you can upgrade, treat report templates as untrusted code: do not use, accept, or merge report templates from external contributors or shared/untrusted sources, and pin templates to a reviewed, in-house version stored outside contributor-writable paths - the trade-off is losing the flexibility of per-repo custom templates. As defense in depth for CI/CD runners, scope down the job's environment so it holds only the secrets it strictly needs and add egress filtering that blocks or logs outbound DNS to untrusted resolvers/domains, which neutralizes the getHostByName exfiltration channel at the cost of some monitoring overhead. Consult the VulnCheck advisory (https://www.vulncheck.com/advisories/gitleaks-secret-exfiltration-via-non-hermetic-sprig-template-functions-in-report-template-feature) for details.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The affected component is Gitleaks' report template feature, which renders output using Go's text/template engine extended with the Sprig function library. Sprig ships 'non-hermetic' helpers - functions that reach outside the template sandbox into the host process, notably env/expandenv (process environment variables) and getHostByName (DNS resolution). The root cause is CWE-1336, Improper Neutralization of Special Elements Used in a Template Engine (server-side template injection): untrusted or attacker-influenced template content is evaluated with a function set that permits host interaction. Combining env-style secret reads with getHostByName provides both the sensitive-data source and a covert egress channel (DNS), so no direct network response to the attacker is needed. The affected package is identified by cpe:2.3:a:gitleaks:gitleaks and all versions prior to 8.30.1 are in scope.
Know when Gitleaks gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N
Local template rendering requires a victim to run Gitleaks (UI:R, AV:L); attacker needs no privileges since they only supply the template (PR:N); reading host env and exfiltrating beyond the tool is scope-changed confidentiality-only (S:C, C:H, I:N, A:N).
AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
Gitleaks prior to 8.30.1 contains a template injection vulnerability that allows attackers who can supply or influence report templates to read arbitrary environment variables and exfiltrate sensitive data by leveraging non-hermetic Sprig template functions. Attackers can craft malicious report templates using the env, expandenv, and getHostByName functions to extract credentials, tokens, and API keys from the host process and exfiltrate them through DNS queries, including secrets discovered during the scan itself.
Executive ViewAI
Gitleaks versions before 8.30.1 contain a vulnerability that allows attackers who control the report template to exfiltrate environment variables, credentials, and API keys from CI/CD pipelines. This transforms a security scanning tool into an attack vector for stealing the very credentials it is meant to protect, affecting organizations that deploy Gitleaks in their CI/CD infrastructure. Publicly available exploit code exists, but no active exploitation has been confirmed at this time.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
EUVD-2026-46134
GHSA-mmh4-9cvr-w4cj
NVD
CVE.org
EPSS
Exploit-DB