X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E0720528A1 for ; Fri, 27 May 2005 13:00:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32346-02 for ; Fri, 27 May 2005 16:00:42 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 21B955288C for ; Fri, 27 May 2005 13:00:38 -0300 (ADT) Received: (qmail 3966 invoked by uid 500); 27 May 2005 15:59:22 -0000 Date: Fri, 27 May 2005 10:59:22 -0500 From: Bruno Wolff III To: Ed Finkler Cc: pgsql-php@postgresql.org Subject: Re: Effectiveness of pg_escape_string at blocking SQL injection attacks Message-ID: <20050527155922.GA3930@wolff.to> Mail-Followup-To: Bruno Wolff III , Ed Finkler , pgsql-php@postgresql.org References: <4297435C.20605@cerias.purdue.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4297435C.20605@cerias.purdue.edu> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/36 X-Sequence-Number: 3150 On Fri, May 27, 2005 at 10:57:16 -0500, Ed Finkler wrote: > Folks, > > The php mysql api has a function "mysql_real_escape_string" that seems > to be able to thwart known SQL injection attacks -- at least the ones of > which I and other people I've discussed this with know. I am curious to > know if pg_escape_string is as effective. If not, what would need to be > modified to make it more effective? > > (there is a possibility that I may be able to get a grad student to work > on this at the center, so detailed responses would be appreciated.) The best advice is to use bind parameters rather than trying to build SQL strings consisting partly of user input.