Warnning for Files,site and Fortune

Be mudane tasks such as checking email,sending messages to friends,or online trading where millions are at stake, the web knites it all together.A minute of service disruption and the fairy-tale transfigures into nightmare.
Hackers have always been targetting the bull's eye,explotting the tiniest loophole in the web and make it all go kaboom. all this was incepted ever since it began getting un-blurred before the common men. I show you some of the simple but importent tricks which can be used to make the web a scary place.

1.SQL Injection-Anaesthesia for the DB

In the early days,developers used microsoft frontpage to design web sites.Today,we want web sites to have that human accent,understand what we need, and obey our commands. Almost every website you visit is run over some program which receive your request,analyses it and produces a web page. PHP,ASP,  .NET, Python and java are some of the wellknown languages used for server side scripting.Along with a language,adynamic web site also uses a database.

To read and write data from the database,one needs to use a language called structured Query Language or SQL for short. whenever you enterdata in aform and 'submit' it, the request is converted into an SQL query,which is then sent to the database.For example,if you enter your username and password and 'sign-in',they are sent to the database in the form of a query.The database replies back and the server determines whetther the login was succesful or not.

A simple line in PHP  for building the database query from user input would be:

$query ="SELECT userid FROM password WHERE username = '$username' and password ='$password' ";

Here we assume that the variebles $username and $password already have th neccessary values from the form. Assuming that you entered username and password as madam passwords are stored is user_table,the query would look like:

SELECT userid  FROM user_table WHERE username='madam' AND password='madam';


Assuming the password was correct , the database will return one row containing one column with the userid of the user. If you entered a wrong password such as random , the database will not be able to find the username with such a password and report accordingly, resulting in a failed login.


Now, let's get innovative and enter the username as madam and type the  following in the password columm:

'madam' OR password like '%' AND username='madam';--


Considering the way it is working, the server will create a query like:

SELECT userid FROM user_table WHERE username='madam' AND password like '%' AND username='madam';--;

Noticed, the double dash,eh?The database ignored anything after the double dash(--)charecters in SQL querry.This means that the above querry will request the database to search for a user with username "madam" and password  also madam or search for user with any password ,but username madam .In such  a case , the database to search for a user whose username is madam and return his userid.

0 comments:

Post a Comment