Medium severityC#Sensitive Data ExposureMEDIUM confidence
Exception Detail To Client
Exception detail or a stack trace is returned to the client (CWE-209).
Standards mapping
Vulnerable vs. safe
Flagged by this check
return Content(ex.ToString());Passes - the safe pattern
return Content("An unexpected error occurred. Reference: 12345");Why it matters & how to fix it
Exception detail or a stack trace is returned to the client (CWE-209). Internal messages reveal framework versions, file paths, and query structure that aid attackers. Return a generic error with a correlation ID, log the full exception server-side only, and disable developer/verbose error pages in production.
References
Rule ID integsec.csharp.sensitive-data.exception-detail-to-client - 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