The Challenge
A login form. The backend builds the SQL query by string-concatenating user input without sanitisation.
Approach
' OR '1'='1 closes the existing string literal, appends a condition that is always true, and reopens the string. The resulting query returns all rows, satisfying the login check and printing the flag.
Solution
|
|
Both fields use the payload. The response HTML contains flag{...}; str.find locates the start and end to extract exactly the flag token.
What I Learned
OR-based login bypass is the foundation of SQL injection. It works whenever user input is directly interpolated into a WHERE clause without parameterised queries or escaping. Sending the payload in both fields avoids situations where only one field is vulnerable.