Skip to content

HTTP Parameter Pollution

Description

Concatenating unvalidated user input into a URL can allow an attacker to override the value of a request parameter. Attacker may be able to override existing parameter values, inject a new parameter or exploit variables out of a direct reach. HTTP Parameter Pollution (HPP) attacks consist of injecting encoded query string delimiters into other existing parameters. If a web application does not properly sanitize the user input, a malicious user may compromise the logic of the application to perform either client-side or server-side attacks.

Examples

Insecure Code

scala
val url = "https://example.com?param=" + request.getParameter("userInput")

Secure Code

scala
val url = "https://example.com?param=" + java.net.URLEncoder.encode(request.getParameter("userInput"), "UTF-8")

Remediation

Validate and sanitize user input before concatenating it into a URL. Use a whitelist approach to only allow expected parameters and values.

Rule Details

FieldValue
IDCODE-0047
CategoryWeb
SeverityHIGH
CWECWE-88
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsinjection, parameter pollution
OWASPN/A