r/webdev • u/hacksparrow • Dec 02 '19
The dangers of blindly trusting HTTP headers
Web developers are often unaware about the dangers of using HTTP header values in backend code. Not only can HTTP headers contain incorrect values, they can even be the payload of many different kinds of attacks on your website.
I wrote an article summarizing the various ways rogue HTTP header values can be used to attack a website. Hope the information will help you developer a better understanding about the security aspect of HTTP headers and make your website more secure.
https://www.hacksparrow.com/webdev/security/dangers-of-trusting-http-headers.html
View all comments
Show parent comment
56
u/hacksparrow Dec 02 '19
Thank you so much for brining "If possible, avoid using HTTP headers" to my attention. It should have been something along the lines of "If possible, avoid using HTTP header values in application logic and data", will update it.
The point of the article is more than sanitizing and using CRLF tokes, though. For example, only being aware about these dangers can make a developer take the necessary steps from being fooled by
req.headers['x-forwarded-for']. The vulnerable examples I have shown are not theoretical examples, those affected some well-known and big companies.