views:

85

answers:

3

I would like to ask the proactive (or paranoid;) among us: What are you looking for, and how?

I'm thinking mainly about things that can be watched for programaticaly, rather than manually inspecting logs.

For example:

  • Manual/automated hack attempts
  • Data skimming
  • Bot registrations (that have evaded captcha etc.)
  • Other unwanted behaviour

Just wondering what most people would consider practical and effective..

EDIT: Preventative stuff (like user input sanitation) is of course crucial, but in the case of this question I'm more interested in detecting a potential threat. In this case I'm interested in the Burglar alarm, rather than the locks, if you like ;)

EDIT2: An example of the kind of thing I'm talking about exists here on SO. If you make too many modifications to a question in a short period of time, it brings up a captcha to make sure you're not a bot.

+3  A: 

Three pointers for you:

  1. Sanitize user input
  2. Sanitize user input
  3. Sanitize user input

Remeber it, and remember it good.

LukeN
Repetition breeds reinforcement... repetition breeds reinforcement... repetition breeds reinforcement... (+1)
Platinum Azure
You see, that's one of the most common, most destructive and easiest thing to forget!
LukeN
Yeah :) +1, But assuming that we believe we have done as much as we humanly can regarding user input, what would you do to make sure you were quickly alerted to a problem?
UpTheCreek
The problem with bad data getting into the system is, when even the programmers couldn't take care about it getting in there, how should the program know it's bad or dangerous? When you can detect misbehavior, you can already block it in the first place.
LukeN
Not all vulnerabilities are caused by not "Sanitizing user input". CSRF is a good example because it is so wide spread.
Rook
@The Roook: Of course I can't generalize it, but I never said that user input is the ONLY source for problems, I'm just stressing this particular point because it's such a HUGE one! MySQL injections, cross site scripting vulnverabilities and many more are all related to it!
LukeN
@Luke - But with behaviours it's not so simple, you can't simply always block activity, because it might be legitimate. But you might want to flag it as suspicious.
UpTheCreek
+1  A: 

An application that looks for malicious http requests before the make it to the web application is called a Web Application Firewall. Most WAFs can be configured to send emails when attacks are detected, thus you have a "Burglar Alarm". WAFs are more useful to prevent attacks before they reach your web application, which is more like a brick wall that gets pissed off when you touch it.

Rook
Thanks, but I was rather meaning detecting unusual behaviour in the application itself (which might be considered perfectly legitimate requests by the firewall). (e.g. most firewalls will not normally be able to help with detecting bot activity)
UpTheCreek
@Sosh it entierly depends on the type of bot. A WAF will cause serious problems for vulnerability scanners like this: http://www.acunetix.com/
Rook
+2  A: 

You could look at statistical anomalies. For example, keep a running average of the percentage of failed logins for each hour over the last day. If that percentage suddenly becomes, say, three times as large, you may be looking at a password breaking attempt.

There's no way to tell up front what the right parameters for such an algorithm would be. I'd say you start by making them overly sensitive, then tune them down until the number of false positives becomes acceptable.

Thomas
Good Idea..... +1
UpTheCreek