High severityC#Hardcoded SecretsMEDIUM confidence
Basic Auth Header Literal
HTTP Basic-Auth credentials are constructed from hard-coded literals (CWE-798).
Standards mapping
- OWASP ASVS
- V6.4.1 (L2)V2.10.4 (L2)
Vulnerable vs. safe
Flagged by this check
var cred = new NetworkCredential("svcaccount", "P@ssw0rd123");Passes - the safe pattern
var cred = new NetworkCredential(user, pass);Why it matters & how to fix it
HTTP Basic-Auth credentials are constructed from hard-coded literals (CWE-798). The username/password (or its base64 blob) is exposed in source and binaries. Load credentials from a secrets manager/environment at runtime, and prefer token/OAuth or managed-identity authentication.
References
Rule ID integsec.csharp.secrets.basic-auth-header-literal - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Hardcoded SecretsBasic Auth Credentials In URL
- JavaScript / TypeScript - Hardcoded SecretsDB Connection String With Credentials
- JavaScript / TypeScript - Hardcoded SecretsHardcoded Credential String
- JavaScript / TypeScript - Hardcoded SecretsHardcoded Crypto Key Or IV
- Python - Hardcoded SecretsBasic Auth Credentials In URL
- Python - Hardcoded SecretsDB Connection String Credentials