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 honorsemail, the response changes. - Override an existing parameter:
name=peter%26name=carlos→ duplicatename. 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_uripollution. PortSwigger and bug-bounty writeups both note duplicateredirect_urias 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
- API Security Testing: A Complete Guide to Reconnaissance, Hidden Endpoints, Mass Assignment, and… · original
- API Testing - Web Security Academy · original
- Starbucks Path Traversal: Nearly 100M Customer Records · original
- A Deep Dive on the Most Critical API Vulnerability: BOLA · original
- Finding More IDORs – Tips and Tricks · original
- PortSwigger: OAuth 2.0 authentication vulnerabilities · original