Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing for security vulnerabilities in web applications: Best practices? [closed]

Tags:

I'm developing a web application. Like, a proper one, I've used things like Joomla in the past to make awesome stuff but have now finally got my hands dirty with PHP, MySQL and CodeIgniter.

When you're making serious web apps that'll handle large amounts of data, what precautions should I take against my data inputs to fully sanitise it? I know there's the obvious trim, escaping, xss cleaning, etc - but what other techniques should I incorporate to stop injections into the database?

Not only that, but is there any non-destructive database injection code I can test all my inputs with? As in, it'll inject something visibile, but not actually do any harm to my test database? I'm not exactly a hacker and need a bit of guidance on this.

What other common methods do hackers use to either destroy or read user's data, and how can I check for this myself? I don't have the money to hire a security consultant since I'm only 16 but have good experience with computers and I'm sure I could pull off a few tricks if given some hints as to what they are.

I know that's a whole load of questions but to summarise, what do you do to make sure everything is 100% secure?

like image 806
Jack Avatar asked Feb 28 '10 14:02

Jack


2 Answers

SQL Injection and XSS are the most common mistakes that programmers make. The good news is that they are easiest to automatically test for, as long as you have the right software. When I am on a pentest I use Sitewatch or Wapiti for finding web application vulnerabilities. Acunetix is over priced.

But, you can't just fire off some automated tool and expect everything to work. There are a number of precautions you must take with ANY vulnerability scanner you choose.

1) make sure display_errors=On in your php.ini Sql Injection tests rely on being able to see mysql error messages in the response pages! No error, no vulnerability detected!

2) Scan the authenticated areas of your application. Create a user account specifically for testing. Acuentix has an easy wizard where you can create a login sequence. If you are using wapiti you can give a cookie to wapiti or give wapiti a post request to fire off but this is kind of tricky.

AFTER you have tested your application then test your server for misconfiguration. To test your server then you need to run OpenVAS which is the new more free version of Nessus which is now a commercial product. Then you should follow this up with PhpSecInfo. These tests will notify you of problems with your configuration or if you are running old vulnerable software.

Nothing will ever be 100% secure, EVER. No matter what you do there are vulnerabilities that will slip though the cracks. There are vulnerabilities in all development platforms that lead a compromises that no tool can test for. There are also bugs in the testing tools you use. There are false posties and false negatives and some tests that just don't work, a good example i have never seen an automated CSRF tool that actually finds legit vulnerabilities. Acunetix's CSRF test is a complete waste of time.

There is also the OWASP testing guide which goes into greater detail. This is not to be confused with the OWASP Top 10 which is also an excellent resource. The PHP Security Guide is also a great resource for php programmers.

like image 79
rook Avatar answered Sep 28 '22 12:09

rook


I don't have the money to hire a security consultant since I'm only 16
You are 16 doesn't mean you don't have money to hire :D .
You don't need to hire anybody. There are many free online tools which you can use to test the vulnerability of your web application.

  1. Try using http://www.zubrag.com/tools/sql-injection-test.php to test SQL Injection vulnerability

  2. http://www.parosproxy.org : web traffic recorder, web spider, hash calculator, and a scanner for testing common web application attacks such as SQL injection and cross-site scripting

  3. HP WebInspect software [ not free ] tests common web attacks such as parameter injection, cross-site scripting, directory traversal, [ try googling it ]

  4. http://portswigger.net/suite/ : Burp Suite is an integrated platform for attacking web applications. It contains all of the Burp tools with numerous interfaces between them designed to facilitate and speed up the process of attacking an application. All tools share the same robust framework for handling HTTP requests, persistence, authentication, upstream proxies, logging, alerting and extensibility.

like image 38
Rakesh Juyal Avatar answered Sep 28 '22 11:09

Rakesh Juyal