Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

OWASP Top Ten Proactive Controls 2018 - C10: Handle all Errors and Exceptions

Proper handling of errors and exceptions is crucial for code reliability and security. Learn about managing exceptions, preventing information leakage, and ensuring proper error logging.

Overview

Learn about the importance of handling errors and exceptions in your application and how to do it correctly to maintain reliability and security. Avoid common mistakes in error handling and prevent security vulnerabilities. This article provides positive advice on managing exceptions, avoiding information leakage, and logging errors properly.


Description

Exception handling is a critical programming concept that allows applications to respond to different error states. Handling errors and exceptions correctly is essential for code reliability and security. Mistakes in error handling can lead to security vulnerabilities such as information leakage and denial-of-service attacks. This article provides guidance on managing exceptions, avoiding information leakage in error messages, and ensuring proper logging for support and incident response.


How to Prevent ?

To prevent errors and exceptions, it is recommended to manage exceptions in a centralized manner, ensuring that all unexpected behavior is properly handled. Error messages displayed to users should not leak critical data but should provide enough information for the user to respond appropriately. It is important to log exceptions in a way that facilitates support and incident response. Thorough testing and verification of error handling code is also crucial.


Example Attack Scenarios:

  • Information Leakage:  Leaking sensitive information in error messages can inadvertently assist attackers. Error messages that return internal error details or provide different responses for different error conditions can give valuable clues to attackers. It is important to log error details for forensics and debugging purposes but avoid exposing this information to external clients.

  • TLS Bypass:  Control-flow errors in error handling code can lead to vulnerabilities like the Apple goto "fail bug," which compromised TLS connections. Proper error handling is necessary to prevent such bypass attacks.

  • Denial-of-Service (DoS):  Lack of basic error handling can result in system shutdown or increased CPU and disk usage, degrading the system. Robust error handling is vital to prevent DoS attacks.

Is your System Free of Underlying Vulnerabilities?
Find Out Now