Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37486 invoked by uid 1010); 17 Jan 2007 12:39:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37471 invoked from network); 17 Jan 2007 12:39:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2007 12:39:29 -0000 Authentication-Results: pb1.pair.com header.from=info@adaniels.nl; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=info@adaniels.nl; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain adaniels.nl from 82.94.235.198 cause and error) X-PHP-List-Original-Sender: info@adaniels.nl X-Host-Fingerprint: 82.94.235.198 hyak.bean-it.nl Received: from [82.94.235.198] ([82.94.235.198:49945] helo=hyak.bean-it.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/0A-05335-FF81EA54 for ; Wed, 17 Jan 2007 07:39:28 -0500 Received: from [127.0.0.1] (bean-it.xs4all.nl [213.84.27.165]) (authenticated bits=0) by hyak.bean-it.nl (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id l0HCdHZp010582; Wed, 17 Jan 2007 13:39:19 +0100 Message-ID: <45AE18E1.3040302@adaniels.nl> Date: Wed, 17 Jan 2007 13:38:57 +0100 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Alain Williams CC: Greg Beaver , Stanislav Malyshev , Stefan Esser , Marcus Boerger , internals@lists.php.net References: <45A8FC49.7050909@hardened-php.net> <45A90809.3050008@lerdorf.com> <45A91002.8020607@hardened-php.net> <526994769.20070113181330@marcus-boerger.de> <45AA116F.7020109@hardened-php.net> <45AA961D.4090401@php.net> <45AD63A1.2040206@adaniels.nl> <20070117084600.GA19933@mint.phcomp.co.uk> In-Reply-To: <20070117084600.GA19933@mint.phcomp.co.uk> Content-Type: multipart/alternative; boundary="------------030804030304020409000208" X-Virus-Scanned: by amavisd-new X-Spam-Status: No, score=1.6 required=4.0 tests=BAYES_50,HTML_10_20, HTML_MESSAGE,HTML_TITLE_EMPTY autolearn=no version=3.1.7 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on hyak.bean-it.nl Subject: Re: [PHP-DEV] Comments on PHP security From: info@adaniels.nl (Arnold Daniels) --------------030804030304020409000208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi again, Yes we can share it with the world, but first it should be reviewed by others to see if we haven't missed anything which makes the system less secure instead of more. Also the source code is currently really dirty and specified on our situation (to little to config, mod_diffpriv also does mass virtual hosting, etc.). Please send me an e-mail, if you would like to review it and I'll send you the source code. Again, please note that you need to patch your kernel for it, so you need to do it on some test server or a virtual machine. Best regards, Arnold PS. The line in my previous mail should read: "We (not me) have written a kernel patch to allow switching *of the user* of the current processes (much like sudo) and a matching apache module.". But I guess you understood. Alain Williams schreef: > On Wed, Jan 17, 2007 at 12:45:37AM +0100, Arnold Daniels wrote: > >> Hi, >> >> First of all I admit I'm no PHP security expert or PHP internals expert >> or anything, so please don't flame me if I say something stupid. >> >> Wouldn't simply adding a flag to allow url's (which includes all '*://' >> streams), in functions that opens streams be enough? For example: >> fopen($file, 'r') and fopen($url, 'ru') and fopen('php://output', 'ru'). >> To my opinion, using '*://' streams is an advanced feature. Developers >> who are using that, should be able to make sure no urls are opened. >> Again, just an idea. >> > > Brilliant. The only thing that need be added is a config var to control > the default behaviour - which should be 'don't allow'. > Doesn't fix everything (eg includes), but it is a good start. > Note that: allow_url_fopen is not the same thing as that does not allow > the program to specify when it wants it. > > >> Last, I'm a software developer at a shared hosting company. To my >> opinion, making sure that users don't touch other people's files, does >> not belong in the PHP layer. With other apache modules you can do nasty >> thing as well. We (not me) have written a kernel patch to allow >> switching of the current processes (much like sudo) and a matching >> apache module. Since the privileges only allow the user or group to >> access the file, linux does the rest. An other solution is to start PHP >> as cgi under the correct user, but other things will never be really save. >> > > Care to share that with the world ? > > --------------030804030304020409000208--