|
|||||||||||
|
Re Re: PHP 5.2.4 <= various mysql functions safemode & open_basedir bypass
From: <laurent.gaffie(at)gmail.com>
Date: Wed Sep 12 2007 - 05:31:18 EDT
"Two years ago, I wrote a semi similar post to this one, but, well, I'm old and tired of seeing this now. Time for folks to upgrade. On Sep 10, 2007, at 9:38 PM, laurent.gaffie@gmail.com wrote: > Application: PHP <=5.2.4
I totally agree on this, PHP is currently very used because it's easy to use.
You know i see the safemode function in PHP AS an anti-virus on a windows box .
"you dont know what you use , where you click, you just want it working,and "safely" ?
dont worry we will protect you ."
> <?php
In this case:
What restrictions have you placed upon it, per user, and filesystem? ==> mysql_connect => granted_user(for load_file)/or_misconfigurated_user_perms. (as in many case[like the into outfile/dumpfile -> select 'hello i dont like you' into dumpfile '/bla/not_my_friend/www/index.html'; -> considering too that his www or some other folder is not properly chmoded ...as also in many many case .] PHP offers the possibility to interact with mysql/&others i think safemode/open_basedir should totally watch what's going to mysql ( like those "into outfile/dumpfile" , for sure "load_file" it's different, but considering the fact that they build/integrate a "safemode" into PHP then they should watch this kind of stuff.)
but once again .. i totally agree with your point,in a shared webhosting
context, if you start to trust theses kinds of functions and then let
some holes in the wall letting in the water, your shared env will be down
very soon .
regards laurent gaffié "Apparently, it's allowed to write to /test/, *and* the user perms used to talk to mysql seem horribly broad, since it can get user perms. So, since any Apache/PHP/mysql user on a shared host (or whatever) in the above scenario can write to whatever they want from mysql to /test/, it's fair game. You see, any PHP library used, be it mysql, odbc, *whatever*, that can be given arguments, *and does not filter* those arguments *in the library*, based on per-apache-instance-per-user restrictions, can be used to cross boundaries, escalate boundaries, etc. Since on a shared host, it's often the case that 20. or 50, or whatever many users have permissions (though apache and mysql) to write to any directories that apache and mysql have write permissions to, yes, PHP can *try* to clean up the activities involves, but it's a fools errand.
mysql_query("select load_file (foo) into dumpfile'/
massive_directory_pool/user_i_hate/index.html;");
# if the mysql user has perms, Game over. PHP/apache isn't even
relevant anymore, if *mysql*
So, for mental exercise: A GD library creating an "image" in another directory, because apache and PHP trust GD? How about a PDF file? A blog backup file? You see, the problem *isn't* PHP, it's underlying libraries inheriting perms, and using perms, that are not appropriate for the purpose of isolating users. The fix? Give each user their own apache, their own mysql, their own chroot'ed box (or vm/xen image..). Since that's not gonna happen anytime soon for resellers who oversubscribed their hardware, the current solution seems to be "point and giggle". -Ronabop Received on Wed Sep 12 12:41:39 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 28 2007 - 06:15:23 EDT |
||||||||||
|
|||||||||||