We have come a long way since a bunch of non-interactive pages written in plain HTML were considered to be a cool website. Today’s web sites more often than not are highly interactive, developed using sophisticated client and server side scripting code and with a relational database at the back storing and serving the data needed for website to work… blah blah blah… Well if you are reading this blog, I am sure you know all this theory. So, why I am writing this blog post? Two reasons:
- It’s been a long while since I posted last
- I found something which I wrote 4 years ago and I believe it’s worth sharing
Today, while going through my documents I came across a whitepaper which I wrote in Nov. 2007 titled “Dealing with Threats to Databases”. Yes, the title is same as that of my presentation at OWASP Australia in 2008. The slides for that talk can be found here.
So, If the paper was written in 2007 and presented in 2008, why am I am posting about it today i.e. in 2011.
Answer: The content of the paper is still valid and points raised are still applicable. If you don’t believe me, the proof can be found in the following links:
If you happen to check out these links, you will know that the vulnerability exploited in both the attacks is SQL injection. SQL Injection is not a new issue and has been around since last 8 to 10 years if not more. The application security evangelists have been preaching the countermeasures for the same since a long time as well. So why is the issue still there? I really don’t know the answer to this. May be the language used by the evangelists wasn’t clear enough or way of preaching/teaching/training wasn’t good enough.
So, here I am to explain the countermeasures to protect the databases once and for all. The next few posts (I promise to post the whole section within a week) will be focused on “Securing the databases”.
Just before ending this post I would like to give a “Mantra” to all the developers to avoid SQL injection. Repeat after me:
“ Writing dynamic queries is a sin. Parameterized queries will protect us from the wrath of SQLi.”
“ Writing dynamic queries is a sin. Parameterized queries will protect us from the wrath of SQLi.”
“Writing dynamic queries is a sin. Parameterised queries will protect us from the wrath of SQLi.”
“Writing dynamic queries is a sin. Parameterised queries will protect us from the wrath of SQLi.”
Make sure you remember this Mantra before coming to read the next post. See you all real soon and till then “ parameterized queries will protect us……”