当我们在打开sqli-labs的46关发现其实是个表格,当测试sort等于123时,会根据列数的不同来进行排序


我们需要利用这个点来判断是否存在注入漏洞,通过加入asc 和desc判断页面有注入点
1、基于使用if语句盲注
如果我们配合if函数,表达式正确就根据username排序,否则根据password排序。
要在知道列名的情况下使用:?sort=if(表达式,username,password)
比如:?sort=if(ascii(substr((select database()),1,1))>=115,username,password)
通过看根据什么排序就可以知道数据库的字符了,经过多次测试就可以拿到数据库名
2、基于时间的盲注
在基于if语句盲注的基础上,可以直接使用时间盲注即可:
?sort=if(ascii(substr((select database()),1,1))>=115,sleep(2),0)
为了快速得到数据库的信息,我们使用python脚本来注入

最后得到数据库名为security,这样就完成了order by的注入