High severityC#Sensitive Data ExposureMEDIUM confidence
Log Secret Value
A secret or credential value is written to a log/console sink (CWE-532).
Standards mapping
- CWE
- CWE-532: Insertion of Sensitive Information into Log FileCWE-200: Exposure of Sensitive Information to an Unauthorized Actor
- OWASP ASVS
- V7.1.1 (L2)V7.1.2 (L2)
Vulnerable vs. safe
Flagged by this check
logger.LogInformation($"Authenticating with password {password}");Passes - the safe pattern
logger.LogInformation($"Authenticating user {userId}");Why it matters & how to fix it
A secret or credential value is written to a log/console sink (CWE-532). Logs are aggregated, retained, and widely readable, so logged secrets become a durable exposure. Remove the value from the log statement, log a non-sensitive identifier instead, and redact/mask secrets in logging pipelines.
References
Rule ID integsec.csharp.sensitive-data.log-secret-value - 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 - Sensitive Data ExposureError Stack In Response
- JavaScript / TypeScript - Sensitive Data ExposurePII PHI In Logs
- JavaScript / TypeScript - Sensitive Data ExposureSecret In Logs
- JavaScript / TypeScript - Sensitive Data ExposureSensitive Data Client Storage
- JavaScript / TypeScript - Sensitive Data ExposureSensitive Data In URL Query
- Python - Sensitive Data ExposureFlask Traceback In Response