# Server-Side Parameter Pollution > SSPP occurs when a public endpoint inserts user input into a server-side request to an internal API without encoding it, so the user can inject or override parameters in the internal request. Related: classic HTTP Parameter Pollution (HPP) and JSON parameter pollution, where duplicate keys are parsed differently by two components. ## How it works - A public app acts as a proxy: the browser can't reach the internal API, but the public app builds a request to it on the user's behalf. If user input is concatenated into that request instead of properly encoded, the user manipulates the resulting internal request. - Impact: override an existing internal parameter, inject a new one, truncate the internal query, traverse an internal path, or corrupt structured (JSON/XML) data built by string concatenation. - **HPP vs SSPP:** HPP sends duplicate parameters to one endpoint; SSPP manipulates a *second*, internal request. Both exploit parsers disagreeing: the authz component and the endpoint (or the public app and the internal API) pick different occurrences of a duplicated key. ## Techniques / payloads Given a public `GET /userSearch?name=peter&back=/home` that internally builds `GET /users/search?name=peter&publicProfile=true`: - **Query truncation** (`%23` = `#`): `name=peter%23foo` → internal `...name=peter#foo&publicProfile=true`; the fragment drops the rest of the internal query. The `#` must be URL-encoded so the client doesn't treat it as a client-side fragment. - **Inject a parameter** (`%26` = `&`): `name=peter%26email=test` → `...name=peter&email=test&publicProfile=true`. If the internal API honors `email`, the response changes. - **Override an existing parameter**: `name=peter%26name=carlos` → duplicate `name`. Last-value wins in PHP, first-value in Node/Express, combined in ASP.NET — so the public app and internal API may disagree on which value applies. - **REST path pollution**: `name=peter%2f..%2fadmin` → internal `/api/private/users/peter/../admin`, which can normalize to a different resource (this is the Starbucks pattern). - **Structured data pollution**: when internal JSON is built by concatenation rather than serialization, special characters in the input alter the JSON structure. **HPP for access control (from IDOR testing):** ``` /api/get_profile?user_id=<legit>&user_id=<victim> {"user_id":<legit>,"user_id":<victim>} # JSON parameter pollution ``` This works when the authorization check and the endpoint parse query/body parameters with different libraries that pick different occurrences. OAuth is a classic target: duplicate `redirect_uri` parameters (`&redirect_uri=client.com/cb&redirect_uri=evil.net`). See [[OAuth 2.0 Vulnerabilities]]. **Detection:** Burp Scanner audits, Backslash Powered Scanner, and diffing a normal vs modified response. A suspicious transformation is not automatically a vuln — verify manually. ## Notable cases - **Starbucks path traversal (2020, Sam Curry, $4,000).** A backend-for-frontend proxy dropped a user-controlled item ID into an internal request path. A WAF blocked the obvious traversal, but a backslash variant passed; error codes (404-style vs bad-request) mapped the internal host. It reached an internal search API over ~100M customer records. CWE-22 + CWE-441 + CWE-284. - **OAuth `redirect_uri` pollution.** PortSwigger and bug-bounty writeups both note duplicate `redirect_uri` as a standard authorization-server test. See [[OAuth 2.0 Vulnerabilities]]. ## Defenses - Never build internal paths or queries from raw input. Validate IDs against a strict format (`^[A-Za-z0-9-]{8,64}
), then URL-encode as a single segment (`quote(id, safe="")`). - Normalize then allowlist: resolve the final internal path and reject anything outside the intended route (`normalise(path).startswith(prefix)`). - Build structured data with a serializer, never string concatenation. - Give the proxy a narrow identity: internal services enforce per-user authz, not "came from the frontend". Don't rely on the WAF — traversal has too many encodings. ## Related - [[API Security]] - [[Server-Side Request Forgery]] - [[BOLA in APIs]] - [[OAuth 2.0 Vulnerabilities]] - [[Mass Assignment]] - [[API Discovery]] ## Sources - [[raw/medium.com/api-security-testing-a-complete-guide-to-reconnaissance-hidden-endpoin-12806|API Security Testing: A Complete Guide to Reconnaissance, Hidden Endpoints, Mass Assignment, and…]] - [[raw/portswigger.net/api-testing-web-security-academy-2746|API Testing - Web Security Academy]] - [[raw/masimshahzad.medium.com/starbucks-path-traversal-nearly-100m-customer-records-15231|Starbucks Path Traversal: Nearly 100M Customer Records]] - [[raw/inonst.medium.com/a-deep-dive-on-the-most-critical-api-vulnerability-bola-4906|A Deep Dive on the Most Critical API Vulnerability: BOLA]] - [[raw/aon.com/finding-more-idors-tips-and-tricks-416|Finding More IDORs – Tips and Tricks]] - [[raw/portswigger.net/portswigger-oauth-2-0-authentication-vulnerabilities-3899|PortSwigger: OAuth 2.0 authentication vulnerabilities]]