A question of SQL statement injected by SQL


SQL:
select * from post where id = "10";

:
10" union select id,username,salt,password,5 from user where id="2

:
select * from post where id = "10\" union select id,username,salt,password,5 from user where id=\"2"

I don"t know why I can query the data.

clipboard.png

Mar.15,2021

your id MYSQL setting is numeric, but you are querying character types. At this point, MYSQL does an implicit conversion and does not use indexes. Where characters are converted to numbers:

  1. start processing from the left
  2. The
  3. string begins with a non-numeric number and is converted to the number 0
  4. The
  5. string begins with a number and is directly intercepted to a non-numeric position. Which is in your question: 10
Implicit conversion occurs during the execution of

sql statement

Menu