Summary | security: do not use sys_get_temp_dir() |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | enrico.scholz (at) sigma-chemnitz (dot) de |
Created | 11/25/2012 (4612 days ago) |
Due | |
Updated | 02/01/2016 (3449 days ago) |
Assigned | |
Resolved | 02/01/2016 (3449 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
commit f41dc10b1a23e0f16e7aca04aa20b1df4d43b3f0
Author: Jan Schneider <jan@horde.org>
Date: Mon Feb 1 17:31:07 2016 +0100
Use configured temporary directory (
Request #11756)..../Core/lib/Horde/Core/Factory/MimeViewer.php | 1 +
.../Mime_Viewer/lib/Horde/Mime/Viewer/Ooo.php | 7 +++----
framework/Mime_Viewer/package.xml | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
http://github.com/horde/horde/commit/f41dc10b1a23e0f16e7aca04aa20b1df4d43b3f0
/usr/share/pear/Horde/Mime/Viewer/Ooo.php: $tmpdir =
Horde_Util::createTempDir(true);
----
static public function createTempDir($delete = true, $temp_dir = null)
{
if (is_null($temp_dir)) {
$temp_dir = sys_get_temp_dir();
}
State ⇒ Not A Bug
https://bugs.php.net/bug.php?id=44972
So, do not wait on PHP to fix this...
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ security: do not use sys_get_temp_dir()
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
'passwd.lock') into the directory returned by sys_get_temp_dir().
Unfortunately, this function is broken by returning always the
world-writable /tmp directory and there is no way to change this (I am
aware of modifying the TMPDIR environment variable, but this requires
changes in the apache startup script affecting the whole apache server
inclusive unrelated vhosts).
Having cache data in /tmp requires to add this directory to
'open_basedir' which opens vectors for other security holes.
There are functional problems too when different vhosts with perhaps
different horde versions are accessing the same /tmp/horde_cache_gc
file.
You should replace all occurrences of sys_get_temp_dir() with a
utility function which returns e.g.
| getenv('TMPDIR') ? getenv('TMPDIR') : sys_get_temp_dir()
So, TMPDIR can be configured per vhost/directory an the apache configuration.