Bug 1260695 - php: Another use-after-free vulnerability in unserialize() with SplObjectStorage
php: Another use-after-free vulnerability in unserialize() with SplObjectStorage
Status: CLOSED DUPLICATE of bug 1260642
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20150827,repor...
: Security
Depends On: 1260700
Blocks: 1260756
  Show dependency treegraph
 
Reported: 2015-09-07 09:10 EDT by Adam Mariš
Modified: 2016-03-04 05:42 EST (History)
15 users (show)

See Also:
Fixed In Version: php-5.5.29, php-5.6.13, php-5.4.45
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-09-09 04:27:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Mariš 2015-09-07 09:10:07 EDT
Another user-after-free vulnerability was found in unserialize(). We can create ZVAL and free it. During deserialization it will still allow to use R: or r: to set references to already freed memory, which could possibly lead to remote code execution.

Vulnerable code:

ALLOC_INIT_ZVAL(pentry);
if (!php_var_unserialize(&pentry, &p, s + buf_len, &var_hash TSRMLS_CC)) {
	zval_ptr_dtor(&pentry);
	goto outexcept;
}
var_push_dtor(&var_hash, &pentry);
if(Z_TYPE_P(pentry) != IS_OBJECT) {
	goto outexcept;
}
ALLOC_INIT_ZVAL(pinf);
if (*p == ',') { /* new version has inf */
	++p;
	if (!php_var_unserialize(&pinf, &p, s + buf_len, &var_hash TSRMLS_CC)) {
		zval_ptr_dtor(&pinf);
		goto outexcept;
	}
}

Upstream report:

https://bugs.php.net/bug.php?id=70365

Upstream patch:

http://git.php.net/?p=php-src.git;a=commit;h=f06a069c462d37c2e009f6d1d93b8c8e7b713393
Comment 1 Adam Mariš 2015-09-07 09:17:49 EDT
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1260700]
Comment 2 Adam Mariš 2015-09-09 04:27:02 EDT

*** This bug has been marked as a duplicate of bug 1260642 ***
Comment 3 Fedora Update System 2015-09-14 18:19:58 EDT
php-5.6.13-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
Comment 4 Fedora Update System 2015-09-14 19:18:53 EDT
php-5.6.13-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 5 Fedora Update System 2015-09-18 14:43:56 EDT
php-5.6.13-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.