Bug 1314888 - php: Use after free of ZCG(cwd) in Zend Opcache
php: Use after free of ZCG(cwd) in Zend Opcache
Status: CLOSED NOTABUG
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Red Hat Product Security
impact=none,public=20160213,reported=...
: Security
Depends On: 1314891
Blocks: 1315348
  Show dependency treegraph
 
Reported: 2016-03-04 13:33 EST by Adam Mariš
Modified: 2016-06-13 16:47 EDT (History)
13 users (show)

See Also:
Fixed In Version: php 5.6.19, php 7.0.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-06-13 16:47:24 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š 2016-03-04 13:33:14 EST
Possible use after free vulnerability in Opcache was reported. Zend Opcache caches the current working directory in ZCG(cwd) and therefore overrides chdir() in order to update the cached directory name when a script switches directories. The hook on chdir() is set in accel_startup() if opcache.enable is true. ZCG(cwd) is free'd in accel_deactivate(), but only if opcache.enable *still* is true. Since Zend extension shutdown functions are called before resetting INI configuration state, a script (or, for example, php_admin_flag in fpm SAPI) may disable Opcache at runtime by setting opcache.enable to false. In this case, the pointer is not correctly free'd and will be reused in the next request, although it became invalid due to being free'd by the Zend allocator. This leads to a use-after-free error and may cause a segmentation fault.

Upstream bug:

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

Upstream patches:

https://github.com/php/php-src/pull/1763
https://github.com/php/php-src/pull/1762
Comment 1 Adam Mariš 2016-03-04 13:43:39 EST
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1314891]
Comment 2 Tomas Hoger 2016-06-13 16:47:24 EDT
This is not a security issue.

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