Skip to content
Info disclosure Write-up Beginner

P3 — Sensitive Information Disclosure Through Verbose API Error Messages

The application's profile API returned detailed error messages when given malformed input, exposing database errors, internal file paths and framework details. An attacker could use this information to map the technology stack and refine later attacks.

akashmotkar001 Follow

Published on medium.com

Bug Bounty

Akash motkar, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

The target is an application whose user profile functionality is served by a JSON API. The affected component is the User Profile API, reached over POST at the following endpoint:

HTTP
https://target.example/api/v1/user/profile

The feature normally accepts a request for a user profile and returns a response. The report does not describe the request body or the parameters the endpoint expects. What matters here is the error path: when the API is given malformed, unexpected or invalid input, it does not fall back to a generic failure response. Instead it returns a detailed error that describes the internals of the application.

The issue is classified as Information Disclosure, CWE-209 (Generation of Error Message Containing Sensitive Information), with a suggested CVSS v3.1 score of 5.3 and a severity of Medium (P3).

Setup

The testing was done against the live application with Burp Suite, using its proxy to intercept the profile request and Repeater to resend modified versions of it. The report does not name any account, role or privilege level, and it does not state whether the request carried a session. It explicitly notes that an unauthenticated or authenticated attacker may be able to trigger the errors, so authentication is not treated as a precondition.

No specific version of the application, framework or Burp Suite is given.

Finding it

The researcher was testing the user profile API and noticed that the responses to invalid input were not generic. Rather than a neutral failure message, the API returned internal implementation details: backend component names, database-related errors, internal file paths, framework information and debugging messages. That is the signal: an error response that talks about the server's own files, database and code is describing the architecture to whoever sent the request.

Because the input is attacker-controlled, the errors can be triggered deliberately. Sending malformed requests is enough to collect information about the internal architecture, which is why the issue was reported rather than dismissed as cosmetic.

Exploitation

The reproduction is a manual, iterative process against the profile endpoint.

Step 1: Reach the profile functionality

Open the target application and navigate to the user profile functionality. This produces the legitimate API call that will be tampered with.

Step 2: Intercept the request

With Burp Suite proxying the browser, intercept the corresponding API request. The request is a POST to https://target.example/api/v1/user/profile.

Step 3: Send it to Repeater

Send the intercepted request to Burp Suite Repeater so that individual parameters can be edited and the request resent repeatedly.

Step 4: Corrupt the input

Modify one or more parameters with unexpected or malformed values. The report does not list the parameter names or the exact values used.

Step 5: Submit and observe

Submit the modified request to the server and read the response. The application returned verbose error messages containing internal implementation details. The example response given is:

JSON
{  "status": "error",  "message": "Database query failed",  "details": "SQLSTATE[42S22]: Column not found",  "file": "/var/www/application/api/UserController.php",  "line": 142}

Each field leaks something different:

  • message confirms that a database query was involved and failed.
  • details carries the raw database driver error, here an SQLSTATE code with the text Column not found, which points at the database technology and at how the query was built.
  • file and line disclose an absolute server path and the source location of the controller that handled the request, which reveals the directory layout and the application's internal structure.

Step 6: Iterate

Repeat the process with different invalid parameter values to identify additional error-handling behaviour. Different malformed inputs can surface different messages, so the goal is to map how many distinct internal details the error handler is willing to disclose.

Step 7: Confirm the nature of the response

Verify whether the response exposes internal implementation details rather than a generic error message. In this case it does: internal file paths, database error information and application implementation details are all present in the body returned to the client.

Root cause

The application returns detailed diagnostic output to external clients instead of a generic error. The example shows the database exception text, the source file path and the line number being serialised into the JSON response, which means the exception handler is passing internal exception data straight through to the caller.

The expected behaviour is a response that says nothing about the internals, for example:

JSON
{  "status": "error",  "message": "An unexpected error occurred."}

Detailed diagnostic information should only be recorded in protected server-side logs accessible to authorised administrators.

