What Is CWE-209? Error Messages That Leak Secrets
Security Beginner 5 min read

What Is CWE-209? Error Messages That Leak Secrets

CWE-209 is an error message that reveals sensitive information such as paths, queries or keys. What it looks like, how to find it and how to fix it.

Published: December 1, 2026 • Updated: December 1, 2026
cwe-209information disclosureerror handlingsecure coding

CWE-209 is the weakness class for an error message that contains sensitive information. The application hits a failure, builds a message from internal state such as a file path, a SQL query, a stack trace or a configuration value, and shows that message to the user who triggered the error. The November 2026 TYPO3 case, where a failed form upload printed the server's storage path and an "unguessable" folder name to the visitor, is a textbook CWE-209 error message and it was exploited in the wild.

What is CWE-209?

CWE-209 is the MITRE Common Weakness Enumeration entry titled Generation of Error Message Containing Sensitive Information. It describes any case where error output reveals details about the system that help an attacker, including paths, usernames, software versions, internal hostnames, query text or secret tokens.

The weakness is not the error itself. Errors are normal. The weakness is the decision, usually an accidental one, to pass the raw internal message through to an untrusted party. Developers do it because the detailed message is useful during development, and nothing forces them to swap it for a generic one before release.

Why does a path in an error message matter?

A path tells an attacker how your deployment is laid out, which user the application runs as, which framework and version you use, and sometimes where writable or publicly served folders live. In the TYPO3 case the path included a random folder name that was the only thing standing between an uploaded file and a predictable public URL.

Information disclosure bugs almost never score high on their own. The TYPO3 bug, CVE-2026-125160, scored CVSS 4.0 6.3 and still landed in the CISA Known Exploited Vulnerabilities catalog. That is the pattern to internalise: a leak is the first step of a chain, and the chain is what gets scored in the real world.

Common forms of CWE-209

The same weakness shows up in several recognisable shapes:

  • Framework debug pages. A development mode left on in production renders the full stack trace, environment variables and request data on any unhandled exception.
  • Database errors. The driver's message is returned to the browser, including the failing SQL statement and often table and column names.
  • File system errors. "Permission denied" or "File name too long" messages that include the absolute path, as in the TYPO3 upload converter.
  • Authentication errors. Distinguishing "user not found" from "wrong password" confirms which usernames exist.
  • API error bodies. JSON error responses that include internal service names, upstream URLs or the raw exception class.
  • Verbose server banners. Default web server or application server error pages that print the exact product and version.

Each of these is a case of the application telling the user something that only the operator needed to know.

How do you fix a CWE-209 error message?

Catch the exception at the boundary, log the full detail server-side with a correlation identifier, and return a short generic message plus that identifier to the user. The user can quote the identifier to support, and support can find the real cause in the log without the detail ever reaching the browser.

That is exactly what TYPO3's fix did. The patched upload converter writes the exception to the application logger and hands the visitor a fixed translated string that says an unknown error occurred. The diagnostic value moved from the response body to the log, where it belongs.

A few supporting rules make the fix stick:

  1. Disable debug and development modes in production and verify it from outside, not from a config file. Request a page that you know will fail and read what comes back.
  2. Centralise error handling. One exception handler at the framework edge that enforces the generic-message rule beats hundreds of individual try blocks that each decide what to show.
  3. Treat log output as sensitive. Moving paths and secrets to a log file is only an improvement if the log file is not world-readable or shipped to a service with weak access control.
  4. Review third-party error surfaces. Reverse proxies, PHP-FPM, application servers and cloud load balancers all have their own default error pages. Replace them with static ones.
  5. Test with bad input on purpose. Over-long file names, invalid characters, oversized uploads and malformed JSON are cheap test cases, and they are the inputs attackers send first.

How to find CWE-209 in your own applications

Start from the outside. Walk every public form and API endpoint and submit inputs designed to fail: a 300-character file name, a file with no extension, an empty required field with the client-side validation stripped out, a malformed identifier in a URL. Read the full response, not just the status code. Anything that mentions a path, a class name, a query or a hostname is a finding.

Then look from the inside. Search the codebase for places where an exception's message is interpolated into a response. In most languages that means a catch block that returns, renders or serialises the caught object or its message property. Each one needs either a specific, deliberate user-facing message or the generic-plus-identifier pattern.

Finally, check the operational layer. Confirm the web server's custom error pages are in place, that framework debug flags are false in the production environment, and that logging configuration does not echo errors to the HTTP response as a fallback.

Where this fits in a defence-in-depth plan

Fixing the error message removes the leak. It does not remove the thing the leak pointed at. In the TYPO3 case, the uploaded file was still sitting in a public folder; only its address was secret. The second layer, a Content-Security-Policy header on the upload folder, is what stops a leaked HTML file from running script. Our guide on how to set a CSP header for upload folders covers that side.

The principle generalises. Whenever a design relies on a value being secret, ask what happens when it is not. If the answer is "the attacker gets a public URL to their own file on our origin," the secret was never the right control.