nerdexam
GIAC

GWAPT · Question #118

During a penetration test, you discover that a login form is vulnerable to SQL injection. Which payload could you use to bypass authentication?

The correct answer is A. ' OR '1'='1. Option A (' OR '1'='1) exploits SQL injection by manipulating the query logic: when injected into a username or password field, the resulting SQL becomes something like WHERE username='' OR '1'='1', which always evaluates to true, bypassing the credential check entirely…

Question

During a penetration test, you discover that a login form is vulnerable to SQL injection. Which payload could you use to bypass authentication?

Options

  • A' OR '1'='1
  • B<script>alert('XSS')</script>
  • C../../etc/passwd
  • D<img src=x onerror=alert(1)>

How the community answered

(30 responses)
  • A
    80% (24)
  • B
    13% (4)
  • C
    7% (2)

Explanation

Option A (' OR '1'='1) exploits SQL injection by manipulating the query logic: when injected into a username or password field, the resulting SQL becomes something like WHERE username='' OR '1'='1', which always evaluates to true, bypassing the credential check entirely.

Options B and D (<script>alert(...)> and <img onerror=...>) are Cross-Site Scripting (XSS) payloads - they target the browser to execute JavaScript, not the database, so they cannot bypass server-side authentication logic. Option C (../../etc/passwd) is a path traversal payload used to read filesystem files, which is a completely different vulnerability class unrelated to login bypass.

Memory tip: Think "SQL injection = talking to the database." The single quote ' is the key character that "breaks out" of the string context in SQL - if you see a payload starting with ', it's almost certainly SQL injection.

Community Discussion

No community discussion yet for this question.

Full GWAPT Practice