#39123 [NEW]: upload_tmp_dir with trailing slash in open_basedir causes uploads to fail

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #39123 [NEW]: upload_tmp_dir with trailing slash in open_basedir causes uploads to fail

    From: phpbugs at thequod dot de
    Operating system: Ubuntu Linux
    PHP version: 5CVS-2006-10-11 (CVS)
    PHP Bug Type: Safe Mode/open_basedir
    Bug description: upload_tmp_dir with trailing slash in open_basedir causes uploads to fail

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.

    --
    Edit bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39123&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39123&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39123&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39123&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=39123&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=39123&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39123&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=39123&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=39123&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=39123&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=39123&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=39123&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=39123&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39123&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=39123&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=39123&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39123&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=39123&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39123&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39123&r=mysqlcfg[/url]
    phpbugs at thequod dot de Guest

  2. Similar Questions and Discussions

    1. #40419 [NEW]: Trailing Slash in CGI request don't work
      From: samuele dot diella at gmail dot com Operating system: Slackware 10.2 PHP version: 5.2.1 PHP Bug Type: CGI related Bug...
    2. Large file uploads fail after 6.1 to 7.0.1 upgrade
      After upgrading CF from 6.1 to 7.0.1 users are getting a "Cannot find server or DNS Error Internet Explorer" error as soon as they try to upload a...
    3. File uploads and upload_tmp_dir
      When I was using /usr/tmp to keep the temp uploaded files, move_uploaded_file used to fail randomly. Since I created a directory owned by...
    4. trailing slash issue in Find.find
      require "find" Find.find("/usr/bin/") { |file| puts file } /usr/bin//rmdir /usr/bin//rm /usr/bin//mv /usr/bin//mknod /usr/bin//mkfifo...
    5. Removing Trailing Slash
      UPDATE sometable SET url_addresss = LEFT(url_addresss,LEN(url_addresss)-1) WHERE RIGHT(url_addresss,1)='/' -- David Portas ------------...
  3. #2

    Default #39123 [Opn->Bgs]: upload_tmp_dir with trailing slash in open_basedir causes uploads to fail

    ID: 39123
    Updated by: [email]iliaa@php.net[/email]
    Reported By: phpbugs at thequod dot de
    -Status: Open
    +Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-11 01:44:07] phpbugs at thequod dot de

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    iliaa@php.net Guest

  4. #3

    Default #39123 [Bgs->Opn]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    User updated by: phpbugs at thequod dot de
    -Summary: upload_tmp_dir with trailing slash in open_basedir
    causes uploads to fail
    Reported By: phpbugs at thequod dot de
    -Status: Bogus
    +Status: Open
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-11 23:31:40] [email]iliaa@php.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.

    ------------------------------------------------------------------------

    [2006-10-11 01:44:07] phpbugs at thequod dot de

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    phpbugs at thequod dot de Guest

  5. #4

    Default #39123 [Com]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    Comment by: judas dot iscariote at gmail dot com
    Reported By: phpbugs at thequod dot de
    Status: Open
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-12 02:26:56] phpbugs at thequod dot de

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)

    ------------------------------------------------------------------------

    [2006-10-11 23:31:40] [email]iliaa@php.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.

    ------------------------------------------------------------------------

    [2006-10-11 01:44:07] phpbugs at thequod dot de

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    judas dot iscariote at gmail dot com Guest

  6. #5

    Default #39123 [Opn]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    User updated by: phpbugs at thequod dot de
    Reported By: phpbugs at thequod dot de
    Status: Open
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-12 04:05:26] judas dot iscariote at gmail dot com

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.

    ------------------------------------------------------------------------

    [2006-10-12 02:26:56] phpbugs at thequod dot de

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)

    ------------------------------------------------------------------------

    [2006-10-11 23:31:40] [email]iliaa@php.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.

    ------------------------------------------------------------------------

    [2006-10-11 01:44:07] phpbugs at thequod dot de

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    phpbugs at thequod dot de Guest

  7. #6

    Default #39123 [Opn->Bgs]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    Updated by: [email]iliaa@php.net[/email]
    Reported By: phpbugs at thequod dot de
    -Status: Open
    +Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    Make sure your upload_tmp_dir is set and then it'll work.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-12 15:28:12] phpbugs at thequod dot de

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.

    ------------------------------------------------------------------------

    [2006-10-12 04:05:26] judas dot iscariote at gmail dot com

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.

    ------------------------------------------------------------------------

    [2006-10-12 02:26:56] phpbugs at thequod dot de

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)

    ------------------------------------------------------------------------

    [2006-10-11 23:31:40] [email]iliaa@php.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.

    ------------------------------------------------------------------------

    [2006-10-11 01:44:07] phpbugs at thequod dot de

    Description:
    ------------
    I have no upload_tmp_dir set, so it seems to use "/tmp".

    I have added "/tmp/" to open_basedir (despite the fact
    that this was not necessary before - see
    [url]http://bugs.php.net/38934[/url]).

    Upload in PHP_5_2 fails with:
    [11-Oct-2006 03:26:35] PHP Warning: Unknown: open_basedir
    restriction in effect. File(/tmp) is not within the
    allowed path(s):
    (/web7/:/var/www/web7/:/tmp/:/var/www/usr/local/share/php/:/usr/local/share/php/)

    in Unknown on line 0
    [11-Oct-2006 03:26:35] PHP Warning: File upload error -
    unable to create a temporary file in Unknown on line 0

    This is a regression to PHP_5_1, where it works like this!

    Setting upload_tmp_dir=/tmp/ (with ending slash) fixes it
    also for PHP_5_2.

    Reproduce code:
    ---------------
    Any upload form, there are two in the other bug refered above.

    Expected result:
    ----------------
    Upload works.

    Actual result:
    --------------
    Upload does not work.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    iliaa@php.net Guest

  8. #7

    Default #39123 [Bgs->Opn]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    User updated by: phpbugs at thequod dot de
    Reported By: phpbugs at thequod dot de
    -Status: Bogus
    +Status: Open
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    Yes, setting upload_tmp_dir explicitly does not cause the
    problem (anymore).

    But still, because the default of upload_tmp_dir is empty,
    it should not bail out when detecting the upload_tmp_dir
    setting.

    Manually setting upload_tmp_dir to "/tmp" (without
    trailing slash) allows uploading, but leaving it unset,
    errors out with:
    """
    PHP Warning: Unknown: open_basedir restriction in effect.
    File(/tmp) is not within the allowed path(s): (/X/:/tmp/)
    in Unknown on line 0
    PHP Warning: File upload error - unable to create a
    temporary file in Unknown on line 0
    """

    To me it looks like the error gets triggered while
    determining the default upload_tmp_dir setting.

    I consider setting "upload_tmp_dir" explicitly as a
    work-around currently, but it should not be necessary for
    upgrading to 5.2 IMHO.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-13 02:21:22] [email]iliaa@php.net[/email]

    Make sure your upload_tmp_dir is set and then it'll work.

    ------------------------------------------------------------------------

    [2006-10-12 15:28:12] phpbugs at thequod dot de

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.

    ------------------------------------------------------------------------

    [2006-10-12 04:05:26] judas dot iscariote at gmail dot com

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.

    ------------------------------------------------------------------------

    [2006-10-12 02:26:56] phpbugs at thequod dot de

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)

    ------------------------------------------------------------------------

    [2006-10-11 23:31:40] [email]iliaa@php.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    Standard process for validating open_basedir applies here.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39123[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    phpbugs at thequod dot de Guest

  9. #8

    Default #39123 [Opn->Bgs]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    Updated by: [email]iliaa@php.net[/email]
    Reported By: phpbugs at thequod dot de
    -Status: Open
    +Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-13 11:27:26] phpbugs at thequod dot de

    Yes, setting upload_tmp_dir explicitly does not cause the
    problem (anymore).

    But still, because the default of upload_tmp_dir is empty,
    it should not bail out when detecting the upload_tmp_dir
    setting.

    Manually setting upload_tmp_dir to "/tmp" (without
    trailing slash) allows uploading, but leaving it unset,
    errors out with:
    """
    PHP Warning: Unknown: open_basedir restriction in effect.
    File(/tmp) is not within the allowed path(s): (/X/:/tmp/)
    in Unknown on line 0
    PHP Warning: File upload error - unable to create a
    temporary file in Unknown on line 0
    """

    To me it looks like the error gets triggered while
    determining the default upload_tmp_dir setting.

    I consider setting "upload_tmp_dir" explicitly as a
    work-around currently, but it should not be necessary for
    upgrading to 5.2 IMHO.

    ------------------------------------------------------------------------

    [2006-10-13 02:21:22] [email]iliaa@php.net[/email]

    Make sure your upload_tmp_dir is set and then it'll work.

    ------------------------------------------------------------------------

    [2006-10-12 15:28:12] phpbugs at thequod dot de

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.

    ------------------------------------------------------------------------

    [2006-10-12 04:05:26] judas dot iscariote at gmail dot com

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.

    ------------------------------------------------------------------------

    [2006-10-12 02:26:56] phpbugs at thequod dot de

    I've changed the summary.
    Long version:
    Default for "upload_tmp_dir" has changed from "/tmp/"
    to "/tmp" and uploads now fail with open_base_dir="/tmp/"!

    This is a regression!

    If I use "/tmp/" in open_base_dir, I expect it to also
    handle accesses to the "/tmp" directory itself!

    (all apart the fact that it's ridiculous to manually have
    to add upload_tmp_dir to open_basedir for uploads to work)

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39123[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    iliaa@php.net Guest

  10. #9

    Default #39123 [Bgs]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    Updated by: [email]iliaa@php.net[/email]
    Reported By: phpbugs at thequod dot de
    Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-13 13:29:04] [email]iliaa@php.net[/email]

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.

    ------------------------------------------------------------------------

    [2006-10-13 11:27:26] phpbugs at thequod dot de

    Yes, setting upload_tmp_dir explicitly does not cause the
    problem (anymore).

    But still, because the default of upload_tmp_dir is empty,
    it should not bail out when detecting the upload_tmp_dir
    setting.

    Manually setting upload_tmp_dir to "/tmp" (without
    trailing slash) allows uploading, but leaving it unset,
    errors out with:
    """
    PHP Warning: Unknown: open_basedir restriction in effect.
    File(/tmp) is not within the allowed path(s): (/X/:/tmp/)
    in Unknown on line 0
    PHP Warning: File upload error - unable to create a
    temporary file in Unknown on line 0
    """

    To me it looks like the error gets triggered while
    determining the default upload_tmp_dir setting.

    I consider setting "upload_tmp_dir" explicitly as a
    work-around currently, but it should not be necessary for
    upgrading to 5.2 IMHO.

    ------------------------------------------------------------------------

    [2006-10-13 02:21:22] [email]iliaa@php.net[/email]

    Make sure your upload_tmp_dir is set and then it'll work.

    ------------------------------------------------------------------------

    [2006-10-12 15:28:12] phpbugs at thequod dot de

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.

    ------------------------------------------------------------------------

    [2006-10-12 04:05:26] judas dot iscariote at gmail dot com

    Ilia :

    Can u reconsider this ? this is a BC break, and Im sure gazillions or
    webserver config files will break with this change.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39123[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]

    iliaa@php.net Guest

  11. #10

    Default #39123 [Bgs]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    User updated by: phpbugs at thequod dot de
    Reported By: phpbugs at thequod dot de
    Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    And why is it so that:
    upload_tmp_dir=/tmp
    open_basedir=/tmp/
    works, but
    open_basedir=/tmp/
    does not?! (because of the trailing slash in the last
    example)

    Additionally, I don't believe that upload_tmp_dir is set
    on most installs.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-13 13:29:05] [email]iliaa@php.net[/email]

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.

    ------------------------------------------------------------------------

    [2006-10-13 13:29:04] [email]iliaa@php.net[/email]

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.

    ------------------------------------------------------------------------

    [2006-10-13 11:27:26] phpbugs at thequod dot de

    Yes, setting upload_tmp_dir explicitly does not cause the
    problem (anymore).

    But still, because the default of upload_tmp_dir is empty,
    it should not bail out when detecting the upload_tmp_dir
    setting.

    Manually setting upload_tmp_dir to "/tmp" (without
    trailing slash) allows uploading, but leaving it unset,
    errors out with:
    """
    PHP Warning: Unknown: open_basedir restriction in effect.
    File(/tmp) is not within the allowed path(s): (/X/:/tmp/)
    in Unknown on line 0
    PHP Warning: File upload error - unable to create a
    temporary file in Unknown on line 0
    """

    To me it looks like the error gets triggered while
    determining the default upload_tmp_dir setting.

    I consider setting "upload_tmp_dir" explicitly as a
    work-around currently, but it should not be necessary for
    upgrading to 5.2 IMHO.

    ------------------------------------------------------------------------

    [2006-10-13 02:21:22] [email]iliaa@php.net[/email]

    Make sure your upload_tmp_dir is set and then it'll work.

    ------------------------------------------------------------------------

    [2006-10-12 15:28:12] phpbugs at thequod dot de

    While at it, please reconsider also
    [url]http://bugs.php.net/38934[/url] and at least document since when
    then upload_tmp_dir is needed in open_basedir.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39123[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]
    phpbugs at thequod dot de Guest

  12. #11

    Default #39123 [Bgs]: Default for "upload_tmp_dir" changed to "/tmp" (regression)

    ID: 39123
    User updated by: phpbugs at thequod dot de
    Reported By: phpbugs at thequod dot de
    Status: Bogus
    Bug Type: Safe Mode/open_basedir
    Operating System: Ubuntu Linux
    PHP Version: 5CVS-2006-10-11 (CVS)
    New Comment:

    JFI: it seems to be the same with session.save_path.

    Setting it explicitly to "/tmp/" helps here, too.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-10-13 19:27:27] phpbugs at thequod dot de

    And why is it so that:
    upload_tmp_dir=/tmp
    open_basedir=/tmp/
    works, but
    open_basedir=/tmp/
    does not?! (because of the trailing slash in the last
    example)

    Additionally, I don't believe that upload_tmp_dir is set
    on most installs.

    ------------------------------------------------------------------------

    [2006-10-13 13:29:05] [email]iliaa@php.net[/email]

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.

    ------------------------------------------------------------------------

    [2006-10-13 13:29:04] [email]iliaa@php.net[/email]

    The error is that the "default" path is validated against
    open_basedir to address earlier tempnam() vulnerability
    allowing open_basedir bypass.

    The solution is either to: set upload_tmp_dir (which is the
    case on most installs) or to make sure that the default tmp
    dir is inside the open_basedir.

    ------------------------------------------------------------------------

    [2006-10-13 11:27:26] phpbugs at thequod dot de

    Yes, setting upload_tmp_dir explicitly does not cause the
    problem (anymore).

    But still, because the default of upload_tmp_dir is empty,
    it should not bail out when detecting the upload_tmp_dir
    setting.

    Manually setting upload_tmp_dir to "/tmp" (without
    trailing slash) allows uploading, but leaving it unset,
    errors out with:
    """
    PHP Warning: Unknown: open_basedir restriction in effect.
    File(/tmp) is not within the allowed path(s): (/X/:/tmp/)
    in Unknown on line 0
    PHP Warning: File upload error - unable to create a
    temporary file in Unknown on line 0
    """

    To me it looks like the error gets triggered while
    determining the default upload_tmp_dir setting.

    I consider setting "upload_tmp_dir" explicitly as a
    work-around currently, but it should not be necessary for
    upgrading to 5.2 IMHO.

    ------------------------------------------------------------------------

    [2006-10-13 02:21:22] [email]iliaa@php.net[/email]

    Make sure your upload_tmp_dir is set and then it'll work.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39123[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39123&edit=1[/url]

    phpbugs at thequod dot de Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139