Verbose Error Messages Exposed to Clients

Detects stack traces, exception details, and internal error information sent in HTTP responses to end users.

zakirkun Updated

File contents

Verbose Error Messages Exposed to Clients

Overview

Exposing detailed error information to end users reveals:

  • Stack traces: Internal file paths, function names, code structure
  • Database errors: Table names, column names, SQL queries
  • Framework errors: Version information, configuration details
  • Exception messages: Business logic and data structure hints

This information directly aids attackers in crafting more targeted attacks.

Remediation

  • Return generic error messages to clients (Internal Server Error, Something went wrong)
  • Log detailed error information server-side for debugging
  • Use custom error handlers in your framework
  • Set appropriate HTTP status codes without leaking implementation details

Vulnerable:

app.use((err, req, res, next) => {
    res.status(500).json({ error: err.stack }); // Exposes stack trace!
});

Safe:

app.use((err, req, res, next) => {
    logger.error(err.stack); // Log internally
    res.status(500).json({ error: 'Internal Server Error' });
});

zakirkun/ice-tea/tree/main/skills/logging/verbose-error commit d8dd3f9803

Frequently asked questions

npx skillmds@latest add zakirkun/verbose-error-messages-exposed-to-clients