Impact

The disclosed information can be used to:

  • Identify the backend technology and application architecture.
  • Discover internal directory structures and source-code locations.
  • Identify database technologies and query-related implementation details.
  • Improve the accuracy of subsequent injection and exploitation attempts.
  • Correlate disclosed information with publicly known vulnerabilities affecting the application's technology stack.

On its own this is an information leak, not direct compromise, which is why it is rated Medium (P3): the disclosed information may assist further exploitation, particularly when combined with other vulnerabilities. The report hedges the outcome accordingly, saying that when combined with other weaknesses the disclosure could assist an attacker in developing a more effective attack path.

Fix

The recommended remediation, as listed in the report:

  1. Disable verbose error reporting in production environments.
  2. Implement centralised exception handling.
  3. Return generic error messages to external clients.
  4. Store detailed debugging information in protected server-side logs.
  5. Remove internal file paths, database errors, stack traces and environment details from API responses.
  6. Ensure production configurations do not expose development or debugging information.
  7. Conduct security testing of error-handling mechanisms across all API endpoints.

Variants to test

  • Other parameters on the same endpoint. Corrupt each field of the profile request in turn, one at a time, and look for a response that names a file, a line, a SQLSTATE code or a framework class. A positive result is any field whose error body differs from the generic message and describes server internals.
  • Type confusion. Send a value of the wrong type where a string, number or array is expected. A positive result is a type error that quotes the internal function or class that rejected it.
  • Oversized and truncated values. Push a parameter past its expected length or cut it short. A positive result is a length or validation error that includes a stack frame, a file path or a database message.
  • Missing and empty parameters. Omit a required field, or send it empty. A positive result is a validation error that reveals the internal schema or the code path that handled it.
  • Malformed JSON bodies. Break the JSON syntax of the request body. A positive result is a parser error that names the framework, the parser or an internal file.
  • Other API versions and sibling endpoints. Try the same corruption against other versions and other resources under the same API. A positive result is the same verbose pattern on an endpoint that was not part of the original test.
  • Authenticated versus unauthenticated. Send the corrupted request with and without a session. A positive result is the verbose error appearing even without authentication, which widens the set of attackers who can collect the information.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

A website had a feature where you can look at your user profile. Behind the scenes, that feature is powered by an API: a way for the browser to talk to the server and ask for data, rather than the server sending a whole web page. Think of an API as a waiter in a restaurant. You (the browser) tell the waiter what you want, the waiter goes to the kitchen (the server) and comes back with your order. Normally the waiter just brings the food.

In this case, when the researcher sent the waiter a strange or broken order, the waiter did not say "sorry, I did not understand that." Instead the waiter came back and read out the kitchen's internal recipe book: which cupboard the plates are in, which oven broke, the name of the chef who was cooking. That is what happened here. The API, when given bad input, replied with a detailed error message that described the server's own files, its database and its code.

This kind of problem is called Information Disclosure: the application gives away information it should keep to itself. The specific label is CWE-209, which is a catalogue entry meaning "Generation of Error Message Containing Sensitive Information". The report rates it Medium, priority P3, with a suggested CVSS v3.1 score of 5.3. CVSS is a standard scoring system for how serious a security flaw is; 5.3 sits in the middle.

Why does a chatty error message matter? Because everything the server tells you about itself helps you plan a bigger attack. If you learn which database software is running, which folder the code lives in and which file handled your request, you can look up known weaknesses for that software and aim your next attempt more precisely. On its own it is not a break-in, but it is a map of the building.

The target and the feature

The affected part of the application is the User Profile API. It is reached with an HTTP method called POST at this address:

HTTP
https://target.example/api/v1/user/profile

Let us unpack that. target.example is a placeholder name for the real site; the report uses it instead of the actual domain. https:// means the connection is encrypted. /api/v1/user/profile is the path, like a street address inside the site: api says this is the programming interface rather than a normal page, v1 is a version number, and user/profile points at the profile feature.

