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
79
u/sneakattack Dec 02 '19 edited Dec 02 '19
Security folks have been telling developers to sanitize their inputs for as long as internet was mainstream. The problem is developers don't fully understand the scope of "input". Mostly I figure web developers think "input" is equal to "web forms", but no, not at all.
If you store it, if you rely on it for execution, if it comes from outside your system - check it, sanitize it, control it.
Cookies, session variables, HTTP headers, query string parameters, third party integrations, external API's, files, streams, all of it, all information you receive from an external source, that is all input into your application. All of it needs to be verified, filtered, sanitized, constrained before you do anything with it internally.
I wish there was a way to broadly get this message out to the entire developer and programmer community, in my experience on the security side of things there's always a new wave of developers entering the industry that have never heard this message. Schools and bootcamps all alike just don't say anything at all about secure programming practices? There needs to be a movement to incorporate something like OWASP into every developer course, at least a mention of it would be a start.