Injection is done by including portions of SQL
statements in a web form entry field in an attempt to get the website to pass a
newly formed rogue SQL command to the database (e.g. dump the database contents
to the attacker).
- Bypassing Logins
- Accessing secret data
- Modifying contents of website
- Shutting down the My SQL server
SELECT * FROM Users WHERE UserName = ‘John’ AND
Password = ‘Smith’;
SELECT * FROM Users WHERE UserName = ‘John’– AND
Password = ‘Smith’;
- Incorrectly filtered escape characters
This form of SQL injection occurs when user input
is not filtered for escape characters and is then passed into an SQL
statement.
SELECT * FROM users WHERE name = '' OR
'1'='1';
This will fetch any member with John as username.Or If he can enter in username like a';DROP TABLE users; SELECT * FROM userinfo WHERE 't' = 't
SELECT * FROM users WHERE name = 'a';DROP TABLE
users; SELECT * FROM userinfo WHERE 't' = 't';
- Incorrect type handling
This form of SQL injection occurs when a
user-supplied field is not strongly typed or is not checked for type
constraints. This could take place when a numeric field is to be used in a SQL
statement, but the programmer makes no checks to validate that the user supplied
input is numeric
SQL build as
SELECT * FROM userinfo WHERE id=1;DROP TABLE
users;
- Conditional responses
One type of blind SQL injection forces the
database to evaluate a logical statement on an ordinary application screen.
SELECT booktitle FROM booklist WHERE bookId =
'OOk14cd' AND '1'='1';
- Parameterized statements
- Escaping
- Pattern check
- Database Permissions
- "SQL
Injection Prevention Cheat Sheet". Open Web Application Security Project.
Retrieved 3 March 2012.
- Why
SQL Injection Won't Go Away, by Stuart Thomas
- SDL Quick security references on SQL injection by Bala Neerumalla.
No comments:
Post a Comment