Internal Server Error

  • CWE 550
  • WASC 13

Server Error exposure occurs when web applications reveal detailed error messages or stack traces to end users. These messages often include internal system information such as file paths, database queries, configuration details, or framework versions. Attackers can leverage this information to identify vulnerabilities, design targeted attacks, or exploit misconfigurations. Such exposures typically result from improper error handling, lack of generic error pages, or verbose debug settings enabled in production environments.

Common patterns leading to server error disclosure:

  • Default error pages from frameworks or servers revealing stack traces or internal paths.
  • Application exceptions displayed directly to users without sanitization.
  • Debugging or verbose logging enabled in production environments.
  • Lack of global error handling mechanisms to catch unhandled exceptions.

Impacts:

  • Information Disclosure: Reveals sensitive information about server configuration, application structure, or database schema.
  • Facilitates Targeted Attacks: Attackers can use disclosed information to craft exploits such as SQL Injection, RCE, or path traversal.
  • Increased Attack Surface: Knowledge of frameworks, libraries, or internal components aids exploitation.
  • Compliance Violations: Revealing sensitive system details may breach PCI DSS, GDPR, or other regulatory requirements.

Detection indicators:

  • HTTP responses containing stack traces, database errors, or detailed exception messages.
  • Application returning different error messages based on input, indicating internal logic exposure.
  • Security scanners detecting verbose error outputs.

500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the web server but the server could not be more specific on what the exact problem is.

This generally indicates a programming error and application code should be reviewed to handle unexpected errors.

Remediation

Mitigation focuses on proper error handling, logging, and information masking:

  1. Implement Generic Error Pages
    Display user-friendly messages without revealing internal details.

  2. Log Detailed Errors Securely
    Store detailed error information in server logs accessible only to authorized personnel.

  3. Disable Debugging in Production
    Ensure verbose debug or exception output is not enabled in live environments.

  4. Sanitize Exception Handling
    Catch unhandled exceptions and prevent sensitive information from being sent to clients.

  5. Monitor and Audit Logs
    Regularly review server logs for recurring errors and potential security issues.

  6. Security Testing
    Include tests for error message disclosure and input-triggered exceptions during penetration tests.

  7. Educate Developers
    Train developers to follow secure error handling practices and avoid exposing sensitive information.