#41654 [Opn->WFx]: open_basedir bypass via mysql_connect()

From: Date: Tue, 12 Jun 2007 12:43:14 +0000
Subject: #41654 [Opn->WFx]: open_basedir bypass via mysql_connect()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113699@lists.php.net to get a copy of this message
ID: 41654 Updated by: iliaa@php.net Reported By: dr at peytz dot dk -Status: Open +Status: Wont fix Bug Type: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.3 New Comment: It is quite impractical for PHP to validate things like unix domain socket paths for all databases that support them to avoid open_basedir/ safe_mode bypasses. Had the bypass allowed reading of files, I could see the need to implement additional checks, but simple "presence" checks don't warrant hacks necessary to add such protection. Previous Comments: ------------------------------------------------------------------------ [2007-06-11 17:12:20] dr at peytz dot dk Description: ------------ file_exists() etc. does not allow checking the existence of files outside the directories specified in open_basedir. This can be circumvented using mysql_connect(). The existence of a file can be checked using the example code below. Reproduce code: --------------- $filename = '/etc/passwd'; mysql_connect(':' . $filename); $error = error_get_last(); if (strpos($error['message'], '(13)')) { print 'file exists'; } else { print 'file does not exist'; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41654&edit=1

« previous php.bugs (#113699) next »