At a glance
- Controls
- CWE-209 · A04:2021 Insecure Design
What it is
When a request fails, some products return the raw technical error to the user. That can include a stack trace, the database query, file paths, library versions or the names of internal servers. Debug settings left on in production are a common cause.
Attackers trigger errors on purpose with odd inputs and read what comes back. The details tell them which framework and versions to target and where input reaches the database. AI-assisted attackers can send many malformed requests at once and summarise the leaked details into a target list.
Where it hides
What a reviewer can look for in the code and in the behaviour, before anyone proves it.
- API endpoints that fail on unexpected types or very long inputs
- Search, filter and sort parameters passed into database queries
- File upload and import flows that parse documents
- Framework debug modes and default error pages left on in production
How MATT tests it
The proof runs against the deployed product, on every release, whoever wrote the code.
- 01Sign in as a test user and send malformed values to each input on the main endpoints.
- 02Record every response that includes a trace, a query, a path or an internal host.
- 03Match each leak to the code path and configuration that produced it.
Errors shown to users must say what went wrong and nothing about how the system is built.
Executable checkas user A: POST /v1/orders with body {"quantity": "abc"} expect: 4xx with a short message and a reference id expect: no stack trace, SQL, file path or internal hostname in the body expect: no framework or version header in the response
Every rule MATT holds →What the fix looks like
- 01
Turn off debug mode and detailed error pages in production.
- 02
Add one error handler that returns a plain message and a reference id.
- 03
Write the full technical detail to server logs, linked by that reference id.
- 04
Remove version and framework headers from responses.
A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →