Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61912 invoked from network); 7 May 2012 07:28:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2012 07:28:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.173 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.160.173 mail-gh0-f173.google.com Received: from [209.85.160.173] ([209.85.160.173:41388] helo=mail-gy0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/53-33304-1B977AF4 for ; Mon, 07 May 2012 03:28:50 -0400 Received: by ghrr14 with SMTP id r14so5177967ghr.18 for ; Mon, 07 May 2012 00:28:46 -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=qS6jYGGeg9hSI2MVQgHavsNlfpId+8kVPh640Z5aTvg=; b=LvY4zt3X4RXFrBBVKWhdJ0aK8MGgEUrkiwUfVjVeD0toUaA7QbLr5KT30QCDNJmCBh cL1n8HVnNgZwt22VmQPQkmdDTUXyyxwpOhIvycn5DYZwWTjabSos+fvXw5B29Sdy18qU o25s6Ln6vxOJQfTQb4qfR400wLpj5Yb0RTrku3ubXZKPz/NqQACwYc1k/jLJ6s4Hx7as zKJKR1S9Y/j6Fuy6uGFIpdJ+fPjNZKnlonLW011NqeDbTDBTsVEpJ/amdf8xLiMGI5gG x4r2JeBt/dX1xWXFDn6UBsOvHLqrbvK0NZ3RB0IQCC/8jZQUgWS4c/4BYyT79SVPKXq1 ttOw== MIME-Version: 1.0 Received: by 10.42.139.9 with SMTP id e9mr2525769icu.43.1336375726120; Mon, 07 May 2012 00:28:46 -0700 (PDT) Received: by 10.64.164.134 with HTTP; Mon, 7 May 2012 00:28:46 -0700 (PDT) Received: by 10.64.164.134 with HTTP; Mon, 7 May 2012 00:28:46 -0700 (PDT) In-Reply-To: References: <4F847B8A.9010007@sugarcrm.com> <733bc8ea59cf6737563a62886e92fcb6.squirrel@www.l-i-e.com> Date: Mon, 7 May 2012 10:28:46 +0300 Message-ID: To: Tjerk Anne Meesters Cc: PHP Internals , Richard Lynch Content-Type: multipart/alternative; boundary=90e6ba613862711d6704bf6d383f Subject: Re: [PHP-DEV] [off] PHP: a fractal of bad design From: arvids.godjuks@gmail.com (Arvids Godjuks) --90e6ba613862711d6704bf6d383f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello internals, I should voice my opinion that such things like comparing two strings starting with numbers and that they resolve to actual integer/float for comparation is bad, really bad. That just defies the logic and yealds absolutly unexpected results. I pride myself that i know the juggling rules well, but I'm shocked by this to say the least... In my opinion this should change no matter the BC breaks it will create, this one affects security big time. It's good I actually hash my passwords in the MySQL and not on the PHP side, but I have seen hash comparations with =3D=3D all the time. And now that this has been discussed in detail I expect this to be used as an attack method grow wide. 07.05.2012 5:32 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0= =B5=D0=BB=D1=8C "Tjerk Anne Meesters" =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > On Sun, May 6, 2012 at 12:17 AM, Richard Lynch wrote: > >> What exactly valid points? =3D=3D is a converting operator, =3D=3D=3D = is a > >> strict > >> operator. OK, in his favorite language it is not. Where exactly the > >> valid point is? Author goes at great lengths to refuse to make even a > >> slight mental effort to understand how it works (really, it's not that > >> hard) and then complains it's "useless". Well, a lot of things would > >> be > >> useless if you don't want to know how to use them. > > > > He has a few valid points in the part I read before I got bored... > > > > $a =3D "123ABF453..."; //a password > > $b =3D "123DFEABC..."; //another one > > if ($a =3D=3D $b){ > > //you're in. > > } > > > > Yes, one should have validated the input... > > > > But you don't have to be THAT naive to think that the hashed value of > > an SQL injection attack just isn't going to work, so it's "safe"... > > > > I'll bet I have some of these in my (recent) code, for that matter. > > > > On the other hand, if you accept type juggling, you have to expect the > > other cases he has for =3D=3D being a bit strange. > > Validated or not, why would type juggling even come into the picture > if both variables are of the same type? > > 123 =3D=3D "123abc" // sure, why not > "61529519452809720693702583126814" =3D=3D > "61529519452809720000000000000000" // WAT?! > > In the above, only the first ~50% of an md5 hash has to be correct. > This gets even worse for SHA256 hashes. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --90e6ba613862711d6704bf6d383f--