HTTP Parameter Pollution
A new class of Injection
Vulnerability called HTTP Parameter Pollution (HPP) is less known
– Has not received much attention
– First presented by S. di Paola and L. Carettoni at OWASP 2009
• Attack consists of injecting encoded
query string delimiters into existing HTTP parameters (e.g. GET/POST/Cookie)
– If application does not sanitize its inputs, HPP can be used to launch
client-side or server-side attacks
– Attacker may be able to override existing parameter values,
inject a new parameter or exploit variables out of a direct reach
“An attacker overrides or adds HTTP GET/POST parameters by
injecting query string delimiters. Via HPP it may be possible to override
existing hardcoded HTTP parameters, modify the application behaviors, access
and, potentially exploit, uncontrollable variables, and bypass input validation
checkpoints and WAF rules”.
HTTP Parameter Handling
•During interaction with web application, client provides parameters
via GET/POST/Cookie
• HTTP allows the same parameter to be provided twice
– E.g., in a form checkbox
• What happens when the same parameter is provided twice?
demo.testfire.net |
Yahoo |
• An HTTP Parameter
Pollution (HPP) attack occurs
– When a malicious parameter P(inj),
preceded by an encoded query string delimiter (e.g. %26), is injected into an
existing parameter P(host)
• Typical scenario (client-side)
– Web application for election for two
candidates
Link1: <a
href="vote.jsp?poll_id=4568&candidate=white”> Vote for Mr.White </a>
Link2:<a
href="vote.jsp?poll_id=4568&candidate=green”>Vote for Mrs.Green </a>
• The two links are built from the URL
ID = Request.getParameter(“poll_id”)
href_link = “vote.jsp?poll_id=”
+ ID + ”&candidate=xyz”
• No sanitization
• poll_id is
vulnerable and Attacker creates URL:
• The resulting
page now contains injected links:
<a href=vote.jsp?poll_id=4568&candidate=green&candidate=white>
Vote for Mr. White </a>
<a href=vote.jsp?poll_id=4568&candidate=green&candidate=green>
Vote for Mrs. Green </a>
• If the
developer expects to receive a single value
– Jsp’s Request.getParameter(“candidate”)returns the 1st value
– The parameter precedence is consistent…
• Candidate Mrs. Green is always voted!
Consequence
• Override existing (hardcoded) values
• Inject a new parameter
• Exploit a parameter out of a direct reach
• Client-side (user) or server-side
(webapplication) attack
Solutions and Mitigations
• Configuration: If using a Web Application
Firewall (WAF), filters should be carefully configured to detect abnormal HTTP
requests
• Design: Perform URL encoding
• Implementation: Use strict regular expressions
in URL rewriting
• Implementation: Beware of multiple occurrences
of a parameter in a Query String
Cheers!!!!!!!!!
Comments
Post a Comment