Bugku-flag.php

关于这道题,没有提示的话是做不了的

提示:hint,那么去试试在url里传个hint

http://123.206.87.240:8002/flagphp/?hint=0

显示同一网页上的源码:

<?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'; 
?> 

粗略一看应该是要将最后的key反序列化,然后传参,之后就打印同一目录下面的flag.php文件里面定义的flag

拿去反序列化传参,发现不行,再仔细代码审计,下面的key是用来迷惑你的,两个定义不会影响

那么

$cookie = $_COOKIE['ISecer']; 

是什么意思呢?大概意思是将cookie里定义的‘ISecer’的值给cookie,但是前面他没赋值,那么就是空了

再拿去序列化:

burp抓包传参,拿到flag(这里用hackbar行不通):

posted @ 2020-03-01 23:41  ch0bits  阅读(276)  评论(0编辑  收藏  举报