Sensitive Data Exposure
Exposure of Sensitive Information to an Unauthorized Actor
CWE-200 · High severity · Updated November 6, 2026
What it is
CWE-200 is a broad category covering any path that reveals sensitive information (credentials, tokens, internal identifiers, PII, business secrets, stack traces) to a party that should not have access. The disclosure can be active (an endpoint returns the data) or passive (a log file or cache stores it).
Why it matters
Most disclosed breaches involve a CWE-200 leak somewhere in the chain: stack traces that reveal database schema, debug endpoints returning environment variables, error messages that enumerate users, log files that capture authentication tokens, or response bodies that include fields the API was not supposed to return. Breach rules such as GDPR Article 33 and HIPAA 164.408 set notification timelines that run from awareness or discovery of a breach.
Common patterns
- Returning raw exception objects, stack traces, or DEBUG=True output to clients in production.
- Logging request bodies that contain passwords, tokens, or credit card numbers.
- Including internal IDs, database row counts, or schema hints in error responses.
- User enumeration via different error messages for valid vs invalid usernames.
- Response serialization that includes server-only fields (password hash, isInternal flag).
- Debug or admin endpoints (/debug, /healthz with full env dump, /admin/users) accessible without authentication.
Languages affected
Python, JavaScript, TypeScript, Ruby, Java, Go, PHP, C#
What Deva detects
Deva detects debug flags (DEBUG=True, display_errors, customErrors Off), handlers that return err.stack or traceback.format_exc() to clients, and log calls whose arguments are named like credentials.
Example
Vulnerable
import traceback
from flask import Flask, jsonify, request
app = Flask(__name__)
app.config['DEBUG'] = True
@app.errorhandler(Exception)
def handle(e):
return jsonify({
'error': str(e),
'type': type(e).__name__,
'traceback': traceback.format_exc(),
'request_body': request.get_data(as_text=True),
}), 500Fixed
import logging
import uuid
from flask import Flask, jsonify
from werkzeug.exceptions import HTTPException
app = Flask(__name__)
app.config['DEBUG'] = False # Never True in production
logger = logging.getLogger(__name__)
@app.errorhandler(HTTPException)
def handle_http(e):
# HTTP errors return their status code with a generic message.
return jsonify({'error': e.name}), e.code
@app.errorhandler(Exception)
def handle_generic(e):
# Log the full exception server-side with a server-generated correlation id.
correlation_id = uuid.uuid4().hex
logger.exception('Unhandled exception, correlation_id=%s', correlation_id)
# Return generic error to the client; no stack trace, no request echo.
return jsonify({'error': 'Internal server error', 'correlation_id': correlation_id}), 500The vulnerable handler returns the full exception chain and the entire request body to whoever triggered the error. An attacker fuzzing inputs harvests stack traces that reveal database schemas, file paths, and library versions. The fix disables DEBUG, logs server-side, returns a generic error code with a correlation id, and separates HTTP errors (safe to surface) from unexpected exceptions (never surface). The correlation id lets support staff find the underlying error in logs without exposing it to the client.
Where this fits in OWASP Top 10
- A01 Broken Access ControlAuthorization that fails to enforce who can do what.
Compliance framework references
These references explain how the weakness relates to control topics. They do not mean Deva offers evaluation for every framework listed. CMMC evaluation and SPRS scoring are currently unavailable. See the FAQ for offered frameworks and preview status. Deva provides code-level evidence for your assessment, without certifying compliance.
| Framework | Controls |
|---|---|
| OWASP Top 10:2025 | A01:2025 Broken Access Control |
| NIST 800-53 Rev 5 | SI-11 Error Handling, AU-9 Protection of Audit Information |
| PCI-DSS v4.0.1 | 3.4 Mask PAN, 6.2.4 Common software attacks |
| HIPAA Security Rule | 164.312(a)(1) Access Control |
| GDPR | Article 32 Security of processing, Article 33 Notification of breach |