tempesta-tech / tempesta

All-in-one solution for high performance web content delivery and advanced protection against DDoS and web attacks
https://tempesta-tech.com/
GNU General Public License v2.0
615 stars 103 forks source link

Check trailers in body-less requests #2240

Open krizhanovsky opened 2 weeks ago

krizhanovsky commented 2 weeks ago

Motivation

We allow requests like:

GET / HTTP/1.1
Host: foo.com
Trailers: X-trailer
X-trailer: foo

It's unclear from RFC how to treat trailers in requests w/o body, so this may potentially open HTTP headers smuggling attack vector. It's also unclear why a client may send such requests. I don't remember any such attacks, so low priority.

Scope

We should drop such requests and increment a security counter. It seems Trailers header must be made special for quick check for the header and empty body.

Testing

Create an appropriate test to a task for the test.

Documentation

No documentation is required.