POST is one of the verbs a browser can use when talking to a server. GET is what happens when you type an address and ask to see a page. POST is used when you send data to the server, for example when you submit a form. The profile feature uses POST, so the browser is sending something to the server, not just asking for a page.

The report does not describe what the request body contains or which parameters the endpoint expects. A parameter is a named piece of data in a request, like a field on a form: a name, an age, an identifier. What matters here is not the normal path but the error path: what the server does when the input is wrong.

The tools used

The testing was done against the live application with a tool called Burp Suite. Burp Suite is a program that sits between your browser and the website, like a postbox that lets you open every letter before it is delivered. It has two parts that matter here:

  • The proxy catches the requests your browser sends and lets you look at them before they go out.
  • Repeater is a section where you can take one caught request, edit it, send it again, edit it again, and watch each response. It is the difference between sending one letter and being able to rewrite and resend the same letter as many times as you like.

The report does not name any account, role or privilege level used, and it does not say whether the request carried a session. A session is how a website remembers that you are logged in: after you sign in, the server gives your browser a small piece of data (often a cookie, a little file the browser stores and sends back with each request, or a token, a string the browser includes in the request). The report explicitly notes that an unauthenticated or authenticated attacker may be able to trigger the errors, so being logged in is not treated as a requirement. No specific version of the application, the framework or Burp Suite is given.

Finding it

The researcher was testing the user profile API and noticed that the responses to invalid input were not generic. Instead of a neutral failure message, the API returned internal implementation details: backend component names, database-related errors, internal file paths, framework information and debugging messages.

That is the signal. An error response that talks about the server's own files, database and code is describing the architecture to whoever sent the request. Because the input comes from the person sending the request, the errors can be triggered deliberately. Sending malformed requests is enough to collect information about the internal architecture, which is why the issue was reported rather than dismissed as cosmetic.

Reproducing it, step by step

The reproduction is a manual, iterative process against the profile endpoint. "Iterative" means you go round the loop several times, changing one thing each time.

Step 1: Reach the profile functionality

Open the target application and navigate to the user profile functionality. This produces the legitimate API call that will be tampered with. The point of this step is to get the browser to make the real request once, so you have a genuine example to work from. You are not guessing what the request looks like; you are letting the site show you.

Step 2: Intercept the request

With Burp Suite proxying the browser, intercept the corresponding API request. The request is a POST to https://target.example/api/v1/user/profile. "Intercept" means Burp holds the request before it reaches the server, so you can read it. This is how you see exactly what the browser was about to send.

Step 3: Send it to Repeater

Send the intercepted request to Burp Suite Repeater so that individual parameters can be edited and the request resent repeatedly. Repeater keeps the request on screen and lets you change a value and press send again, over and over, without repeating the whole browser journey each time.

Step 4: Corrupt the input

Modify one or more parameters with unexpected or malformed values. "Malformed" means the value does not fit what the server expects: text where a number belongs, a value that is far too long, a field left empty, or broken syntax. The report does not list the parameter names or the exact values used. The idea is to push the server off its normal path and onto its error path, because that is where the interesting messages live.

Step 5: Submit and observe

Submit the modified request to the server and read the response. The application returned verbose error messages containing internal implementation details. The example response given is:

JSON
{  "status": "error",  "message": "Database query failed",  "details": "SQLSTATE[42S22]: Column not found",  "file": "/var/www/application/api/UserController.php",  "line": 142}

