iEntry 10th Anniversary RSS Archive

IT Management Begins With Security
SecurityProNews > News > Security News > What To Know About SQL Injection Attacks
Search:
[ news_security_news ]

What To Know About SQL Injection Attacks



Dr.Kannan Balakrishnan
Contributing Writer
2006-10-09

SecurityProNews: Insider Reports Insider Reports RSS Feed


Recently when going through some student projects on web design I came across codes similar to the following many times.

$Result =Select * from members where username='$x' and password= ‘$y';

This is typically a code used for user authentication, in which the username and password are collected into variables $x and $y .The students and many web designers assume that such queries are safe and the system is well protected.They also assume that people will give simple strings to the variables $x and $y.

But such lazy coding gives raise to a kind of attack popularly known as SQL injection attack.The attcak primarily consists of inserting SQL queries into the variables and hence getting unauthorized acess. The attacker may get into an admin account. Also he may enter more dangerous commands like insert, Drop etc. into SQL and cause havoc into your database.

Also this is not special to any programming language. Almost all server/client side programming is prone to this. An SQL may be injected to user registration, searches, and similar things.

Another common type of SQL injection attack is by injecting the SQL into the URL directly.

It was seen in the past that many ecommerce sites lost their data and suffered because of such attacks.

How to prevent this?

The only way to prevent this is to adhere to secure coding practices at the database and server levels.

1.Database level:

A user must have only the bare necessary privileges to the database. This is called "the principle of least privileges"

Don't give the connecting user privileges such as drop, delete etc on databases unless it is absolutely needed. This will ensure that damage to the database is minimized.

2.Programming level

Do not pass the query string generated by the user directly onto the database. First pass it through a security layer which checks for unwanted characters, replaces spurious commands etc. and blocks the query if it is suspicious. For example the security layer may find that in the variables passed by the user, there are unnecessary quotes and change them. You can design an abstract security layer, which works for all types of databases and stop attacks.Also many resourses including code are available on the web.What one needs is an awareness of this problem and willingness to read and adopt the techniques.

This is only an elementary exposure to the technique of SQL injection. There are many specific articles dealing with the problem with different databases. some useful links to such articles are given in my blog http://wbforu.blogspot.com.

Tag:

Add to Del.icio.us | Digg | Yahoo! My Web | Furl

Get all the updates in RSS:



About the Author:
Dr.Kannan Balakrishnan is a computer expert and writer. He also writes abouut web business in the blog http://wbforu.blogspot.com/. An expanded version of the above article,including many useful links to web designers can be found in the blog http://\wbforu.blogspot.com.

View their website at: http://kbwrites.blogspot.com

More news_security_news Articles

SecurityProNews: Insider Reports Insider Reports RSS Feed


Get Your Site Submitted for Free in the World's Largest B2B Directory!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

iEntry Featured Services: Jayde Member Services | Forums | Freeware | Advertise with Us

Virus Warnings

Subscribe to
SecurityProNews FREE!



[ more newsletters ]

article resources
Search Articles:
[advanced search]

WebProWorld.com
Get in-touch with industry experts and leaders
Post your site for review by expert and peers
Ask Security, IT, Development and Design questions

Free Membership: Join Now!

Visit WebProWorld.com

Titan Quest Forum
The #1 Titan Quest forum
Halo 3 Forum
The best Halo, Halo 2, Halo 3 forum
Nintendo Wii
Nintendo Wii news and views
Mac Software
The best in OS X freeware
Graphics Forum
Your source for graphic tutorials
SecurityProNews.com | Breaking eBusiness News Get Your IT Questions Answered - Click Here SecurityProNews News Feeds