HTTP
HTTP Smuggling
A smuggling vulnerability happens beacuse there are multiple ambiguous ways to define the length of an HTTP request the Content-Length
header and the Transfer-Encoding
header that is used to define the total length of a message split in chunked requests. Clients and servers may parse these headers differently and allow to include unexpected code in a HTTP request
Example of a chunked request
CL.TE Exploit
Front end uses Content-Length
and back end uses Transfer-Encoding
If during the test you receive an "Header duplicated" error use the following request to override the header
TE.CL Exploit
Front end uses Transfer-Encoding
and back end uses Content-Length
TE.TE Exploit
Both the client and the server use Transfer-Encoding
but one of them can be tricked to not parse the header by obfuscating it
Complete request
Reflected XSS
Allows to easily target an HTTP header and body. When a user sends his request it will be appended to the malicious smuggled request and will trigger the XSS vulnerability without requiring interaction
Open redirect
Allows to redirect the user to an arbitrary site by overwriting the Host
header
Reflect a user's request as value of an argument
Allows to steal a HTTP request from a user and print it as the value of a parameter in a GET or POST request
For instance if the target request is like /save?username=usr&msg=text
it is possible to steal the next user's request with the following payload and navigating to a point in the site where the msg parameter is displayed
Host Header Attacks
The host header is used to inform balancers and front end server to where to redirect the user. By tampering this header it is possible to perform SSRF attacks. To find vulnerabilities in how the Host header is parsed by using the following steps
Send an arbitrary host
Check for host validation where only the url is validated and not the port
hostsite.com:evil
Try to send a request with an url as part of an accepted subdomain
evil-hostsite.com
orevilhostsite.com
Duplicate the Host header
Add indentation before or after the header such as tabs spaces and
Sending the request to a full url instead of a relative one may lead the server to parse the header differently
Header overwrite
It is possible to overwrite the value of Host by adding one on the following headers to the request
SSRF
Controlling the Host header allows to scout the internal network of the target machine in order to find other servers. To verifiy the vulnerability replace the Host value with the url of a server you control. If you receive a hit from the target machine or another one in the same network then the servers are vulnerable and you can use bruteforce or dictionary attacks to locate new machines. If the response is a redirect (3XX) then the machine with the given hostname or ip address exists
Last updated