This is JSON, a common text format for data exchanged between programs. It is built from pairs: a name in quotes, a colon, then a value. Curly braces group the pairs together. Here is what each line says:

  • "status": "error" says the request failed. That part is normal and harmless.
  • "message": "Database query failed" says a database was involved and the query failed. A database is the organised store where the site keeps its data, like a filing cabinet. A query is the instruction sent to that cabinet, for example "find the row for this user".
  • "details": "SQLSTATE[42S22]: Column not found" is the raw error from the database software itself. SQL is the language used to talk to many databases, and SQLSTATE is a standard code that database software uses to label errors. 42S22 is the code, and Column not found is its plain description: the query asked for a column (a named field in a table, like a column in a spreadsheet) that does not exist. This tells an outsider which database technology is in use and how the query was built.
  • "file": "/var/www/application/api/UserController.php" is an absolute path on the server: the exact location of a source file. /var/www/ is a common folder layout on web servers, and UserController.php is the piece of code that handled the request. This reveals the directory layout and the application's internal structure.
  • "line": 142 is the line number inside that file where the failure happened. Together with the file name, it points straight at the code.

So one error reply hands over the database technology, the query problem, a server folder path and a source location. None of that is needed by the person using the profile feature.

Step 6: Iterate

Repeat the process with different invalid parameter values to identify additional error-handling behaviour. Different malformed inputs can surface different messages, so the goal is to map how many distinct internal details the error handler is willing to disclose. One broken value might reveal a database error; another might reveal a framework name; another might reveal a different file. Each new message adds a piece to the picture.

Step 7: Confirm the nature of the response

Verify whether the response exposes internal implementation details rather than a generic error message. In this case it does: internal file paths, database error information and application implementation details are all present in the body returned to the client. "The client" means the browser or tool that sent the request. The information was not hidden in a log on the server; it was sent back to the sender.

Why it happens

The application returns detailed diagnostic output to external clients instead of a generic error. The example shows the database exception text, the source file path and the line number being placed into the JSON response, which means the code that handles errors is passing internal error data straight through to the caller. An exception is a program's way of saying "something went wrong here"; it carries details about what failed and where. Passing those details to the outside world is the mistake.

A framework is a ready-made set of code that developers build an application on top of; many frameworks have a debug mode that shows rich errors while you are building the site, and that mode should be switched off once the site is live.

The expected behaviour is a response that says nothing about the internals, for example:

JSON
{  "status": "error",  "message": "An unexpected error occurred."}

This is the same JSON shape, with the same status and message names, but the message is generic. It tells the user the request failed without telling them anything about the database, the files or the code. Detailed diagnostic information should only be recorded in protected server-side logs accessible to authorised administrators. A log is a record the server keeps of what happened, like a diary; keeping it on the server, behind access controls, means only the people running the site can read it.

What an attacker could do with it

The disclosed information can be used to:

  • Identify the backend technology and application architecture. "Backend" means the server side, the part you do not see; "architecture" means how its pieces fit together.
  • Discover internal directory structures and source-code locations.
  • Identify database technologies and query-related implementation details.
  • Improve the accuracy of subsequent injection and exploitation attempts. An injection attack is one where the attacker slips their own instructions into data the server processes, hoping the server treats the data as commands.
  • Correlate disclosed information with publicly known vulnerabilities affecting the application's technology stack. A vulnerability is a weakness that can be abused; a technology stack is the combination of software the site is built from.

On its own this is an information leak, not direct compromise, which is why it is rated Medium (P3): the disclosed information may assist further exploitation, particularly when combined with other vulnerabilities. The report hedges the outcome accordingly, saying that when combined with other weaknesses the disclosure could assist an attacker in developing a more effective attack path.

The fix

The recommended remediation, as listed in the report:

  1. Disable verbose error reporting in production environments. "Production" means the live site real users see, as opposed to a test copy.
  2. Implement centralised exception handling. That means one place in the code decides how every error is turned into a response, instead of each part doing its own thing.
  3. Return generic error messages to external clients.
  4. Store detailed debugging information in protected server-side logs.
  5. Remove internal file paths, database errors, stack traces and environment details from API responses. A stack trace is the list of function calls that led to an error, like a receipt showing every step of the order.
  6. Ensure production configurations do not expose development or debugging information.
  7. Conduct security testing of error-handling mechanisms across all API endpoints.

Other things worth trying

