Darkctf Writeup

前几天在这个比赛上打了个卡,今天在集训上看了writeup并且和其他人讨论了一下终于是弄出来了QAQ

第一题挺简单的,当时太不注意了

Challenge: Source

给了一个源代码和一个网址

网址:http://web.darkarmy.xyz

<html>
    <head>
        <title>SOURCE</title>
        <style>
            #main {
    height: 100vh;
}
        </style>
    </head>
    <body><center>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<?php
$web = $_SERVER['HTTP_USER_AGENT'];
if (is_numeric($web)){
      if (strlen($web) < 4){
          if ($web > 10000){
                 echo ('<div class="w3-panel w3-green"><h3>Correct</h3>
  <p>darkCTF{}</p></div>');
          } else {
                 echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3>
  <p>Ohhhhh!!! Very Close  </p></div>');
          }
      } else {
             echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3>
  <p>Nice!!! Near But Far</p></div>');
      }
} else {
    echo ('<div class="w3-panel w3-red"><h3>Wrong!</h3>
  <p>Ahhhhh!!! Try Not Easy</p></div>');
}
?>
</center>
<!-- Source is helpful -->
    </body>
</html>

分析源代码,变量web需要为数字,大于10000且strlen($web)<4,使用科学计数法

burpsuite抓包,更改user-agent为9e9($web = $_SERVER['HTTP_USER_AGENT'];web=user-agent

得到flag:darkCTF{changeing_http_user_agent_is_easy}

posted @ 2020-10-04 19:21  zap162  阅读(19)  评论(0)    收藏  举报