SQL injection vulnerability allowing login bypass

https://portswigger.net/web-security/sql-injection/lab-login-bypass

Let's login using the following credentials:

Username
Password

test

test

The resultant SQL query will be:

This will obviously not log us in as the administrator.

We can next try the following credentials:

Username
Password

administrator'--

password

The resultant SQL query will be:

Since we are commenting out the WHERE clause that requires the password, we will be logged in even if the password is not password.

We have solved the lab.

Last updated

Was this helpful?