Hackers can use simple SQL commands to insert, delete or take control of your entire database. By finding the database on the web, simple commands are ran against the database thus returning confidential data that can be copied and saved to the Hacker’s computer. Here’s an example of a simple SQL Injection:
This is bypassing login forms. Here’s an example of the actual application code:
SQLQuery = "SELECT Username FROM Users WHERE
Username = ‘" &
strUsername & "‘ AND Password = ‘" & strPassword & "‘"
strAuthCheck = GetQueryResult(SQLQuery)
If strAuthCheck = "" Then
boolAuthenticated = False
boolAuthenticated = True
During a typical login, a end-user goes to the site and submits their username and password. The Query goes to the ‘Users’ table to see if there is a row within the table that contains a username and password. With bad ASP code or PHP code, the hacker may be able to this type of code to get in.
Login: ‘ OR ‘‘=‘
Password: ‘ OR ‘‘=‘
This gives SQLQuery the following value:
SELECT Username FROM Users WHERE Username = ‘‘
OR ‘‘=‘‘ AND
Password = ‘‘ OR ‘‘=‘‘
By leaving this information without a valid username but placing quotes and the word ‘OR’ or the symbol ‘=‘ , the hacker may be able to bypass this login screen.