Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69222 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60333 invoked from network); 19 Sep 2013 02:51:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2013 02:51:07 -0000 Authentication-Results: pb1.pair.com header.from=rdlowrey@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rdlowrey@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: rdlowrey@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ea0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:38835] helo=mail-ea0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/75-29009-9966A325 for ; Wed, 18 Sep 2013 22:51:06 -0400 Received: by mail-ea0-f170.google.com with SMTP id h14so3854244eak.15 for ; Wed, 18 Sep 2013 19:51:02 -0700 (PDT) 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; bh=lw1cuweKJzaiefL15EcaxfuWT2foLVsaHFhvobkdU4o=; b=IudLokwkKJTmq6qHL5OE0BhzVg+ag052KXfCJZWsywSdv1CaP/Aoa0MjegA4diXbPD eAd33YXq9kQ7wdJOl5btOgm1LK9vfJfHcbap6cQOL1+PHwOk5od7dsZP0w2Uj21Qb8Fc AoUcYsmUKny+6FRlaoU6yCGQVZFukEza5x+8KUa4htuCpNESukDBn0cLwC+q4s7Npw80 U864CpFVONocHHQQaf4zAq1Pq9bN0KfjSIXw3TX0HTudPksX9QqKL1WgzlxSgYjqWXcQ 4ud/TMOMFLo6BLC/2y37LZpGPrI6cxPUigiyfEA4VwNHPKHQPJMWKK7Q6Me3BCVHUtgI njVQ== MIME-Version: 1.0 X-Received: by 10.14.37.4 with SMTP id x4mr64489012eea.16.1379559062490; Wed, 18 Sep 2013 19:51:02 -0700 (PDT) Received: by 10.223.199.129 with HTTP; Wed, 18 Sep 2013 19:51:02 -0700 (PDT) In-Reply-To: References: <523A466C.4070903@gmail.com> Date: Wed, 18 Sep 2013 22:51:02 -0400 Message-ID: To: Tjerk Anne Meesters Cc: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= , johannes@schlueters.dot.de, addw@phcomp.dot.co.uk, "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c39198ddfe6c04e6b39f01 Subject: Re: [PHP-DEV] Re: Re: PHP Crypt functions - security audit From: rdlowrey@gmail.com (Daniel Lowrey) --001a11c39198ddfe6c04e6b39f01 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > While we're on the topic, it's actually worse than that. Even if you > turn peer validation and name checking on, PHP can't handle > subjectAltNames in certificates, which causes quite a few failures. This is incorrect. PHP has supported both the "SNI_enabled" and "SNI_server_name" SSL context options since 5.3. Anything older than 5.3 is not remotely worth worrying over. You can verify this for yourself using the following code: [ 'verify_peer' =3D> TRUE, 'cafile' =3D> '/path/to/cacert.pem', // <-- change to point to an actua= l CA file 'SNI_enabled' =3D> TRUE ]]); $uri =3D https://sni.velox.ch/ // <--- A test site using SNI certs $result =3D file_get_contents($uri, FALSE, $ctx); P.S. Thank you to whomever updated http://php.net/manual/en/context.ssl.phpto reflect the "disable_compression" SSL stream context option (and subsidized my laziness) :) On Wed, Sep 18, 2013 at 9:06 PM, Tjerk Anne Meesters wrot= e: > > > > On Thu, Sep 19, 2013 at 8:33 AM, =C1ngel Gonz=E1lez w= rote: > >> On 16/09/13 15:58, Daniel Lowrey wrote: >> >>> More generally, PHP's stream encryption aspects are quite poorly >>> documented. For example, https:// streams disable peer verification by >>> default. While I understand that this is necessary to provide the easie= st >>> possible user experience for things like `file_get_contents(" >>> https://somesite.com")`, it's also horribly insecure. 99% of people >>> using >>> tools like this won't know anything about this "feature" and won't >>> realize >>> that their stream transfers are totally vulnerable to Man-in-the-Middle >>> attacks by default. >>> >> Count me as one of those that didn't know https:// streams didn't verify >> certificates. :) >> *I consider this a bug* I understand that it's easier to code not >> verifying the >> peer, and the hostname may not be available when you are stacking ssl >> over a stream. >> But file_get_contents("https://...**") is *precisely* the case that >> should work right >> out of the box. > > > To be practical, verifying certificates requires an up-to-date CA bundle > to be shipped with PHP; perhaps this is a simple thing to do, I'm not sur= e. > This is an oft seen scenario for cURL; the developer would see the > certificate issue, search online and continue with `CURLOPT_VERIFY_PEER = =3D> > 0`. That said, at least cURL is configured to check the certificate by > default. > > > >> >> >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > -- > Tjerk > --001a11c39198ddfe6c04e6b39f01--