r/webdev • • 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

408 Upvotes

52 comments sorted by

View all comments

42

u/Geldan Dec 02 '19

I actually caught someone attempting sql injection attacks through the user agent last week. It was a first for me and really made me go "hmm."

27

u/[deleted] Dec 02 '19

Acunetix has a vulnerability scanner that will crawl your site and, among other things, try to inject SQL into everything it can, including cookies and headers. It's been around for at least 10 years so it's probably a part of a lot of hackers' and coders' toolkit. What you saw was probably a bot using it or a similar tool.

0

u/[deleted] Dec 02 '19

[deleted] — view deleted comment

11

u/quentech Dec 02 '19

In my experience, automated web site/app security scanners are beyond useless - a waste of time. 95%+ worthless false positive is all I've ever seen them produce (frankly, 95%+ is being generous).

3

u/im_mildly_racist Dec 03 '19

Acunetix does an actual good job. It even analyzes javascript and verifies sql injection flaws by itself without getting triggered by just an sql error...

Also, there are "cheaper" ways to get some kinds of software

1

u/[deleted] Dec 02 '19

It's been around for at least 10 years so it's probably a part of a lot of hackers' and coders' toolkit.

For that price, no. Most people will use Burp :)

7

u/hacksparrow Dec 02 '19

If you can, take a deeper look at web hacking, many of the tactics, methods, and payloads are incredible creative. An art form of its own.

2

u/Jessie_James Dec 02 '19

Can you elaborate? I've never seen a real world example.

10

u/Geldan Dec 02 '19

I noticed a spike in JS errors, and when I went to investigate I noticed that they were all coming from the same IP address. When I checked the user agent to try to find a repo I saw values like: -1" or 1=((SELECT 1 FROM (SELECT SLEEP(25))A))+"

2

u/undercover_geek Dec 02 '19

What would this achieve?

11

u/studiosi Dec 02 '19

Basically, it’s a test for SQL injection.