VNX-SEC-065: HTTP basic authentication header
Detects literal HTTP Basic credentials: a "Basic <base64>" header value that decodes to a real user:password pair.
| Field | Value |
|---|---|
| Rule ID | VNX-SEC-065 |
| Severity | High |
| SARIF level | error |
| Kind | secrets |
| Languages | Any file |
| CWE | CWE-798 |
| CAPEC | CAPEC-191 |
| ATT&CK | T1552.001 |
| CWSS vector | CWSS:1.0/TI:H/AP:A/AL:A/IC:N/FC:LT/RP:N/RL:A/AV:I/AS:N/IN:A/SC:A/BI:H/DI:H/EX:H/EC:N/P:H |
| Tags | secrets http basic-auth credentials |
| Source | internal/sast/rules/vnx-sec-065.rego |
Overview
This rule reports the string Basic <base64> (an Authorization header in a .http file, a curl -H argument, a headers dict or object, a Header.Set call, a constant, or the two-argument .NET new AuthenticationHeaderValue("Basic", "...")) when the base64 decodes to a printable user:password pair with a non-empty password. The decoded password is never printed.
It does not report headers built from variables ("Basic " + token, f-strings, ${VAR}, $(...)), text that does not decode to a credential (Basic authentication, Basic realm), default or placeholder pairs (admin:password, user:pass, a password equal to the user), comment lines, Markdown/reStructuredText/AsciiDoc, and test, fixture, vendored and generated files.
What Gets Flagged
HEADERS = {"Authorization": "Basic c3ZjLWRlcGxveTpUcTh2TDJtWnA5V3g="} # svc-deploy:Tq8vL2mZp9Wx
req.Header.Set("Authorization", "Basic c3ZjLWRlcGxveTpUcTh2TDJtWnA5V3g=")
Not flagged:
headers = {"Authorization": "Basic " + token}
DEFAULT = {"Authorization": "Basic YWRtaW46cGFzc3dvcmQ="} # admin:password
Why This Matters
Hardcoded http basic authentication header values are routinely scraped by automated bots within minutes of a public push, and then used to access the account, exfiltrate data, or pivot into downstream services. Once the credential is in git history it is permanently in third-party hands.
Remediation
- Revoke the leaked credential in the provider’s console immediately.
- Replace with a short-lived alternative, OAuth 2.0 access tokens, IAM role assumption, OIDC federation, wherever the platform supports it.
- Store the new credential in a secrets manager (AWS Secrets Manager, HashiCorp Vault, GitHub Actions secrets, Doppler).
- Audit the provider’s access logs for activity you did not initiate between the leak and the revocation.
- Purge from git history with
git filter-repoor BFG, then re-scan with gitleaks/truffleHog to confirm no other secrets remain. - Enable push protection so future commits are blocked at the developer machine.
References
- CWE-798: Use of Hard-coded Credentials
- gitleaks
- truffleHog
- OWASP Credentials Management Cheat Sheet
- MITRE ATT&CK T1552.001 – Credentials In Files
- git-filter-repo
Suppressing this rule
Put a nosec comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file’s language (#, //, -- or ;):
# nosec vnx-sec-065
// nosec vnx-sec-065
Or record an ignore rule: vulnetix ignore add --rule vnx-sec-065 --reason "...". See Suppressing findings.