Lably
Skip to content

HTTP request smuggling

Web security vulnerability

  • 3 min read
  • 2 chapters

Related on Lably

Through HTTP

The Transfer-Encoding header works by defining a directive on how to interpret the body of the HTTP request, with the common and necessary directive for this attack being the chunked transfer encoding. When the Transfer-Encoding header is present, the Content-Length header is supposed to be omitted. Working similarly but with a different syntax, the Content-Length header works by specifying the size in bytes of the body as a value in the header itself. Vulnerabilities arise when both of these headers are included in a malicious HTTP request, bypassing security functions meant to prevent malicious HTTP queries to the server by causing either the front-end or back-end server to incorrectly interpret the request. HTTP request smuggling commonly takes the form of CL.TE, TE.CL, or TE.TE, although more complex attacks using HRS do exist.

Types

CL.TE

In this type of HTTP request smuggling, the front end processes the request using Content-Length header while backend processes the request using Transfer-Encoding header. The attack would be carried out with the first part of the request declaring a zero length chunk. The front end server seeing this would only read the first part of the request and unintentionally pass the second part to the back end server. Once passed through to the back end server, it would be treated as the next request and processed, carrying out the attackers hidden request.

TE.CL

In this type of HTTP request smuggling, the front end processes request using Transfer-Encoding header while backend processes the request using Content-Length header. In this attack, a hacker would declare the valid length of the first chunk, which houses the malicious request and then declare a second chunk with a length of 0. When the front end server sees the second chunk with a length of 0 it believes the request to be complete and passes it along to the back end server. The back end server processes the request using the Content-Length header, however, and as a result the malicious request left in the first chunk go unprocessed until they are treating as being at the start of next request in the sequence and are carried out.

TE.TE

In this type of HTTP request smuggling, the front end and backend both process the request using Transfer-Encoding header, but the header can be obfuscated in a way (for example by nonstandard whitespace formatting or duplicate headers) that makes one of the servers but not the other one ignore it. Obscuring the header may take the form of adding in an incorrect character, such as Transfer-Encoding: xchunked, or an unusual new line character between 'Transfer-Encoding' and ': chunked'. If one of the front of back end servers still processes these obfuscated HTTP requests, then the rest of the attack will be similar to how CL.TE or TE.CL attacks work.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication