> For the complete documentation index, see [llms.txt](https://rejenthompson.gitbook.io/portswigger-lab-writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rejenthompson.gitbook.io/portswigger-lab-writeups/sql-injection.md).

# SQL INJECTION

## Lab: [SQL injection](https://portswigger.net/web-security/sql-injection) vulnerability allowing login bypass

The above Lab contains a vulnerability in a login function&#x20;

<figure><img src="/files/0G7EmHfZWYu4pNEfj4VP" alt=""><figcaption></figcaption></figure>

-By only knowing the basic username of the account we could be able to access the account with the help of SQL INJECTION.

we can do it by typing an extra characters with the username as below

```
administrator’--

```

the -- part comments out the remaining part

Here, an attacker can log in as any user without a password simply by using the SQL comment sequence `--` to remove the password check from the `WHERE` clause of the query. For example, submitting the username `administrator'--` and a blank password results in the following query
