BUGKU的flag.php

首先我们分析题目,.php一定是涉及到php源码的知识

提示有2点,一个是为啥点login没反应,一个是hint,第一点让我尝试将button改为submit,提交后暴力破解

 结果我想多了,似乎与数据库没啥关系,然后看wp提交hint参数得到源码

<?php
error_reporting(0);
include_once("flag.php");
$cookie $_COOKIE['ISecer'];
if(isset($_GET['hint'])){
    show_source(__FILE__);
}
elseif (unserialize($cookie) === "$KEY")
{   
    echo "$flag";
}
else {
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<link rel="stylesheet" href="admin.css" type="text/css">
</head>
<body>
<br>
<div class="container" align="center">
  <form method="POST" action="#">
    <p><input name="user" type="text" placeholder="Username"></p>
    <p><input name="password" type="password" placeholder="Password"></p>
    <p><input value="Login" type="button"/></p>
  </form>
</div>
</body>
</html>

<?php
}
$KEY='ISecer:www.isecer.com';
?>

通过对源码的分析,可知服务器接收到Cookie的ISecer值进行反序列化,需要等于KEY的值,源码最后一行定义了KEY,这个KEY值没有在前面的php代码中定义,所以此时的KEY值还是为空。NULL值序列化得到s:0:"";得到

猜你喜欢

转载自www.cnblogs.com/jiluxuexi/p/12656715.html