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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -