Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83818 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22375 invoked from network); 25 Feb 2015 19:39:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 19:39:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=padraic.brady@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=padraic.brady@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.176 as permitted sender) X-PHP-List-Original-Sender: padraic.brady@gmail.com X-Host-Fingerprint: 209.85.160.176 mail-yk0-f176.google.com Received: from [209.85.160.176] ([209.85.160.176:38165] helo=mail-yk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/91-12216-4052EE45 for ; Wed, 25 Feb 2015 14:39:49 -0500 Received: by ykp9 with SMTP id 9so1902910ykp.5 for ; Wed, 25 Feb 2015 11:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=neaGSZcmcGC7LN2E6BM8OiuYOyJsRQd4anB8pPniA5k=; b=mnNIbXb9utYfL4WrwAvbB+3UCmehldEn7UNDOQmt1gORTrtC8rDyZA0pDOjzJp2No7 ItTIouZZHbvdWQjCUolGPRJcLga6IEIzyaqW0l9x02hkM4A8+LgK69iuUIW7RZP82xrp TXrJ33sN9nn0RglIVtuJDlot9reVXpbcw5LBqoEvgc4Z/bZ2OVs2zART07NidfZXBAye P7rLCNhtduNBJAeKB478gWnqJHIGns5QVf+drRiidwXZEdDXyRpRcx3JKLkaBD2yGYaV RYFcZFCo3cyyq3bys/L7jrz7U+In4Rtl7zAj86BN0di0CBfOImJ7Lf6f65tQv2yHRLCa AuYA== MIME-Version: 1.0 X-Received: by 10.170.115.5 with SMTP id h5mr3780070ykb.87.1424893185246; Wed, 25 Feb 2015 11:39:45 -0800 (PST) Received: by 10.170.222.86 with HTTP; Wed, 25 Feb 2015 11:39:45 -0800 (PST) In-Reply-To: <0369AE4C-7676-408C-8A6F-16C975588ED5@googlemail.com> References: <54ECD4E3.9040705@gmail.com> <54ECFAA8.4020305@gmail.com> <54ED085C.8010901@gmail.com> <54ED1CE2.9060903@gmail.com> <54ED3F2F.7050203@gmail.com> <54ED5648.1020907@gmail.com> <0369AE4C-7676-408C-8A6F-16C975588ED5@googlemail.com> Date: Wed, 25 Feb 2015 19:39:45 +0000 Message-ID: To: "Kevin Ingwersen (Ingwie Phoenix)" Cc: Stanislav Malyshev , Yasuo Ohgaki , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Script only include/require From: padraic.brady@gmail.com (=?UTF-8?Q?P=C3=A1draic_Brady?=) Hi Kevin, On 25 February 2015 at 08:18, Kevin Ingwersen (Ingwie Phoenix) wrote: > Here are my cents to this RFC, as it just keeps popping in in my inbox an= d its beginning to be one that I wish I could ignore. > > First, =E2=80=A6 file extensions? A default Apache configuration and some= Nginx configurations actually accept more than one file extension. This RF= C does not include any way to specify a variety of extensions that should b= e blocked, ignored or treated else. Er...it has an ini setting to create the whitelist? Also, blacklists would never work - there might as well be an infinite number of file extensions. > Your PHP code is only so secure as you make it. If you are in need for su= ch an RFC just to block a few =E2=80=9Erare cases=E2=80=9C, then I would ra= ther suggest you to either check your source or hand it to a professional t= o get it counter-checked. So it does block "rare cases"? I dislike assigning rarity to security issues since that assumes we have actual hard data when we don't. All I can say definitively is that certain exploits in the area have been around since 2010. Most of the close-to-php reporting I've seen arrives around 2012. However, playing a numbers game about whether to implement a security protection or not is irrelevant. Either it is a security issue or it is not. It is. Getting your code audited is always a good idea, of course. > Besides of that, it is never a good idea to let a user upload /everything= / that they want to. A proper MIME-type check can be helpful in these scena= rios. PHP via EXIF jpeg field. MIME check would detect it as image/jpeg. Crackers have been using it in the wilds for years. MIME check of Stanislav's PHAR as a GIF would be detected as application/gzip for comparison since it's not a valid image. > Again, I would not vote for the RFC and I do not think positive about it,= since I see it very unnecessary. > > Thus, if an attacker really wants to get into your business, they have mo= re than one way to do so - for instance, exploiting the web server itself. This last sentence is true enough. For some reason though, we still fix other entirely unrelated security weaknesses in PHP itself... Paddy -- P=C3=A1draic Brady http://blog.astrumfutura.com http://www.survivethedeepend.com