Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87739 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32782 invoked from network); 13 Aug 2015 11:00:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2015 11:00:49 -0000 Authentication-Results: pb1.pair.com header.from=craig@craigfrancis.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=craig@craigfrancis.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain craigfrancis.co.uk designates 209.85.212.169 as permitted sender) X-PHP-List-Original-Sender: craig@craigfrancis.co.uk X-Host-Fingerprint: 209.85.212.169 mail-wi0-f169.google.com Received: from [209.85.212.169] ([209.85.212.169:38451] helo=mail-wi0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/F2-00702-FD87CC55 for ; Thu, 13 Aug 2015 07:00:47 -0400 Received: by wicja10 with SMTP id ja10so64811789wic.1 for ; Thu, 13 Aug 2015 04:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Wmp+mJHdlsJ2oLsOYmKjDhKfFn/vWdjIz2GdeE/mDX8=; b=VDpc2CH1uk/Ty18Q19YfRy3bF8wAPULHFoKJz6fXMuGIllPS2dv86o0HU0Olud47KG 60++dAtoXjEZ1wzfTZOq4pn9VQu3uyhfVC1nMNnwaRAODfKp5iIGHnO8zuUkwtGq9Rk5 JkSpwfZNLjaNf64lW+20fQZVOXbbzUBAow+qs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=Wmp+mJHdlsJ2oLsOYmKjDhKfFn/vWdjIz2GdeE/mDX8=; b=iGTWinUAjJEmbG3NVgf94u1mdht0fjl3gYmLjklPkOHdUno8/QPWUTVovvCS/N81VX ELW0WzLzSSi0xkj5DQOBY2VpbXZxvlOhyw2GhSIgyvI5sjtLwmLDRr4GpJ2i1H315Iub MOfb6lFsMP9aMtl6giClUwthEGzk8Vl29xwraqGmb594RMrAHs2qjpcJnSFBkwStGUgo JE1K1dBqf82ZhMstWAN9rZlApZv+hG13XJePk95GL1PH3iL333jRKDwMxMt3TUpq8c9b IlN/UuOFyFlMbHHO087m2glu4x97fHGiELry/7nzwqK5fygh3n4HW2ljMZXw3xRx0DEc /KeQ== X-Gm-Message-State: ALoCoQnLlpmAlJW+RlqDLvkwk1MHEX5SLvnPJTvEy/wEIabTJLAHnkgeEuoCrFCPkhK6Q0Q4nlGj X-Received: by 10.180.189.17 with SMTP id ge17mr54045965wic.90.1439463644466; Thu, 13 Aug 2015 04:00:44 -0700 (PDT) Received: from [192.168.1.12] (cpc79329-chap9-2-0-cust385.18-1.cable.virginm.net. [82.44.123.130]) by smtp.gmail.com with ESMTPSA id fq15sm2815515wjc.12.2015.08.13.04.00.43 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Aug 2015 04:00:43 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <55CA88A4.4050407@gmx.de> Date: Thu, 13 Aug 2015 12:00:41 +0100 Cc: Anthony Ferrara , Julien Pauli , Matt Tait , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <37CFFAF1-52CD-40E5-9C60-71F6F7ADA59C@craigfrancis.co.uk> References: <882D42B0-3554-4CAC-9EB9-09A0F00A35E8@craigfrancis.co.uk> <55CA88A4.4050407@gmx.de> To: Christoph Becker X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Block requests to builtin SQL functions where PHP can prove the call is vulnerable to a potential SQL-injection attack From: craig@craigfrancis.co.uk (Craig Francis) On 12 Aug 2015, at 00:43, Christoph Becker wrote: > On 10.08.2015 at 11:57, Craig Francis wrote: >=20 >> You only have to skim read things like the second comment (with 27 up = votes) on the PDO prepare page to see that these problems are happening = all the time: >>=20 >>=20 >> http://php.net/manual/en/pdo.prepare.php#111458 >> SELECT * FROM users WHERE $search=3D:email >=20 > "Skim reading" things might be the problem (here). The user = contributed > note states: >=20 > | In my case I allow the user to enter their username or email, > | determine which they've entered and set $search to "username" or > | "email". As this value is not entered by the user there is no > | potential for SQL injection and thus safe to use as I have done. >=20 > So to me that note looks pretty fine. But that is the problem, many "programmers" (and I know I don't have = numbers to back this up) do just skim read the docs. They often have a = problem, and do little research to solve that immediate problem (i.e. = make it run, don't care what it does or how it does it). I say this as someone who is frequently finding issues that just should = not be happening. But at the moment there is nothing that helps = developers identify those problems or mistakes (with the possible = exception of static analysis). Craig