sql - Why is WHERE ""="" true? -
sorry if seems dumb question i'm reading sql injection , 1 of mentioned instances of such state sql command such
select * users name ="" or ""="" , pass ="" or ""="" would valid , return records of table users. understand logic behind doing like
select * users userid = 105 or 1=1 but can't seem figure out why ""="" true statement. i'm quite new sql in general , i've searched answer examples of sql injection mention 1=1 example.
i can't seem figure out why
""=""true statement.
an empty string equal empty string. not sure confusion is.
i've searched answer examples of sql injection mention 1=1 example.
it's way of dealing appended quotes. original code
string sql = 'select * users name ="' + username + '" , pass ="' + password + '"' so passing in value '" or ""="' result in string see.
another 1 see passing in value '" or 1=1 --' results in sql
select * users name ="" or 1=1 --" , pass ="doesn't matter" which removes remaining sql since compiler treats comment.
Comments
Post a Comment