|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-10-07 04:54 UTC] yannayl at checkpoint dot com
[2016-10-11 05:56 UTC] stas@php.net
-PHP Version: 7.1Git-2016-10-06 (Git)
+PHP Version: 7.0.11
[2016-10-11 05:56 UTC] stas@php.net
[2016-10-11 05:57 UTC] stas@php.net
-Assigned To:
+Assigned To: stas
[2016-10-11 23:52 UTC] stas@php.net
[2016-10-11 23:53 UTC] stas@php.net
-Status: Assigned
+Status: Closed
[2016-10-11 23:53 UTC] stas@php.net
[2016-10-12 14:26 UTC] ab@php.net
[2016-10-13 10:37 UTC] yannayl at checkpoint dot com
[2016-10-14 01:02 UTC] ab@php.net
[2016-10-14 02:23 UTC] ab@php.net
[2016-10-14 02:23 UTC] ab@php.net
[2016-10-17 10:07 UTC] bwoebi@php.net
[2016-10-17 10:07 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
Description: ------------ SplObjectStorage::unserialize does not sanitize the unserialized input well enough and may pass reference to object as key in the object storage. lines 801-809 in ext/spl/spl_observer.c unserialize the entry and verify that it's of type IS_OBJECT ``` if (!php_var_unserialize(&entry, &p, s + buf_len, &var_hash)) { goto outexcept; } if (Z_TYPE(entry) != IS_OBJECT) { zval_ptr_dtor(&entry); goto outexcept; } ``` Then, in line 812, the following code executes ``` if (!php_var_unserialize(&inf, &p, s + buf_len, &var_hash)) { ``` If the parsed string is a reference (R:) to the entry zval, then the php_var_unserialize_internal() function will convert the entry to zval of type IS_REFERENCE (reference to the object). Technically, this is a type-confusion, but I don't think it's (remotely) exploitable. I am reporting it as `security` just to be safe. Test script: --------------- <?php $x = unserialize('a:2:{i:0;O:8:"stdclass":0:{}i:1;C:16:"SplObjectStorage":24:{x:i:1;r:2;,R:5;;m:a:0:{}}}'); if ($x[1]->contains($x[0])) { echo "expected\n"; } else { echo "unexpected\n"; } Expected result: ---------------- "expected" should be printed. Actual result: -------------- "unexpected" is printed.