Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
A common API anti-pattern: the endpoint returns the whole object and trusts the client (the app UI) to display only the appropriate fields. But the API response is right there in the network tab — anyone can read the fields the UI hides. This skill covers finding those over-returning endpoints and fixing them by filtering server-side.
When to use it
Any API that returns objects — user profiles, orders, records. Especially where a mobile/web client shows a subset of what the endpoint actually sends. It's easy to find (just read responses) and often leaks PII or internal fields.
Procedure
- Call the endpoints and read the full raw response, not what the app displays. Compare the fields returned against what the UI actually uses:
curl -H "Authorization: Bearer <token>" https://api.tld/v1/users/me | jq
- Look for fields the client shouldn't get: password hashes, internal flags, other users' PII,
isAdmin, tokens, full records when only a name was needed. If the app shows a name but the response includes an email and phone, that's exposure.
- Check list/collection endpoints — they often over-return per item, multiplying the leak across every record.
- Test object endpoints for other users in combination with authorisation checks (ties into BOLA) — over-exposure plus weak authz means bulk PII harvesting.
- Look for debug/verbose fields left in responses (stack traces, internal IDs, SQL) — information leakage that helps other attacks.
- Confirm the extra data is genuinely sensitive/unintended before reporting — some fields are meant to be there.
Cheatsheet
curl -s -H "Authorization: Bearer $T" https://api.tld/v1/users/me | jq 'keys'
password / passwordHash / salt
ssn / dob / fullAddress / phone (when the view only needs a name)
isAdmin / role / internalNotes / accountBalance (of others)
apiKey / token / secret
stackTrace / sqlQuery / internalId
curl -s .../v1/users | jq '.[0] | keys'
Reading the output
- Sensitive fields present in the response but hidden by the UI = excessive data exposure. The client-side hiding is not a control; the data already left the server.
- PII across a list endpoint = the highest-impact version — one request harvests many records' worth of sensitive data.
- Internal/debug fields (stack traces, SQL, internal IDs) = information leakage that aids further attacks even if not directly sensitive.
- Fields that are supposed to be there (the user's own email on their own profile settings page) = not a finding; judge by whether the caller should legitimately receive it.
The fix
Filter on the server, by design, so the API can only ever return what the caller is entitled to:
- Explicit response schemas / DTOs — define exactly which fields each endpoint returns, rather than serialising the whole database object. Never
return user straight from the ORM.
- Never rely on the client to hide data. The response is visible; if the client shouldn't see it, don't send it.
- Field-level authorisation where different callers get different fields (a user sees their own email, an admin view is separate and access-controlled).
- Strip debug/verbose output in production responses (no stack traces, no internal identifiers).
- Review responses as part of API design, and add tests that assert an endpoint's response shape so a future change can't quietly widen it.
Pitfalls
- Trusting the UI to filter. The single mistake behind this whole class — the raw response is one network-tab click away.
- Fixing the object endpoint, missing the list. Collection endpoints leak the same fields times N. Check both.
- Serialising the ORM model directly. It returns every column, including ones added later. Use an explicit output shape.
- Over-reporting. Not every extra field is sensitive; judge by whether the caller is entitled to it before flagging.
References
- OWASP API Security Top 10 — API3:2023 (Broken Object Property Level Authorization, which covers excessive exposure)
- CWE-213 (Exposure of Sensitive Information Due to Incompatible Policies)
- OWASP WSTG — information disclosure testing
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: excessive-data-exposure3description: Use when an API returns more data than the client needs — testing whether responses leak fields the user shouldn't see, and how to filter at the server.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314A common API anti-pattern: the endpoint returns the whole object and trusts the client (the app UI) to display only the appropriate fields. But the API response is right there in the network tab — anyone can read the fields the UI hides. This skill covers finding those over-returning endpoints and fixing them by filtering server-side.1516### When to use it1718Any API that returns objects — user profiles, orders, records. Especially where a mobile/web client shows a subset of what the endpoint actually sends. It's easy to find (just read responses) and often leaks PII or internal fields.1920### Procedure21221. Call the endpoints and **read the full raw response**, not what the app displays. Compare the fields returned against what the UI actually uses:23 ```24 curl -H "Authorization: Bearer <token>" https://api.tld/v1/users/me | jq25 ```262. Look for fields the client shouldn't get: password hashes, internal flags, other users' PII, `isAdmin`, tokens, full records when only a name was needed. If the app shows a name but the response includes an email and phone, that's exposure.273. Check **list/collection endpoints** — they often over-return per item, multiplying the leak across every record.284. Test **object endpoints for other users** in combination with authorisation checks (ties into BOLA) — over-exposure plus weak authz means bulk PII harvesting.295. Look for **debug/verbose fields** left in responses (stack traces, internal IDs, SQL) — information leakage that helps other attacks.306. Confirm the extra data is genuinely sensitive/unintended before reporting — some fields are meant to be there.3132### Cheatsheet3334```bash35curl -s -H "Authorization: Bearer $T" https://api.tld/v1/users/me | jq 'keys'3637password / passwordHash / salt38ssn / dob / fullAddress / phone (when the view only needs a name)39isAdmin / role / internalNotes / accountBalance (of others)40apiKey / token / secret41stackTrace / sqlQuery / internalId4243curl -s .../v1/users | jq '.[0] | keys'44```4546### Reading the output4748- **Sensitive fields present in the response but hidden by the UI** = excessive data exposure. The client-side hiding is not a control; the data already left the server.49- **PII across a list endpoint** = the highest-impact version — one request harvests many records' worth of sensitive data.50- **Internal/debug fields** (stack traces, SQL, internal IDs) = information leakage that aids further attacks even if not directly sensitive.51- **Fields that are supposed to be there** (the user's own email on their own profile settings page) = not a finding; judge by whether the caller should legitimately receive it.5253### The fix5455Filter on the server, by design, so the API can only ever return what the caller is entitled to:5657- **Explicit response schemas / DTOs** — define exactly which fields each endpoint returns, rather than serialising the whole database object. Never `return user` straight from the ORM.58- **Never rely on the client to hide data.** The response is visible; if the client shouldn't see it, don't send it.59- **Field-level authorisation** where different callers get different fields (a user sees their own email, an admin view is separate and access-controlled).60- **Strip debug/verbose output** in production responses (no stack traces, no internal identifiers).61- Review responses as part of API design, and add tests that assert an endpoint's response shape so a future change can't quietly widen it.6263### Pitfalls6465- **Trusting the UI to filter.** The single mistake behind this whole class — the raw response is one network-tab click away.66- **Fixing the object endpoint, missing the list.** Collection endpoints leak the same fields times N. Check both.67- **Serialising the ORM model directly.** It returns every column, including ones added later. Use an explicit output shape.68- **Over-reporting.** Not every extra field is sensitive; judge by whether the caller is entitled to it before flagging.6970### References7172- OWASP API Security Top 10 — API3:2023 (Broken Object Property Level Authorization, which covers excessive exposure)73- CWE-213 (Exposure of Sensitive Information Due to Incompatible Policies)74- OWASP WSTG — information disclosure testing7576## Inputs77- Relevant source code, logs, network traces, or system specifications.7879## Outputs80- Analysis findings, security audit report, or generated code artifacts.