Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94133 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64808 invoked from network); 19 Jun 2016 18:33:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2016 18:33:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=michael.vostrikov@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=michael.vostrikov@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.176 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.220.176 mail-qk0-f176.google.com Received: from [209.85.220.176] ([209.85.220.176:33442] helo=mail-qk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/03-18862-395E6675 for ; Sun, 19 Jun 2016 14:33:56 -0400 Received: by mail-qk0-f176.google.com with SMTP id a186so138059551qkf.0 for ; Sun, 19 Jun 2016 11:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4DBP2o9CpSpuYM2n0qAIKRGJKaE17skfc3q1+BpAnjw=; b=zmVhkvHVPqVSH1jGsfg8cPmC6DwSPeK7GUnMd5Hcb44F6P6rGKlDKAjNNJzMeCIpB3 TYAASeYHMu+BP3mxiQx/rORmxlyUSzP3A3qZhVVoLjK935WfnAFPsnCWDhrAtNl8SDFl 6N6qfTZVmCZ13HdljqOO7hTSsHvk8BzmLUVvF6SxSLosQjsFP5Bbhy794WbVbNiK+Arf 9Rdgz8UP7Pen/4bWsQMaHQcFQJorlzF/ud5RCcEvFaJJcKtpS614W+YxYwypuZ0AEHaS cIpGq6nbB6KT19ICv0tVpCLJE8F+TwSxQQqgmhFS3NWfeijOs38qy+O96/ir/7F+H2Fk +NEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4DBP2o9CpSpuYM2n0qAIKRGJKaE17skfc3q1+BpAnjw=; b=TLYJglW/EiP7lj6hsC345k75YVQitZccMY6zDUfgMK/UKb02mdM7ir+kn/2ULij8Oy 9acBS7m3iaKZMIx/HHf+Z5J9qmOc5Enu/J2yyHtZGvCDUannbr/izDIIdxb1k28F7Tl7 toVvBA6dKjFi1sGDJA9P2PNt1pTIkKm6PU5nZ7UuG+nEAy0nEbp2YuFX9xZczdjeDycc Dux8LIQ2otVRxKxWaBGZ3+xqzElAuar29yHE5lvFsu0NNBo19F2sfc6H2nWNZEnfiK/B HcVNYpjMBhuLwfj/5vJtq0eD6ferlQYKf5E33TUsRhWiu1kQXuMzlDI25ymGsW4s35XX fjBg== X-Gm-Message-State: ALyK8tJ8PNoEfCouPPf8JM7Ca3SV9dC+Y2wn0uJNMKhaqTYtRUp6WA4aO4V3NA1GcAQ7kKYfJn/c8I5MGllz6g== X-Received: by 10.200.50.77 with SMTP id y13mr16591951qta.5.1466361232431; Sun, 19 Jun 2016 11:33:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.53.71 with HTTP; Sun, 19 Jun 2016 11:33:51 -0700 (PDT) In-Reply-To: References: <20160617202344.2868F1A80C02@dd1730.kasserver.com> <57665E36.60302@lsces.co.uk> <5766D311.6030503@lsces.co.uk> Date: Sun, 19 Jun 2016 23:33:51 +0500 Message-ID: To: Walter Parker Cc: Scott Arciszewski , Lester Caine , PHP Internals Content-Type: multipart/alternative; boundary=001a113ff1705f21670535a5d457 Subject: Re: [PHP-DEV] New escaped output operator From: michael.vostrikov@gmail.com (=?UTF-8?B?0JzQuNGF0LDQuNC7INCS0L7RgdGC0YDQuNC60L7Qsg==?=) --001a113ff1705f21670535a5d457 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Lester > there is NO need to simply slap htmlspecialchars() onto > properly built data There are many cases when user data can contain quotes or other html entities. " /> // $book['title'] =3D 'When we say "Hello"';
// $user['about_me'] =3D 'I am a programmer. I like to write in "About me" field'; Walter > where getting it 90% correct is worse that not doing anything at all. > Things like this will cause people to be blindsided when the uncaught escapes > cause the next major security problem. Why do you think so? What real problems can happen if there will be a short operator for htmlspecialchars()? 2016-06-19 22:48 GMT+05:00 Walter Parker : > From your story Scott, it looks like the failure was bad input filtering, > not input filtering in general. If sites are really trying to be secure, > they should follow both Lester's and your ideas and filter on input and > escape on output. > > Given your second link the better suggestion is to stop taking raw HTML. > Assuming user generated HTML is ever safe to re-render in an output page > has been a bad idea for years. Ebay/paypal once thought that stripping al= l > letters and numbers from JavaScript was enough to make it safe, it wasn't= . > Somebody used just things like (){}[]=3D+ to build functional attack scri= pts. > > While a simple method of output escaping seems like a good idea, I agree > with the others that point out that is one of those security systems wher= e > getting it 90% correct is worse that not doing anything at all. Things li= ke > this will cause people to be blindsided when the uncaught escapes cause t= he > next major security problem. > > > Walter > > On Sun, Jun 19, 2016 at 10:28 AM, Scott Arciszewski > wrote: > > > On Sun, Jun 19, 2016 at 1:14 PM, Lester Caine > wrote: > > > > > Well we have to disagree ... simply expecting htmlspecialchars() to f= ix > > > all your problems without proper handling of the input text is 'the b= ig > > > mess' and there is NO need to simply slap htmlspecialchars() onto > > > properly built data so the idea that > > totally pointless! > > > > > > -- > > > Lester Caine - G8HFL > > > ----------------------------- > > > Contact - http://lsces.co.uk/wiki/?page=3Dcontact > > > L.S.Caine Electronic Services - http://lsces.co.uk > > > EnquirySolve - http://enquirysolve.com/ > > > Model Engineers Digital Workshop - http://medw.co.uk > > > Rainbow Digital Media - http://rainbowdigitalmedia.co.uk > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > =E2=80=8BLet me tell you a story. > > > > Once upon a time, WordPress decided to escape user input to protect > against > > XSS attacks. Then this happened: https://klikki.fi/adv/wordpress2.html > > (Stored XSS via MySQL Column Truncation vulnerability.) > > > > Escaping against XSS attacks should happen on output, not on input. Dea= d > > stop. > > > > You MAY cache the escaped output for performance gains, but keep the > > unescaped data in the database in case you need to adjust your escaping > > strategy without mangling existing data. > > > > Further reading: > > > > > https://paragonie.com/blog/2015/06/preventing-xss-vulnerabilities-in-php-= everything-you-need-know > > =E2=80=8B > > > > Scott Arciszewski > > Chief Development Officer > > Paragon Initiative Enterprises =E2=80=8B > > > > > > -- > The greatest dangers to liberty lurk in insidious encroachment by men of > zeal, well-meaning but without understanding. -- Justice Louis D. > Brandeis > --001a113ff1705f21670535a5d457--