Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87416 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51992 invoked from network); 30 Jul 2015 19:32:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2015 19:32:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.180 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.180 mail-lb0-f180.google.com Received: from [209.85.217.180] ([209.85.217.180:34484] helo=mail-lb0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/72-34806-DDB7AB55 for ; Thu, 30 Jul 2015 15:32:46 -0400 Received: by lbqc9 with SMTP id c9so8186776lbq.1 for ; Thu, 30 Jul 2015 12:32:42 -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=ZkUqh5oGdQwyNXkMxqLhKVkvbVSIRENZKP5EG57Wel8=; b=YGH1aP+HdFurH/GHKQ5nCiayHTc3n+nns4Gcg4FJ79KUvo5LBGDZdQJmm8O/wQhBHm OT6UMvdwMBMnf0DxjHfHFZ8G/IouBEs2Sm8bdG/Sa+v/F7aI252Nr3pxwhHYWaLtxEBI 5yCzusaL3phlAMVb/3E00Vm3jzbCv5ID8hybEfmV1gh9MarSf17uB0UxtBQEAu0BWO6e z/b8hsHQBGPAAifIK7etxwx+uhquotbflNbA6rDlWf3JuEnlHl/hDW5lRDSJQYwznIxc wQV+n8eM/hNF6XvCJGqkSHTilV0Jm230pxahzYVnU5UayjBMqClF2HDcaiVWuMvitPzu Q/Ag== MIME-Version: 1.0 X-Received: by 10.152.203.162 with SMTP id kr2mr46145475lac.57.1438284762687; Thu, 30 Jul 2015 12:32:42 -0700 (PDT) Received: by 10.25.5.215 with HTTP; Thu, 30 Jul 2015 12:32:42 -0700 (PDT) In-Reply-To: <55BA7395.2090202@gmail.com> References: <55BA59A1.9020503@freepanel.net> <55BA7395.2090202@gmail.com> Date: Thu, 30 Jul 2015 15:32:42 -0400 Message-ID: To: Stanislav Malyshev Cc: Jake , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Disabling External Entities in libxml By Default From: ircmaxell@gmail.com (Anthony Ferrara) Stas, On Thu, Jul 30, 2015 at 2:57 PM, Stanislav Malyshev wrote: > Hi! > >> The problem here is that imagine the following: > > I think if we separate the loading the initial file (i.e., staring point > of the XML parser) and the loading the entities from that file (which is > not happening right now) we'd solve many BC problems. Not sure about > SOAP, but many others for sure. Yeah, that seems reasonable. I'll take a peek at the code to see how bad it will be to separate it (though I'm not familiar with the xml extensions much). >> I know that you want it to work, but this is actually a great place to >> fail, because you're loading a trusted resource over HTTP. Meaning >> that an attacker could MITM and inject malicous XML into the response, >> and own your server without even needing to own the endpoint. > > I feel like XML parser is a wrong place to solve this problem, transport > security can be done in HTTPS, signatures, etc. Otherwise many protocols > that rely on XML - such as SAML, which is quite widely used - would be > completely useless. Yeah, it's a pretty complex problem. I think there should likely be multiple levels of defense. One level is limiting external entity requests by default. Another level would be potentially to add a context option to dom document to allow you to whitelist URLs or servers. I think the point would be to document and make it secure by-default, but provide the ability to turn it back on if you know what you're doing (though that potentially has a bunch of possible problems as well). Anthony