Once More--实验吧

http://www.shiyanbar.com/ctf/1805

啊拉?又是php审计。已经想吐了。
hint:ereg()函数有漏洞哩;从小老师就说要用科学的方法来算数。
格式:CTF{}
解题链接: http://ctf5.shiyanbar.com/web/more.php


解:
源码审计:
有提示:1.利用ereg()漏洞%00截断
             2.利用科学计算法

You password must be alphanumeric

'; } else if (strlen($_GET['password']) < 8 && $_GET['password'] > 9999999) { if (strpos ($_GET['password'], '*-*') !== FALSE) { die('Flag: ' . $flag); } else { echo('

*-* have not been found

'); } } else { echo '

Invalid password

'; } } ?>
分析:
1.ereg ("^[a-zA-Z0-9]+$", $_GET['password']) === FALSE
===类型恒等于
== 和 != 比较若类型不同,先偿试转换类型,再作值比较,最后返回值比较结果 。

=== 和 !== 只有在相同类型下,才会比较其值。

定义:返回 pattern 的匹配次数。 它的值将是0次(不匹配)或1次
意思:只能输入字符和数字


2.strlen($_GET['password']) < 8 && $_GET['password'] > 9999999
意思:字符串长度小于8,值大于9999999,


3.strpos ($_GET['password'], '*-*') !== FALSE
定义:strpos — 查找字符串首次出现的位置
意思:*-*要出现
4.原因:%00算一个字符,,,,,,
填入1e8%00*-*(可以)
填入1e9%00*-*(可以)
填入1e10%00*-*(不行)


5.在地址栏输入
自己尝试,不然把%00解析为%2500,因为%===》%25
Once More--实验吧_第1张图片
Once More--实验吧_第2张图片


最详细的url表见链接:http://blog.csdn.net/asli33/article/details/6740611



你可能感兴趣的:(Once More--实验吧)