tags:

views:

183

answers:

4

I'm putting together a best practices training program for agile and there are no real good resources for secure design and testing related to Agile (as far as my contextual searching ability has shown). What are the best practices for testing security per release? If it is a monthly release, are there shops doing pen-tests every month?

+1  A: 

I'm no expert on Agile development, but I would imagine that integrating some basic automated pen-test software into your build cycle would be a good start. I have seen several software packages out there that will do basic testing and are well suited for automation.

pix0r
+1  A: 

I'm not a security expert, but I think the most important fact you should be aware of, before testing security, is what you are trying to protect. Only if you know what you are trying to protect, you can do a proper analysis of your security measures and only then you can start testing those implemented measures.

Very abstract, I know. However, I think it should be the first step of every security audit.

david
+1 Well put, @David. I *am* a security expert, and somehow I still see so-called "experts" that don't get this basic principle.
AviD
+1  A: 

Unit testing, Defense Programming and lots of logs

Unit testing

Make sure you unit test as early as possible (e.g. the password should be encrypted before sending, the SSL tunnel is working, etc). This would prevent your programmers from accidentally making the program insecure.

Defense Programming

I personally call this the Paranoid Programming but Wikipedia is never wrong (sarcasm). Basically, you add tests to your functions that checks all the inputs:

  • is the user's cookies valid?
  • is he still currently logged in?
  • are the function's parameters protected against SQL injection? (even though you know that the input are generated by your own functions, you will test anyway)

Logging

Log everything like crazy. Its easier to remove logs then to add them. A user have logged in? Log it. A user found a 404? Log it. The admin edited/deleted a post? Log it. Someone was able to access a restricted page? Log it.

Don't be surprised if your log file reaches 15+ Mb during your development phase. During beta, you can decide which logs to remove. If you want, you can add a flag to decide when a certain event is logged.

MrValdez
+2  A: 

What's your application domain? It depends.

Since you used the word "Agile", I'm guessing it's a web app. I have a nice easy answer for you.

Go buy a copy of Burp Suite (it's the #1 Google result for "burp" --- a sure endorsement!); it'll cost you 99EU, or ~$180USD, or $98 Obama Dollars if you wait until November.

Burp works as a web proxy. You browse through your web app using Firefox or IE or whatever, and it collects all the hits you generate. These hits get fed to a feature called "Intruder", which is a web fuzzer. Intruder will figure out all the parameters you provide to each one of your query handlers. It will then try crazy values for each parameter, including SQL, filesystem, and HTML metacharacters. On a typical complex form post, this is going to generate about 1500 hits, which you'll look through to identify scary --- or, more importantly in an Agile context, new --- error responses.

Fuzzing every query handler in your web app at each release iteration is the #1 thing you can do to improve application security without instituting a formal "SDLC" and adding headcount. Beyond that, review your code for the major web app security hot spots:

  • Use only parameterized prepared SQL statements; don't ever simply concatenate strings and feed them to your database handle.

  • Filter all inputs to a white list of known good characters (alnum, basic punctuation), and, more importantly, output filter data from your query results to "neutralize" HTML metacharacters to HTML entities (quot, lt, gt, etc).

  • Use long random hard-to-guess identifiers anywhere you're currently using simple integer row IDs in query parameters, and make sure user X can't see user Y's data just by guessing those identifiers.

  • Test every query handler in your application to ensure that they function only when a valid, logged-on session cookie is presented.

  • Turn on the XSRF protection in your web stack, which will generate hidden form token parameters on all your rendered forms, to prevent attackers from creating malicious links that will submit forms for unsuspecting users.

  • Use bcrypt --- and nothing else --- to store hashed passwords.

tqbf