HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/local/lib/php/tests/HTML_AJAX/tests/bug-21165.phpt
--TEST--
Security issue with unserialization
--FILE--
<?php
require_once '_setup.php';
require_once 'HTML/AJAX.php';

class test
{
    function echo_string($data)
    {
        echo $data;
    }
}

$ha = new HTML_AJAX();
$ha->registerClass(new test());

//the "+" shouldn't be there but is accepted by PHP nontheless
$ha->_payload = 'O:+8:"stdClass":0:{}';

$_SERVER['CONTENT_TYPE'] = 'application/php-serialized';
$_GET['c'] = 'test';
$_GET['m'] = 'echo_string';

$ha->handleRequest();
?>
--EXPECTF--
%s"errNo":1024,"errStr":"Class(es) not allowed to be serialized"%s