sqL injectioN

31 Jul, 2009  |  Written by admin  |  under General

Hello PHP developers!! Working hard !! Writing some creative codes!!Delivering projects on time!!Writing optimized code.Do you feel proud that you are a good developer? If so you should know about SQL INJECTION,else you are not!! .Did you find any vulnerability in your code,especially in security concern?

SQL injection is a technique of inserting code,using the available vulnerability in your code.What is this vulnerability?.Its a window you create for hackers to get in.Let me explain a simple thing.

In authentication page,we have formal Username and password field,and “enter your mail id if you forget your password”.We check the database correctly and we will do the necessary things.If some one forgets his password and enter his emailid to recover his password.And we have select query like

*************************

SELECT fieldlist
  FROM table
 WHERE field ='$email-id'
**************************

Here $email-id is the id entered by the user.If I Am a hacker and try something like
ponna@gmail.com',then it will be executed like

***********************

SELECT fieldlist
  FROM table
 WHERE field ='ponna@gmail.com'';

***********************

Now it will return some sql error which is different from ‘unknown mail-id’

Let us try some thing legally,more technically.Like

***********************

SELECT fieldlist
  FROM table
 WHERE field ='ponna@gmail.com' or 'a'='a';

***********************

So whtever may be the first ,second condition is always true,so it will return all the rows,if db supports multiple return in single execution.

If you really understand this problem ,then reply me with the name of this problem,

and let me know more about SQL INJECTION.

One Response so far | Have Your Say!

  1. vetrivel  |  July 31st, 2009 at 10:39 am #

    Hi ,
    Nice post buddy.
    yes we all need to know about it ,to be a good web developer.
    Its easy for anyone to find a loop hole in the website and enter through it.
    Even some peoples are doing this for a hobby.

    But how do we escaped from this issue.

    Since we are using the products like xcart,magento and open reality ,it will take care of basic security setup(we escaped).
    So we no need to bother about this,but we need to know what this all about and how to over come from this,because in future we may also develop a product like xcart .

    Lucky we are safe for now;-)

    cheers.

    vetrivel - Gravatar

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>