0CTF-2016-piapiapia(PHP反序列化字符逃逸)
0x01 前言
开学果然是对更新博客没得想法,趁着闲工夫,做了一下这个题,之前XCTF新春赛也出现了PHP反序列化逃逸,不过没做出来。。tcl,直接看题吧。
0x02 正文
这个题直接给你登录页面了,F12没有发现,sql注入也不太像,一般出现登录页面都会有注册页面,字典跑起来,发现有regester.php、config.php、www.zip,居然泄露了www.zip,话不多说下下来直接审计吧。
profile.php
<?php
require_once('class.php');
if($_SESSION['username'] == null) {
die('Login First');
}
$username = $_SESSION['username'];
$profile=$user->show_profile($username);
if($profile == null) {
header('Location: update.php');
}
else {
$profile = unserialize($profile);
$phone = $profile['phone'];
$email = $profile['email'];
$nickname = $profile['nickname'];
$photo = base64_encode(file_get_contents($profile['photo']));//-----point------
?>
<!DOCTYPE html>
<html>
<head>
<title>Profile</title>
<link href="static/bootstrap.min.css" rel="stylesheet">
<script src="static/jquery.min.js"></script>
<script src="static/bootstrap.min.js"></script>
</head>
<body>
<div class="container" style="margin-top:100px">
<img src="data:image/gif;base64,<?php echo $photo; ?>" class="img-memeda " style="width:180px;margin:0px auto;">
<h3>Hi <?php echo $nickname;?></h3>
<label>Phone: <?php echo $phone;?></label>
<label>Email: <?php echo $email;?></label>
</div>
</body>
</html>
<?php
}
?>
class.php
<?php
require('config.php');
class user extends mysql{
private $table = 'users';
public function is_exists($username) {
$username = parent::filter($username);
$where = "username =

本文详细分析了0CTF-2016-piapiapia题目中的PHP反序列化字符逃逸漏洞,通过控制特定输入绕过安全检查,实现对敏感文件config.php的读取,最终获取flag。
最低0.47元/天 解锁文章
850

被折叠的 条评论
为什么被折叠?



