SQL injection mitigation

Because 'OR 1='1 is permanently true so that this will find the query of the 'Alice' without password.
"SELECT * FROM Alice WHERE '' OR 1=1 #" 
Blind injection:
Because 'AND 1=2' is permanently false, so that this page with Alice will not load, we can make sure the page has SQL injection vulnerability.
"SELECT * FROM 'Alice' WHERE '' AND 1=2 #" 
Mitigation

The best way to mitigate SQL injection is not to use an insecure method of passing queries to the database. You should always be using prepared statements to pass queries to the database.

A prepared statement is a way of generating a query where the query and the search term are distinct. When the query is made, the programmer will specify which parts of the query are data. These areas will then always be treated as data and cannot be mistaken for part of the query, no matter what is entered.

Popular posts from this blog

Phonebook - Hack the box Write up -- Web LDAP injection

wafwaf -- Hack The Box -- Web SQL injection

Cheat sheet for security+