22 Фев, 2024

Information leakage via error messages

Information Leakage via Error Message

Information leakage via error messages is a уязвимость
that occurs when an application inadvertently exposes sensitive information
through its error messages. This can happen when the error messages generated
by the application are too detailed, revealing specifics about the
application’s internal workings, structure, database schemas, third-party
modules, or even security mechanisms in place.

Such error messages might include stack traces, SQL error
details, system paths, server configuration information, or cryptographic keys,
among other sensitive data. This information can be invaluable to attackers,
providing them with insights that could be exploited to craft targeted attacks,
bypass security measures, or escalate their access privileges within the

The root cause of this vulnerability often lies in
inadequate error handling practices, where developers either rely on default
error messages provided by frameworks and languages or implement custom error
messaging without considering the security implications of verbose output.
While detailed error messages can be helpful for debugging during development,
they should be restricted from production environments where they can be
accessed by malicious actors.

To effectively study information leakage via error messages,
it’s crucial to approach the subject with a structured learning path that
covers understanding the basics, theoretical study, and practical skills
development. This comprehensive approach will equip you with the necessary
knowledge and skills to identify, mitigate, and prevent information leakage
through error messages.

Example of Exploitation 

Information leakage via error messages can manifest in various forms across different technologies and platforms. Below are some examples that illustrate how sensitive information can be inadvertently exposed through error messages.

1. Verbose Database Error Messages
In a web application using SQL, an improperly handled query error might result in a detailed error message being displayed to the user, such as:

					SQL Error: 'SELECT * FROM users WHERE username='admin' AND password='password'' at line 1: Table 'app_database.users' doesn't exist.

This error message reveals the SQL query structure, indicating that the application might be vulnerable to SQL injection. It also discloses the database schema by mentioning the table name.

2. Stack Traces on Web Pages
A Java web application might display a full stack trace to the browser when an unhandled exception occurs, like:

					java.lang.NullPointerException: Cannot invoke "String.length()" because "str" is null
    at com.example.app.LoginServlet.doPost(LoginServlet.java:45)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

This stack trace reveals the internal working of the application, including the servlet name, the method where the error occurred, and the line number, which could help an attacker understand the application’s logic and find vulnerabilities.

3. Path Disclosure through Scripting Languages

A PHP website with display_errors set to On might output warnings or errors directly to the user, such as:

					Warning: include(/var/www/html/config.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 2

This message not only reveals the server’s directory structure but also indicates the existence and expected location of a potentially sensitive configuration file.

4. Incorrect Error Handling in APIs
An API might return a detailed error response in JSON format, like:

  "error": "File processing failed",
  "details": "Error processing file /opt/app/uploads/secret_config.yaml: File not found"

This response exposes the internal path where uploaded files are stored, potentially leading to targeted attacks aiming to manipulate or access files in this directory.

5. Information Disclosure via Debug Mode
A web application running in debug mode might generate verbose error messages for development purposes, such as:

Error connecting to database: Failed to connect to MySQL: Host: db.example.com, Username: dbuser, Password: dbpassword


Leaving debug mode enabled in a production environment can inadvertently leak connection details, including credentials to access the database.

Scanners that detect vulnerability 

1. OWASP Zed Attack Proxy (ZAP): ZAP is an open-source web application security testing tool that can identify information leakage vulnerabilities in web applications, including those via error messages. It offers automated scanners for detecting common vulnerabilities and is particularly useful for its range of features that can assist in spotting subtle hints of sensitive information exposure.

2. Burp Suite: This is a comprehensive web application security testing platform that includes tools for identifying information leakage. With Burp Suite, you can use the Burp Scanner for automated scanning, which can flag potential information disclosure issues. Additionally, Burp’s engagement tools, such as the search function and the ability to find comments, can help uncover sensitive information that may be inadvertently exposed through error messages and other means.

3. Fuzzing: By submitting unexpected data types and specially crafted fuzz strings using tools like Burp Intruder, you can observe how the application responds. Differences in error messages, response times, and HTTP status codes can hint at underlying information leakage vulnerabilities.

4. Nmap: While primarily a network scanning tool, Nmap can help identify open ports and services, potentially revealing misconfigurations or services that could leak information.

5. Wireshark: As a network protocol analyzer, Wireshark allows you to capture and analyze network traffic. Monitoring how applications handle errors and the data transmitted during these errors can help identify potential leakage points.

6. Checkmarx and Veracode: These are static code analysis tools that can identify potential information leakage vulnerabilities within the source code, offering insights into how error handling might expose sensitive information.

Average CVSS score for Reflected XSS

The average CVSS score for information leakage through debug information is around 5.3, indicating a moderate risk level. This score reflects the potential impact of such vulnerabilities, which might include unauthorized access to sensitive information. The severity can vary depending on the nature of the leaked information and the context in which the vulnerability is exploited.

To study Information Leakage via Error Message

Understanding the Basics

Learn about different types of error messages (syntax errors, runtime errors, logical errors) and how they can inadvertently reveal sensitive information about the application’s backend, structure, or logic.

Understand what constitutes a verbose error message and how detailed error messages can provide attackers
with insights into the system’s architecture, database schema, or even credentials.

Grasp the potential security risks associated with information leakage, including how attackers can use leaked information to craft targeted attacks or exploit specific vulnerabilities.

Familiarize yourself with secure coding practices that minimize the risk of revealing too much information in
error messages, such as input validation, error handling, and logging.

Theoretical Study

Study the principle of least privilege and its application in minimizing information exposure through error
messages by ensuring that systems only disclose information necessary for the intended operation.

Learn about incident response strategies and how effective error logging (without exposing sensitive
information to the user) plays a crucial role in diagnosing and addressing security incidents.

Understand the compliance and regulatory frameworks (like GDPR, HIPAA) that mandate the protection of sensitive data and may have specific requirements regarding information leakage and error handling.

Practical Skills

Develop skills in implementing custom error handling mechanisms that provide users with generic error messages while logging detailed information securely for developers’ analysis.

Gain experience in using tools and techniques for penetration testing and vulnerability scanning to identify and remediate instances where error messages may leak sensitive information.

Integrate security practices into the application development lifecycle, from design to deployment, ensuring that error handling and message verbosity are considered at each stage.

How to be Protected from Information Leakage via Error Messages

Configure custom error pages that prevent the display of default error messages which might contain sensitive information.

Ensure that error messages displayed to users are generic and do not reveal details about the underlying
issue or system architecture.

Log detailed error information securely on the server side, accessible only to authorized personnel, for
debugging and forensic analysis.


In conclusion, information leakage via error messages is a subtle yet significant vulnerability that can compromise the security of applications and the integrity of an organization’s data infrastructure. As we’ve explored throughout this article, error messages, while invaluable for debugging and operational insights, can become inadvertent conduits for sensitive information if not properly managed. The examples provided underscore the diverse ways in which information can be leaked, from verbose database errors and stack traces to path disclosures and detailed API responses.


In the digital age, where data is both currency and commodity, the importance of maintaining operational security cannot be overstated. Let this discussion on information leakage via error messages serve as a reminder of the constant vigilance required to navigate the complex landscape of cybersecurity. It is through understanding, diligence, and continuous improvement that we can aspire to stay one step ahead of the threats that loom in the vast expanse of our interconnected world.

Другие Услуги

Готовы к безопасности?

Связаться с нами