28
2011
Understanding the Sql Injection Attack
When you use information from an outside source to build your SQL Query, you may be vulnerable to SQL Injection attacks. The hacker may manipulate thr SQL Queries, changing it into a query that may affect your website. For example he may build a new sql query and get your admin password very easy.
When you using unchecked data from a form to build your SQL Queries you give to the hackers gold opportunity to exploit your application. In that way he can create an sql statement that serves his purposes. For example if you use the following code for user login:
$user = $_POST[‘user_id’];
$password = $_POST[‘password’];
$sql = “SELECT COUNT(*) FROM arthackers_users
WHERE user_id=’$user’ and password=’$password’”;
In this query your database return any count higher than 0, the user ID and the password for his user id. In this case, the data entered into the form by the users is used without any checking. The hacked may add the following code into the form:
‘ or 1=1 –
SELECT COUNT(*) FROM arthackers_users WHERE user_id=’’ or 1=1 –
and password=’$password’
This query will always return a count higher than 1 because 1=1 is always true. the — makes the rest of the query into a comment, which is ignored by SQL and the user is logged in.
The hackers may using multiple queries for damage your application. Many SQL clients allows many queries to be executed at a time, separated by a semicolon “ ; “ . So the hacker may be able to manipulate your sql queries and insert malicious code.
One measure to protect your database is to escape the quotes in any information. Magic quotes: A setting in your php.ini file that is turned on by default. The addslashes function: A PHP function that escapes quotes. A matching stripslashes function removes the slashes when needed, such as when you want to display the information on the Web page, without displaying a bunch of ugly slashes.
Incoming search terms:
Related And Similar Posts
Leave a comment
Facebook Fans
Share Me With Google Plus!
Popular Posts
Social Bookmarking sites list 2012 - New and fresh bookmarking sites
93 |
Bulgarian proxy or how to open arenabg and zamunda
65 |
+ 150 New Free Directory Sites List 2012 - Sorted by Page Rank
22 |
Scrapebox crack free download ?
19 |
Great List With Google Plus / FB likes/ tweets exchange sites - Hot Topic
16 |
How to make World Of Warcraft Cataclysm Server
10 |
The Best Bulgarian Torrents - Listing
9 |
500 Free Directory List 2011 !
9 |
Free RSS Directory List Where To Submit Your Site
9 |
Guest Blogs List and Useful Information
8 |
Recent Comments
- punjab singh on New Social Bookmarking Sites List PR5-PR8 Only -2012
- Georgi on New Article Directory Sites List – May 2012 + 200 quality sites PR6-PR0
- Djesur on Bulgarian proxy or how to open arenabg and zamunda
- Djesur on Bulgarian proxy or how to open arenabg and zamunda
- Djesur on Bulgarian proxy or how to open arenabg and zamunda

By admin
917 views






