|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42077 Why have the session folder in open_basedir
Submitted: 2007-07-23 08:00 UTC Modified: 2007-08-16 21:03 UTC
Avg. Score:4.8 ± 0.4
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: spam2 at rhsoft dot net Assigned: stas (profile)
Status: Closed Package: Session related
PHP Version: 5CVS-2007-07-23 (snap) OS: Linux
Private report: No CVE-ID: None
 [2007-07-23 08:00 UTC] spam2 at rhsoft dot net
The Session-Save-Dir MUST NOT be in open_basedir because scripts must not read session files for security!

And a failed session_start() have not to be fatal error too

Warning: session_start() [function.session-start.php]: open_basedir
restriction in effect. File(/var/www/sessiondata) is not within the
allowed path(s):
in /mnt/data/www/ on line 2

Fatal error: session_start() [<a
Failed to initialize storage module: files (path: /var/www/sessiondata)
in /mnt/data/www/ on line 2

Reproduce code:

Expected result:
A started session

Actual result:
A killed script


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-25 14:31 UTC]
Re-opening and assign to Stas who has something cooking up for this.
 [2007-07-28 13:45 UTC] harry at rhsoft dot net
Is there any change?
The downloaded snapshot contains following in "news.txt"
Fixed session.save_path and error_log values to be checked against
open_basedir and safe_mode (CVE-2007-3378) 

If this change goes in php 5.2.4 final it will break many setups 
"session.save_path" and "error_log" set by admin in php.ini must not checked against open_basedir 

If you have 100 virtual hosts with open_basedir for each per <Directory> and the server is configured for one central errorlog and one central session.save_path all hosts will crash.

You must check changig this in .htaccess/ini_set() against open_basedir but not on the global configuration.

A script has not to look in the session-dir because in worst case it can read ALL session-files and display the content - so open_basedir has to block this and did it before the change.
 [2007-08-03 18:13 UTC] harry at rhsoft dot net
Nice - The bug is present and you make a release candidate?
Aug 2007, PHP 5.2.4
02 Aug 2007, PHP 5.2.4RC1

Hopefully this is a joke......

If this will go to final i need a address to send a bill for changing 200 Host-Files on some servers!

Need to make for each one a session-directory and set it to open_basedir or a stupid global configuration that allows scripts reading of all session-files from other users too.

But what should we do with global error_log?
Give all Hosts access to the log-folder? NO - Never!
 [2007-08-07 00:25 UTC]
Please try using this CVS snapshot:
For Windows (zip):

For Windows (installer):

AFAIK, this is now fixed. Please try the snapshot.
 [2007-08-07 08:55 UTC] harry at rhsoft dot net
Yes seems to work correct

 echo $a;

Notice: Undefined variable: a in /mnt/data/www/ on line 3
PHP Version 5.2.4RC1-dev


Session was started with a save-path outside open_basedir
The Warning-Message was written in the global error_log also outside open_basedir
 [2007-08-16 20:28 UTC] phpbugs at thequod dot de
I can confirm that the bug is fixed, too.
Thank you.
 [2007-08-16 21:03 UTC]
I've fixed it to work as before and only check open_basedir if set by user in runtime or .htaccess. 

P.S. yes it was in rc1. But not in rc2 and won't be in 5.2.4. If you still see it in 5.2 CVS cry aloud. 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 17 17:05:44 2022 UTC