Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29561 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54119 invoked by uid 1010); 19 May 2007 15:08:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 54104 invoked from network); 19 May 2007 15:08:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2007 15:08:44 -0000 Authentication-Results: pb1.pair.com header.from=cellog@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cellog@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 66.79.163.178 cause and error) X-PHP-List-Original-Sender: cellog@php.net X-Host-Fingerprint: 66.79.163.178 bluga.net Linux 2.5 (sometimes 2.4) (4) Received: from [66.79.163.178] ([66.79.163.178:47181] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/83-00717-AF21F464 for ; Sat, 19 May 2007 11:08:43 -0400 Received: from mail.bluga.net (mail.bluga.net [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 0760687468; Sat, 19 May 2007 08:10:18 -0700 (PDT) Received: from [10.18.0.8] (unknown [166.216.102.115]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 0654B8735E; Sat, 19 May 2007 08:10:13 -0700 (PDT) Message-ID: <464F12EB.30102@php.net> Date: Sat, 19 May 2007 10:08:27 -0500 User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Oliver Block CC: internals@lists.php.net References: <464DCB8C.90803@chiaraquartet.net> <200705191234.04424.lists@block-online.eu> In-Reply-To: <200705191234.04424.lists@block-online.eu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] potential solution to user streams + allow_url_include=off From: cellog@php.net (Greg Beaver) Oliver Block wrote: > Hello Greg, > > I would first ask the following question: > > Why should the user be prevented to include remote site code? > > #1: hoster and users are equal > ------------------------------------------------ > > The hoster - as the "person" providing for the php infrastructure - is trying > to prevent the user (and his own system) - as his partner - from injected > code by malicous others. > > #2 hoster distrusts the user > --------------------------------------------- > > By unknown reasons, the hoster thinks that the user is limited in his > capabilities and therefore wants to prevent his system from the user. > --- > > Functions like fsockopen are adding useful features to php. Communication > between different systems can be useful. Therefore it should not be disabled, > if it cannot be abused easily by 3rd parties. > I would consider the possibility to inject malicous code by using a query > string, as beeing easily achieved. > > In my opinion, your proposal does satisfy #1 not #2. I see no sense though in > declaring a local stream as remote. But that's only a question of naming. > Wietse Venema called it tainted, as far as I remember. > > I do agree with your assumption that remote code is not malicous in general. > But it is susceptible for changes by 3rd parties. There it might be useful to > add a feature to sign remote code. ?? My assumption is *not* that remote code is not malicious. In fact, anyone developing under this assumption is asking to be attacked. I must have been unclear. My assumption was that the goal of allow_url_include=0 is to prevent *unintentional* inclusion of remote code, as this is a serious source of security vulnerabilities. The problem is that a URL is not inherently remote. file://blah.php is for instance obviously a local file. What is really annoying is that userspace streams are considered to be remote arbitrarily. Let's think about this for a second: if a user is too inexperienced to know they should never use include with arbitrary user input, what are the chances they will even *know* it is possible to write a user stream wrapper to simulate http:// or other remote protocols, let alone know how to do it? Stanislav's suggestion of auto-disabling allow_url_fopen in a userspace stream if allow_url_include=1 should prevent the last unintentional hole. However, it would also be nice if a userspace stream could register itself as being remote, as this would add another layer of security. Streams such as http://pear.php.net/HTTP_WebDAV_Client could then tell PHP not to use them if allow_url_include=0, removing another attack vector possibility. Greg