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 [email protected]',then it will be executed like
***********************
SELECT fieldlist FROM table WHERE field ='[email protected]'';
***********************
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 ='[email protected]' 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.