Summary
Injection of arbitrary SQL statements into a query.
SELECT id, user, password FROM user_table WHERE id = '$id';SELECT id, user, password FROM user_table WHERE id = '1';SELECT id, user, password FROM user_table WHERE id = '999';SELECT id, user, password FROM user_table WHERE id = '56';SELECT id, user, password FROM user_table WHERE id = '2' OR user = 'admin';SELECT id, user, password FROM user_table WHERE user = '$supplied_user' AND password = '$supplied_password';On the backend, there's a line checking whether the query returns >0 rows. If it does, the login is successful because there's a user that fits our input.
>0 rows. If it does, the login is successful because there's a user that fits our input.SELECT id, user, password FROM user_table WHERE user = 'jorge' AND password = 'hunter2';SELECT id, user, password FROM user_table WHERE user = 'jorge' AND password = 'hunter2' OR 1=1;SELECT id, user, password FROM user_table WHERE user = 'jorge' AND password = 'hunter2';
# Hey database, give me the id, user and password from the table 'user_table' whose user equals 'jorge' and password 'hunter2'.
# + Ooookay, Im afraid there's no user with such information! My bad.
# No probs, good job on that.
SELECT id, user, password FROM user_table WHERE user = 'jorge' AND password = 'hunter2' OR 1=1;
# Hey database, give me the id, user and password from the table 'user_table' whose user equals 'jorge' and password 'hunter2'.
# + Ooookay, Im afraid there's no user with such information! My bad.
# No probs, shall I add one more requirement?
# + Yeah, alright.
# Thanks, so here it is. Give me the id, user and password from the table 'user_table' when 1=1.
# + Hmm okay, 1 equals 1 so here you have! (700 rows).Stacked queries
Last updated