SQL Injection Boundary Lab
Feed the same payload into unsafe string-built SQL and a prepared statement, then watch the parser and outcome diverge.
Endpoint: POST /login · Input: email = ' OR 1=1 --
One apostrophe closes the original string, the injected boolean changes the meaning, and the comment discards the tail.
SELECT id, email, is_admin FROM users WHERE email = '' OR 1=1 --' AND active = true
STRING('') | OR | 1=1 | COMMENT
Predicate becomes always true. The app may accept the first active row or expose a broad result set.
Parse: SELECT id, email, is_admin FROM users WHERE email = $1 AND active = $2 Bind: [$1 = "' OR 1=1 --", $2 = true]
PLACEHOLDER($1) | VALUE("' OR 1=1 --")
The query compares email to the literal string `\' OR 1=1 --` and usually returns zero rows.
A read-only role still would not make this safe, but it could stop the same bug from turning into writes or destructive follow-on queries.
The application receives bytes from a request. Nothing bad has happened yet. The risk starts when those bytes are allowed to shape SQL text.
Scenario focus: boolean rewrite
Arrow keys to navigate · R to reset
Tap dots to jump to any step