Once you understand the pattern, you can look for it in more places. These are variations on the same idea: send something the server does not expect, and see whether the reply describes its insides.

  • Other parameters on the same endpoint. Corrupt each field of the profile request in turn, one at a time, and look for a response that names a file, a line, a SQLSTATE code or a framework class. A positive result is any field whose error body differs from the generic message and describes server internals.
  • Type confusion. Send a value of the wrong type where a string, number or array is expected. A string is text, a number is numeric, and an array is a list. A positive result is a type error that quotes the internal function or class that rejected it.
  • Oversized and truncated values. Push a parameter past its expected length or cut it short. A positive result is a length or validation error that includes a stack frame, a file path or a database message.
  • Missing and empty parameters. Omit a required field, or send it empty. A positive result is a validation error that reveals the internal schema or the code path that handled it. A schema is the description of how data is organised.
  • Malformed JSON bodies. Break the JSON syntax of the request body. A positive result is a parser error that names the framework, the parser or an internal file. A parser is the part of the program that reads and interprets the JSON text.
  • Other API versions and sibling endpoints. Try the same corruption against other versions and other resources under the same API. A positive result is the same verbose pattern on an endpoint that was not part of the original test.
  • Authenticated versus unauthenticated. Send the corrupted request with and without a session. A positive result is the verbose error appearing even without authentication, which widens the set of attackers who can collect the information.

Glossary

  • API: a way for one program to ask another for data or actions, like a waiter carrying orders between you and the kitchen.
  • HTTP method: the verb in a web request, such as GET (fetch a page) or POST (send data).
  • POST: an HTTP method used to send data to a server.
  • Endpoint: the specific address of a feature on a server, such as /api/v1/user/profile.
  • Parameter: a named piece of data in a request, like a field on a form.
  • Request body: the part of a request that carries the data being sent.
  • JSON: a text format for data, built from name and value pairs inside curly braces.
  • Information Disclosure: a flaw where an application gives away information it should keep private.
  • CWE-209: a catalogue entry for "Generation of Error Message Containing Sensitive Information".
  • CVSS v3.1: a standard scoring system for the severity of a security flaw; 5.3 is a medium score.
  • P3: a priority label meaning the issue matters but is not the most urgent.
  • Severity: how serious a flaw is judged to be.
  • Burp Suite: a tool that sits between browser and website so you can inspect and edit requests.
  • Proxy: software that catches traffic between your browser and a site.
  • Repeater: the part of Burp Suite that lets you edit one request and resend it repeatedly.
  • Session: how a site remembers you are logged in.
  • Cookie: a small piece of data the browser stores and sends back with requests.
  • Token: a string the browser includes in a request to prove who it is.
  • Authenticated / unauthenticated: logged in versus not logged in.
  • Database: the organised store where a site keeps its data.
  • Query: an instruction sent to a database, such as "find this user's row".
  • SQL: the language used to talk to many databases.
  • SQLSTATE: a standard code database software uses to label errors.
  • Column: a named field in a database table, like a column in a spreadsheet.
  • Absolute path: the full location of a file on a server, starting from the top of the filesystem.
  • Framework: a ready-made set of code an application is built on top of.
  • Debug mode: a setting that shows rich error details, meant for development and not for live sites.
  • Exception: a program's signal that something went wrong, carrying details of what and where.
  • Stack trace: the list of function calls that led to an error.
  • Log: a record the server keeps of what happened.
  • Backend: the server side of an application, which users do not see.
  • Architecture: how the parts of an application fit together.
  • Technology stack: the combination of software a site is built from.
  • Vulnerability: a weakness that can be abused.
  • Injection: an attack where the attacker slips their own instructions into data the server processes.
  • Production: the live environment real users see.
  • Centralised exception handling: one place in the code that decides how every error becomes a response.
  • Type confusion: sending a value of the wrong type, such as text where a number is expected.
  • String: text data.
  • Array: a list of values.
  • Schema: the description of how data is organised.
  • Parser: the part of a program that reads and interprets text such as JSON.
  • Remediation: the fix for a flaw.

More by akashmotkar001

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.