[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D8EHAV20996ZV1WHPYCHAC":3,"skill-same:01M7D8EHAV20996ZV1WHPYCHAC":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M7D8EHAV20996ZV1WHPYCHAC","exploiting-excessive-data-exposure-in-api",null,"Tests APIs for excessive data exposure (OWASP API3:2023) by intercepting raw API responses and comparing them against what the UI actually renders, looking for leaked PII, internal identifiers, debug data, or business-sensitive fields the frontend filters but the API still transmits. Use when auditing REST or mobile-app APIs for over-fetching, response filtering bypass, or unintended data leakage in endpoint responses.","SaiVatsal\u002FSkills-I-Use","SaiVatsal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242597752?v=4","01M7D5YM1T4VXW9203M0GFAHZ1","SaiVatsalPolimera","01M7D5YM2D61ST39XVR2V7B7ZJ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: exploiting-excessive-data-exposure-in-api\ndescription: >-\n  Tests APIs for excessive data exposure (OWASP API3:2023) by intercepting raw API\n  responses and comparing them against what the UI actually renders, looking for\n  leaked PII, internal identifiers, debug data, or business-sensitive fields the\n  frontend filters but the API still transmits. Use when auditing REST or mobile-app\n  APIs for over-fetching, response filtering bypass, or unintended data leakage in\n  endpoint responses.\ndomain: cybersecurity\nsubdomain: api-security\ntags:\n- api-security\n- owasp\n- data-exposure\n- rest-security\n- pii-leakage\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1552.001\n- T1027\n- T1070\n---\n# Exploiting Excessive Data Exposure in API\n\n## When to Use\n\n- Testing APIs where the frontend displays a subset of data but the API response includes additional fields\n- Assessing mobile application APIs where responses are designed for multiple client types and may contain excess data\n- Identifying PII leakage in API responses that include email addresses, phone numbers, SSNs, or payment data not shown in the UI\n- Testing GraphQL APIs where clients can request arbitrary fields including sensitive attributes\n- Evaluating APIs after microservice refactoring where internal service-to-service data leaks into public endpoints\n\n**Do not use** without written authorization. Data exposure testing involves capturing and analyzing potentially sensitive personal data.\n\n## Prerequisites\n\n- Written authorization specifying target API endpoints and scope\n- Burp Suite Professional or mitmproxy configured as intercepting proxy\n- Two test accounts at different privilege levels (regular user and admin)\n- Browser developer tools or mobile proxy setup for traffic capture\n- Python 3.10+ with `requests` and `json` libraries\n- API documentation (OpenAPI spec) for comparison against actual responses\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Workflow\n\n### Step 1: Response Schema Discovery\n\nCompare documented API responses with actual responses:\n\n```python\nimport requests\nimport json\n\nBASE_URL = \"https:\u002F\u002Ftarget-api.example.com\u002Fapi\u002Fv1\"\nheaders = {\"Authorization\": \"Bearer \u003Cuser_token>\", \"Content-Type\": \"application\u002Fjson\"}\n\n# Fetch a resource and analyze all returned fields\nendpoints_to_test = [\n    (\"GET\", \"\u002Fusers\u002Fme\", None),\n    (\"GET\", \"\u002Fusers\u002Fme\u002Forders\", None),\n    (\"GET\", \"\u002Fproducts\", None),\n    (\"GET\", \"\u002Fusers\u002Fme\u002Fsettings\", None),\n    (\"GET\", \"\u002Ftransactions\", None),\n]\n\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        data = resp.json()\n        # Recursively extract all field names\n        def extract_fields(obj, prefix=\"\"):\n            fields = []\n            if isinstance(obj, dict):\n                for k, v in obj.items():\n                    full_key = f\"{prefix}.{k}\" if prefix else k\n                    fields.append(full_key)\n                    fields.extend(extract_fields(v, full_key))\n            elif isinstance(obj, list) and obj:\n                fields.extend(extract_fields(obj[0], f\"{prefix}[]\"))\n            return fields\n\n        all_fields = extract_fields(data)\n        print(f\"\\n{method} {path} - {len(all_fields)} fields returned:\")\n        for f in sorted(all_fields):\n            print(f\"  {f}\")\n```\n\n### Step 2: Sensitive Data Pattern Detection\n\nScan API responses for sensitive data patterns:\n\n```python\nimport re\n\nSENSITIVE_PATTERNS = {\n    \"email\": r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}',\n    \"phone\": r'(\\+?1?\\s?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})',\n    \"ssn\": r'\\b\\d{3}-\\d{2}-\\d{4}\\b',\n    \"credit_card\": r'\\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13})\\b',\n    \"password_hash\": r'\\$2[aby]?\\$\\d{2}\\$[.\u002FA-Za-z0-9]{53}',\n    \"api_key\": r'(?:api[_-]?key|apikey)[\"\\s:=]+[\"\\']?([a-zA-Z0-9_\\-]{20,})',\n    \"internal_ip\": r'\\b(?:10\\.\\d{1,3}|172\\.(?:1[6-9]|2\\d|3[01])|192\\.168)\\.\\d{1,3}\\.\\d{1,3}\\b',\n    \"aws_key\": r'AKIA[0-9A-Z]{16}',\n    \"jwt_token\": r'eyJ[A-Za-z0-9_-]+\\.eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+',\n    \"uuid\": r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',\n}\n\nSENSITIVE_FIELD_NAMES = [\n    \"password\", \"password_hash\", \"secret\", \"token\", \"ssn\", \"social_security\",\n    \"credit_card\", \"card_number\", \"cvv\", \"pin\", \"private_key\", \"api_key\",\n    \"internal_id\", \"debug\", \"trace\", \"stack_trace\", \"created_by_ip\",\n    \"last_login_ip\", \"salt\", \"session_id\", \"refresh_token\", \"mfa_secret\",\n    \"date_of_birth\", \"bank_account\", \"routing_number\", \"tax_id\"\n]\n\ndef scan_response(endpoint, response_text):\n    findings = []\n    # Check for sensitive data patterns in values\n    for pattern_name, pattern in SENSITIVE_PATTERNS.items():\n        matches = re.findall(pattern, response_text)\n        if matches:\n            findings.append({\n                \"endpoint\": endpoint,\n                \"type\": \"sensitive_value\",\n                \"pattern\": pattern_name,\n                \"count\": len(matches),\n                \"sample\": matches[0][:20] + \"...\" if len(matches[0]) > 20 else matches[0]\n            })\n\n    # Check for sensitive field names\n    response_lower = response_text.lower()\n    for field in SENSITIVE_FIELD_NAMES:\n        if f'\"{field}\"' in response_lower or f\"'{field}'\" in response_lower:\n            findings.append({\n                \"endpoint\": endpoint,\n                \"type\": \"sensitive_field\",\n                \"field_name\": field\n            })\n\n    return findings\n\n# Scan all endpoint responses\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        findings = scan_response(f\"{method} {path}\", resp.text)\n        for f in findings:\n            print(f\"[FINDING] {f['endpoint']}: {f['type']} - {f.get('pattern', f.get('field_name'))}\")\n```\n\n### Step 3: Compare UI Display vs API Response\n\n```python\n# Fields the UI shows (observed from the frontend application)\nui_displayed_fields = {\n    \"\u002Fusers\u002Fme\": {\"name\", \"email\", \"avatar_url\", \"role\"},\n    \"\u002Fusers\u002Fme\u002Forders\": {\"order_id\", \"date\", \"status\", \"total\"},\n    \"\u002Fproducts\": {\"id\", \"name\", \"price\", \"image_url\", \"description\"},\n}\n\n# Fields the API actually returns\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        data = resp.json()\n        if isinstance(data, list):\n            actual_fields = set(data[0].keys()) if data else set()\n        elif isinstance(data, dict):\n            # Handle paginated responses\n            items_key = next((k for k in data if isinstance(data[k], list)), None)\n            if items_key and data[items_key]:\n                actual_fields = set(data[items_key][0].keys())\n            else:\n                actual_fields = set(data.keys())\n        else:\n            continue\n\n        expected = ui_displayed_fields.get(path, set())\n        excess = actual_fields - expected\n        if excess:\n            print(f\"\\n{method} {path} - EXCESS FIELDS (not shown in UI):\")\n            for field in sorted(excess):\n                print(f\"  - {field}\")\n```\n\n### Step 4: Test User Object Exposure in Related Endpoints\n\n```python\n# Many APIs embed full user objects in responses for orders, comments, etc.\nendpoints_with_user_objects = [\n    \"\u002Forders\",          # Each order may include full seller\u002Fbuyer profile\n    \"\u002Fcomments\",        # Comments may include full author profile\n    \"\u002Freviews\",         # Reviews may expose reviewer details\n    \"\u002Ftransactions\",    # Transactions may include counterparty info\n    \"\u002Fteam\u002Fmembers\",    # Team listing may expose excessive member data\n]\n\nfor path in endpoints_with_user_objects:\n    resp = requests.get(f\"{BASE_URL}{path}\", headers=headers)\n    if resp.status_code == 200:\n        text = resp.text\n        # Check for user data leakage in nested objects\n        user_fields_found = []\n        for field in [\"password_hash\", \"last_login_ip\", \"mfa_enabled\", \"phone_number\",\n                      \"date_of_birth\", \"ssn\", \"internal_notes\", \"salary\", \"address\"]:\n            if f'\"{field}\"' in text:\n                user_fields_found.append(field)\n        if user_fields_found:\n            print(f\"[EXCESSIVE] {path} exposes user fields: {user_fields_found}\")\n```\n\n### Step 5: GraphQL Over-Fetching Analysis\n\n```python\n# GraphQL allows clients to request any available field\nGRAPHQL_URL = f\"{BASE_URL}\u002Fgraphql\"\n\n# Introspection query to discover all fields on User type\nintrospection = {\n    \"query\": \"\"\"\n    {\n      __type(name: \"User\") {\n        fields {\n          name\n          type {\n            name\n            kind\n          }\n        }\n      }\n    }\n    \"\"\"\n}\n\nresp = requests.post(GRAPHQL_URL, headers=headers, json=introspection)\nif resp.status_code == 200:\n    fields = resp.json().get(\"data\", {}).get(\"__type\", {}).get(\"fields\", [])\n    print(\"Available User fields via GraphQL:\")\n    for f in fields:\n        sensitivity = \"SENSITIVE\" if f[\"name\"] in SENSITIVE_FIELD_NAMES else \"normal\"\n        print(f\"  {f['name']} ({f['type']['name']}) [{sensitivity}]\")\n\n# Try to query sensitive fields\nsensitive_query = {\n    \"query\": \"\"\"\n    query {\n      users {\n        id\n        email\n        passwordHash\n        socialSecurityNumber\n        internalNotes\n        lastLoginIp\n        mfaSecret\n        apiKey\n      }\n    }\n    \"\"\"\n}\nresp = requests.post(GRAPHQL_URL, headers=headers, json=sensitive_query)\nif resp.status_code == 200 and \"errors\" not in resp.json():\n    print(\"[CRITICAL] GraphQL exposes sensitive user fields without restriction\")\n```\n\n### Step 6: Debug and Internal Data Leakage\n\n```python\n# Test for debug information in responses\ndebug_headers_to_check = [\n    \"X-Debug-Token\", \"X-Debug-Info\", \"Server\", \"X-Powered-By\",\n    \"X-Request-Id\", \"X-Correlation-Id\", \"X-Backend-Server\",\n    \"X-Runtime\", \"X-Version\", \"X-Build-Version\"\n]\n\nresp = requests.get(f\"{BASE_URL}\u002Fusers\u002Fme\", headers=headers)\nfor h in debug_headers_to_check:\n    if h.lower() in {k.lower(): v for k, v in resp.headers.items()}:\n        print(f\"[INFO LEAK] Header {h}: {resp.headers.get(h)}\")\n\n# Test error responses for stack traces\nerror_payloads = [\n    (\"GET\", \"\u002Fusers\u002Finvalid-id-format\", None),\n    (\"POST\", \"\u002Forders\", {\"invalid\": \"payload\"}),\n    (\"GET\", \"\u002Fusers\u002F-1\", None),\n    (\"GET\", \"\u002Fusers\u002F0\", None),\n]\n\nfor method, path, body in error_payloads:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code >= 400:\n        text = resp.text.lower()\n        if any(kw in text for kw in [\"stack trace\", \"traceback\", \"at com.\", \"at org.\",\n                                      \"file \\\"\", \"line \", \"exception\", \"sql\", \"query\"]):\n            print(f\"[DEBUG LEAK] {method} {path} -> {resp.status_code}: Contains stack trace or query info\")\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Excessive Data Exposure** | API returns more data fields than the client needs, relying on frontend filtering to hide sensitive information from users |\n| **Over-Fetching** | Requesting or receiving more data than needed for a specific operation, common in REST APIs that return fixed response schemas |\n| **Response Filtering** | Client-side filtering of API response data to display only relevant fields, which provides zero security since the full response is interceptable |\n| **Object Property Level Authorization** | OWASP API3:2023 - ensuring that users can only read\u002Fwrite object properties they are authorized to access |\n| **PII Leakage** | Unintended exposure of Personally Identifiable Information in API responses including names, emails, addresses, SSNs, or financial data |\n| **Schema Validation** | Enforcing that API responses conform to a defined schema, stripping unauthorized fields before transmission |\n\n## Tools & Systems\n\n- **Burp Suite Professional**: Intercept API responses and use the Comparer tool to diff expected vs actual response schemas\n- **mitmproxy**: Scriptable proxy for automated response analysis with Python-based content inspection scripts\n- **OWASP ZAP**: Passive scanner detects information disclosure in headers, error messages, and response bodies\n- **Postman**: Compare documented response schemas against actual API responses using test scripts\n- **jq**: Command-line JSON processor for extracting and analyzing specific fields from API responses\n\n## Common Scenarios\n\n### Scenario: Mobile Banking API Data Exposure Assessment\n\n**Context**: A mobile banking application's API returns full account objects to the mobile client, which only displays account nickname and balance. The API is accessed by both iOS and Android apps and a web portal.\n\n**Approach**:\n1. Configure mitmproxy on a test device and authenticate as the test user\n2. Capture all API responses during a complete user session (login, view accounts, transfer, logout)\n3. Analyze `GET \u002Fapi\u002Fv1\u002Faccounts` response: UI shows 4 fields but API returns 23 fields\n4. Discover that the API returns `routing_number`, `account_holder_ssn_last4`, `internal_risk_score`, `kyc_verification_status`, and `linked_external_accounts` - none shown in UI\n5. Analyze `GET \u002Fapi\u002Fv1\u002Ftransactions` response: API returns `merchant_id`, `terminal_id`, `authorization_code`, `processor_response` fields not needed by the client\n6. Check `GET \u002Fapi\u002Fv1\u002Fusers\u002Fme`: API returns `last_login_ip`, `mfa_backup_codes_remaining`, `account_officer_name`, and `credit_score_band`\n7. Test error responses: `POST \u002Fapi\u002Fv1\u002Ftransfers` with invalid payload returns SQL table name in error message\n\n**Pitfalls**:\n- Only checking top-level fields and missing sensitive data in deeply nested objects\n- Not testing paginated responses where subsequent pages may include different fields\n- Ignoring response headers that may leak server version, backend technology, or internal routing information\n- Missing data exposure in error responses which often contain stack traces, SQL queries, or internal paths\n- Assuming that HTTPS encryption prevents data exposure (it protects in transit, not from the authenticated client)\n\n## Output Format\n\n```\n## Finding: Excessive Data Exposure in Account and Transaction APIs\n\n**ID**: API-DATA-001\n**Severity**: High (CVSS 7.1)\n**OWASP API**: API3:2023 - Broken Object Property Level Authorization\n**Affected Endpoints**:\n  - GET \u002Fapi\u002Fv1\u002Faccounts\n  - GET \u002Fapi\u002Fv1\u002Ftransactions\n  - GET \u002Fapi\u002Fv1\u002Fusers\u002Fme\n\n**Description**:\nThe API returns full database objects to the client, including sensitive fields\nthat are not displayed in the mobile application UI. The mobile app filters\nthese fields client-side, but they are fully accessible by intercepting the\nAPI response. This exposes SSN fragments, internal risk scores, and KYC\nverification data for any authenticated user.\n\n**Excess Fields Discovered**:\n- \u002Faccounts: routing_number, account_holder_ssn_last4, internal_risk_score,\n  kyc_verification_status, linked_external_accounts (18 excess fields total)\n- \u002Ftransactions: merchant_id, terminal_id, authorization_code,\n  processor_response (12 excess fields total)\n- \u002Fusers\u002Fme: last_login_ip, mfa_backup_codes_remaining, credit_score_band\n\n**Impact**:\nAn authenticated user can extract sensitive financial data, internal risk\nassessments, and PII for their own account that the application is not\nintended to reveal. Combined with BOLA vulnerabilities, this data could\nbe extracted for all users.\n\n**Remediation**:\n1. Implement server-side response filtering using DTOs\u002Fview models that only include fields needed by the client\n2. Use GraphQL field-level authorization or REST response schemas per endpoint per role\n3. Remove sensitive fields from API responses at the serialization layer\n4. Implement response schema validation in the API gateway to strip undocumented fields\n5. Add automated tests that verify response schemas match documentation\n```\n","# Exploiting Excessive Data Exposure in API\n\n## When to Use\n\n- Testing APIs where the frontend displays a subset of data but the API response includes additional fields\n- Assessing mobile application APIs where responses are designed for multiple client types and may contain excess data\n- Identifying PII leakage in API responses that include email addresses, phone numbers, SSNs, or payment data not shown in the UI\n- Testing GraphQL APIs where clients can request arbitrary fields including sensitive attributes\n- Evaluating APIs after microservice refactoring where internal service-to-service data leaks into public endpoints\n\n**Do not use** without written authorization. Data exposure testing involves capturing and analyzing potentially sensitive personal data.\n\n## Prerequisites\n\n- Written authorization specifying target API endpoints and scope\n- Burp Suite Professional or mitmproxy configured as intercepting proxy\n- Two test accounts at different privilege levels (regular user and admin)\n- Browser developer tools or mobile proxy setup for traffic capture\n- Python 3.10+ with `requests` and `json` libraries\n- API documentation (OpenAPI spec) for comparison against actual responses\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Workflow\n\n### Step 1: Response Schema Discovery\n\nCompare documented API responses with actual responses:\n\n```python\nimport requests\nimport json\n\nBASE_URL = \"https:\u002F\u002Ftarget-api.example.com\u002Fapi\u002Fv1\"\nheaders = {\"Authorization\": \"Bearer \u003Cuser_token>\", \"Content-Type\": \"application\u002Fjson\"}\n\n# Fetch a resource and analyze all returned fields\nendpoints_to_test = [\n    (\"GET\", \"\u002Fusers\u002Fme\", None),\n    (\"GET\", \"\u002Fusers\u002Fme\u002Forders\", None),\n    (\"GET\", \"\u002Fproducts\", None),\n    (\"GET\", \"\u002Fusers\u002Fme\u002Fsettings\", None),\n    (\"GET\", \"\u002Ftransactions\", None),\n]\n\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        data = resp.json()\n        # Recursively extract all field names\n        def extract_fields(obj, prefix=\"\"):\n            fields = []\n            if isinstance(obj, dict):\n                for k, v in obj.items():\n                    full_key = f\"{prefix}.{k}\" if prefix else k\n                    fields.append(full_key)\n                    fields.extend(extract_fields(v, full_key))\n            elif isinstance(obj, list) and obj:\n                fields.extend(extract_fields(obj[0], f\"{prefix}[]\"))\n            return fields\n\n        all_fields = extract_fields(data)\n        print(f\"\\n{method} {path} - {len(all_fields)} fields returned:\")\n        for f in sorted(all_fields):\n            print(f\"  {f}\")\n```\n\n### Step 2: Sensitive Data Pattern Detection\n\nScan API responses for sensitive data patterns:\n\n```python\nimport re\n\nSENSITIVE_PATTERNS = {\n    \"email\": r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}',\n    \"phone\": r'(\\+?1?\\s?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})',\n    \"ssn\": r'\\b\\d{3}-\\d{2}-\\d{4}\\b',\n    \"credit_card\": r'\\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13})\\b',\n    \"password_hash\": r'\\$2[aby]?\\$\\d{2}\\$[.\u002FA-Za-z0-9]{53}',\n    \"api_key\": r'(?:api[_-]?key|apikey)[\"\\s:=]+[\"\\']?([a-zA-Z0-9_\\-]{20,})',\n    \"internal_ip\": r'\\b(?:10\\.\\d{1,3}|172\\.(?:1[6-9]|2\\d|3[01])|192\\.168)\\.\\d{1,3}\\.\\d{1,3}\\b',\n    \"aws_key\": r'AKIA[0-9A-Z]{16}',\n    \"jwt_token\": r'eyJ[A-Za-z0-9_-]+\\.eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+',\n    \"uuid\": r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',\n}\n\nSENSITIVE_FIELD_NAMES = [\n    \"password\", \"password_hash\", \"secret\", \"token\", \"ssn\", \"social_security\",\n    \"credit_card\", \"card_number\", \"cvv\", \"pin\", \"private_key\", \"api_key\",\n    \"internal_id\", \"debug\", \"trace\", \"stack_trace\", \"created_by_ip\",\n    \"last_login_ip\", \"salt\", \"session_id\", \"refresh_token\", \"mfa_secret\",\n    \"date_of_birth\", \"bank_account\", \"routing_number\", \"tax_id\"\n]\n\ndef scan_response(endpoint, response_text):\n    findings = []\n    # Check for sensitive data patterns in values\n    for pattern_name, pattern in SENSITIVE_PATTERNS.items():\n        matches = re.findall(pattern, response_text)\n        if matches:\n            findings.append({\n                \"endpoint\": endpoint,\n                \"type\": \"sensitive_value\",\n                \"pattern\": pattern_name,\n                \"count\": len(matches),\n                \"sample\": matches[0][:20] + \"...\" if len(matches[0]) > 20 else matches[0]\n            })\n\n    # Check for sensitive field names\n    response_lower = response_text.lower()\n    for field in SENSITIVE_FIELD_NAMES:\n        if f'\"{field}\"' in response_lower or f\"'{field}'\" in response_lower:\n            findings.append({\n                \"endpoint\": endpoint,\n                \"type\": \"sensitive_field\",\n                \"field_name\": field\n            })\n\n    return findings\n\n# Scan all endpoint responses\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        findings = scan_response(f\"{method} {path}\", resp.text)\n        for f in findings:\n            print(f\"[FINDING] {f['endpoint']}: {f['type']} - {f.get('pattern', f.get('field_name'))}\")\n```\n\n### Step 3: Compare UI Display vs API Response\n\n```python\n# Fields the UI shows (observed from the frontend application)\nui_displayed_fields = {\n    \"\u002Fusers\u002Fme\": {\"name\", \"email\", \"avatar_url\", \"role\"},\n    \"\u002Fusers\u002Fme\u002Forders\": {\"order_id\", \"date\", \"status\", \"total\"},\n    \"\u002Fproducts\": {\"id\", \"name\", \"price\", \"image_url\", \"description\"},\n}\n\n# Fields the API actually returns\nfor method, path, body in endpoints_to_test:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code == 200:\n        data = resp.json()\n        if isinstance(data, list):\n            actual_fields = set(data[0].keys()) if data else set()\n        elif isinstance(data, dict):\n            # Handle paginated responses\n            items_key = next((k for k in data if isinstance(data[k], list)), None)\n            if items_key and data[items_key]:\n                actual_fields = set(data[items_key][0].keys())\n            else:\n                actual_fields = set(data.keys())\n        else:\n            continue\n\n        expected = ui_displayed_fields.get(path, set())\n        excess = actual_fields - expected\n        if excess:\n            print(f\"\\n{method} {path} - EXCESS FIELDS (not shown in UI):\")\n            for field in sorted(excess):\n                print(f\"  - {field}\")\n```\n\n### Step 4: Test User Object Exposure in Related Endpoints\n\n```python\n# Many APIs embed full user objects in responses for orders, comments, etc.\nendpoints_with_user_objects = [\n    \"\u002Forders\",          # Each order may include full seller\u002Fbuyer profile\n    \"\u002Fcomments\",        # Comments may include full author profile\n    \"\u002Freviews\",         # Reviews may expose reviewer details\n    \"\u002Ftransactions\",    # Transactions may include counterparty info\n    \"\u002Fteam\u002Fmembers\",    # Team listing may expose excessive member data\n]\n\nfor path in endpoints_with_user_objects:\n    resp = requests.get(f\"{BASE_URL}{path}\", headers=headers)\n    if resp.status_code == 200:\n        text = resp.text\n        # Check for user data leakage in nested objects\n        user_fields_found = []\n        for field in [\"password_hash\", \"last_login_ip\", \"mfa_enabled\", \"phone_number\",\n                      \"date_of_birth\", \"ssn\", \"internal_notes\", \"salary\", \"address\"]:\n            if f'\"{field}\"' in text:\n                user_fields_found.append(field)\n        if user_fields_found:\n            print(f\"[EXCESSIVE] {path} exposes user fields: {user_fields_found}\")\n```\n\n### Step 5: GraphQL Over-Fetching Analysis\n\n```python\n# GraphQL allows clients to request any available field\nGRAPHQL_URL = f\"{BASE_URL}\u002Fgraphql\"\n\n# Introspection query to discover all fields on User type\nintrospection = {\n    \"query\": \"\"\"\n    {\n      __type(name: \"User\") {\n        fields {\n          name\n          type {\n            name\n            kind\n          }\n        }\n      }\n    }\n    \"\"\"\n}\n\nresp = requests.post(GRAPHQL_URL, headers=headers, json=introspection)\nif resp.status_code == 200:\n    fields = resp.json().get(\"data\", {}).get(\"__type\", {}).get(\"fields\", [])\n    print(\"Available User fields via GraphQL:\")\n    for f in fields:\n        sensitivity = \"SENSITIVE\" if f[\"name\"] in SENSITIVE_FIELD_NAMES else \"normal\"\n        print(f\"  {f['name']} ({f['type']['name']}) [{sensitivity}]\")\n\n# Try to query sensitive fields\nsensitive_query = {\n    \"query\": \"\"\"\n    query {\n      users {\n        id\n        email\n        passwordHash\n        socialSecurityNumber\n        internalNotes\n        lastLoginIp\n        mfaSecret\n        apiKey\n      }\n    }\n    \"\"\"\n}\nresp = requests.post(GRAPHQL_URL, headers=headers, json=sensitive_query)\nif resp.status_code == 200 and \"errors\" not in resp.json():\n    print(\"[CRITICAL] GraphQL exposes sensitive user fields without restriction\")\n```\n\n### Step 6: Debug and Internal Data Leakage\n\n```python\n# Test for debug information in responses\ndebug_headers_to_check = [\n    \"X-Debug-Token\", \"X-Debug-Info\", \"Server\", \"X-Powered-By\",\n    \"X-Request-Id\", \"X-Correlation-Id\", \"X-Backend-Server\",\n    \"X-Runtime\", \"X-Version\", \"X-Build-Version\"\n]\n\nresp = requests.get(f\"{BASE_URL}\u002Fusers\u002Fme\", headers=headers)\nfor h in debug_headers_to_check:\n    if h.lower() in {k.lower(): v for k, v in resp.headers.items()}:\n        print(f\"[INFO LEAK] Header {h}: {resp.headers.get(h)}\")\n\n# Test error responses for stack traces\nerror_payloads = [\n    (\"GET\", \"\u002Fusers\u002Finvalid-id-format\", None),\n    (\"POST\", \"\u002Forders\", {\"invalid\": \"payload\"}),\n    (\"GET\", \"\u002Fusers\u002F-1\", None),\n    (\"GET\", \"\u002Fusers\u002F0\", None),\n]\n\nfor method, path, body in error_payloads:\n    resp = requests.request(method, f\"{BASE_URL}{path}\", headers=headers, json=body)\n    if resp.status_code >= 400:\n        text = resp.text.lower()\n        if any(kw in text for kw in [\"stack trace\", \"traceback\", \"at com.\", \"at org.\",\n                                      \"file \\\"\", \"line \", \"exception\", \"sql\", \"query\"]):\n            print(f\"[DEBUG LEAK] {method} {path} -> {resp.status_code}: Contains stack trace or query info\")\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Excessive Data Exposure** | API returns more data fields than the client needs, relying on frontend filtering to hide sensitive information from users |\n| **Over-Fetching** | Requesting or receiving more data than needed for a specific operation, common in REST APIs that return fixed response schemas |\n| **Response Filtering** | Client-side filtering of API response data to display only relevant fields, which provides zero security since the full response is interceptable |\n| **Object Property Level Authorization** | OWASP API3:2023 - ensuring that users can only read\u002Fwrite object properties they are authorized to access |\n| **PII Leakage** | Unintended exposure of Personally Identifiable Information in API responses including names, emails, addresses, SSNs, or financial data |\n| **Schema Validation** | Enforcing that API responses conform to a defined schema, stripping unauthorized fields before transmission |\n\n## Tools & Systems\n\n- **Burp Suite Professional**: Intercept API responses and use the Comparer tool to diff expected vs actual response schemas\n- **mitmproxy**: Scriptable proxy for automated response analysis with Python-based content inspection scripts\n- **OWASP ZAP**: Passive scanner detects information disclosure in headers, error messages, and response bodies\n- **Postman**: Compare documented response schemas against actual API responses using test scripts\n- **jq**: Command-line JSON processor for extracting and analyzing specific fields from API responses\n\n## Common Scenarios\n\n### Scenario: Mobile Banking API Data Exposure Assessment\n\n**Context**: A mobile banking application's API returns full account objects to the mobile client, which only displays account nickname and balance. The API is accessed by both iOS and Android apps and a web portal.\n\n**Approach**:\n1. Configure mitmproxy on a test device and authenticate as the test user\n2. Capture all API responses during a complete user session (login, view accounts, transfer, logout)\n3. Analyze `GET \u002Fapi\u002Fv1\u002Faccounts` response: UI shows 4 fields but API returns 23 fields\n4. Discover that the API returns `routing_number`, `account_holder_ssn_last4`, `internal_risk_score`, `kyc_verification_status`, and `linked_external_accounts` - none shown in UI\n5. Analyze `GET \u002Fapi\u002Fv1\u002Ftransactions` response: API returns `merchant_id`, `terminal_id`, `authorization_code`, `processor_response` fields not needed by the client\n6. Check `GET \u002Fapi\u002Fv1\u002Fusers\u002Fme`: API returns `last_login_ip`, `mfa_backup_codes_remaining`, `account_officer_name`, and `credit_score_band`\n7. Test error responses: `POST \u002Fapi\u002Fv1\u002Ftransfers` with invalid payload returns SQL table name in error message\n\n**Pitfalls**:\n- Only checking top-level fields and missing sensitive data in deeply nested objects\n- Not testing paginated responses where subsequent pages may include different fields\n- Ignoring response headers that may leak server version, backend technology, or internal routing information\n- Missing data exposure in error responses which often contain stack traces, SQL queries, or internal paths\n- Assuming that HTTPS encryption prevents data exposure (it protects in transit, not from the authenticated client)\n\n## Output Format\n\n```\n## Finding: Excessive Data Exposure in Account and Transaction APIs\n\n**ID**: API-DATA-001\n**Severity**: High (CVSS 7.1)\n**OWASP API**: API3:2023 - Broken Object Property Level Authorization\n**Affected Endpoints**:\n  - GET \u002Fapi\u002Fv1\u002Faccounts\n  - GET \u002Fapi\u002Fv1\u002Ftransactions\n  - GET \u002Fapi\u002Fv1\u002Fusers\u002Fme\n\n**Description**:\nThe API returns full database objects to the client, including sensitive fields\nthat are not displayed in the mobile application UI. The mobile app filters\nthese fields client-side, but they are fully accessible by intercepting the\nAPI response. This exposes SSN fragments, internal risk scores, and KYC\nverification data for any authenticated user.\n\n**Excess Fields Discovered**:\n- \u002Faccounts: routing_number, account_holder_ssn_last4, internal_risk_score,\n  kyc_verification_status, linked_external_accounts (18 excess fields total)\n- \u002Ftransactions: merchant_id, terminal_id, authorization_code,\n  processor_response (12 excess fields total)\n- \u002Fusers\u002Fme: last_login_ip, mfa_backup_codes_remaining, credit_score_band\n\n**Impact**:\nAn authenticated user can extract sensitive financial data, internal risk\nassessments, and PII for their own account that the application is not\nintended to reveal. Combined with BOLA vulnerabilities, this data could\nbe extracted for all users.\n\n**Remediation**:\n1. Implement server-side response filtering using DTOs\u002Fview models that only include fields needed by the client\n2. Use GraphQL field-level authorization or REST response schemas per endpoint per role\n3. Remove sensitive fields from API responses at the serialization layer\n4. Implement response schema validation in the API gateway to strip undocumented fields\n5. Add automated tests that verify response schemas match documentation\n```\n",{"name":5,"tags":25,"author":31,"domain":32,"license":15,"version":33,"nist_csf":34,"subdomain":26,"description":7,"mitre_attack":39},[26,27,28,29,30],"api-security","owasp","data-exposure","rest-security","pii-leakage","mahipal","cybersecurity","1.0.0",[35,36,37,38],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01",[40,41,42,43,44],"T1190","T1059.007","T1552.001","T1027","T1070","main","8a3b3de73262a4c4db64523949360f3c599c2fb1","Anthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api",0,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use","https:\u002F\u002Fgithub.com\u002FSaiVatsal","https:\u002F\u002Fsaivatsal.github.io\u002FPortfolio\u002F","The Longer It Takes The Stronger It Becomes ","2026-09-21 22:45:58",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add SaiVatsal\u002FSkills-I-Use --skill exploiting-excessive-data-exposure-in-api",{"tool":60,"command":61},"bunx","bunx skills add SaiVatsal\u002FSkills-I-Use --skill exploiting-excessive-data-exposure-in-api",{"tool":63,"command":64},"pnpm","pnpm dlx skills add SaiVatsal\u002FSkills-I-Use --skill exploiting-excessive-data-exposure-in-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api\u002FSKILL.md",true,[68,72,78],{"path":69,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fapi-reference.md","REFERENCE","参考文档",2231,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api\u002Freferences\u002Fapi-reference.md",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fagent.py","SCRIPT","脚本",5722,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fexploiting-excessive-data-exposure-in-api\u002Fscripts\u002Fagent.py",[85,93,101,110,117,124],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":20},"01M7DJZP6E6KMBQV4CZSDPZEZ8","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":20},"01M7DJZFTS5TS06K2TV3MDTE67","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":105,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":20},"01M7DJRK4SRQ908F2TJM6EZ7EV","ui-styling","Create beautiful, accessible user interfaces with shadcn\u002Fui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.","MIT","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":105,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":20},"01M7DJR902059VEQP23PVM2WA0","design","Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social\u002Fads\u002Fweb\u002Fprint), icon design (15 styles, SVG, Gemini 3.1 Pro), social photos (HTML→screenshot, multi-platform). Actions: design logo, create CIP, generate mockups, build slides, design banner, generate icon, create social photos, social media images, brand identity, design system. Platforms: Facebook, Twitter, LinkedIn, YouTube, Instagram, Pinterest, TikTok, Threads, Google Ads.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":105,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":20},"01M7DJR56QF5N6XYTCPCFHFMNP","design-system","Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing\u002Ftypography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign-system\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":105,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":20},"01M7DJQXB6M0SFF7NX8J5N01AH","banner-design","Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with AI-generated visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter\u002FX, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage. Uses ui-ux-pro-max, frontend-design, ai-artist, ai-multimodal skills.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fbanner-design\u002FSKILL.md",[],[]]