Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EDBBC6502C1 for ; Mon, 1 Sep 2008 10:50:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 58527-07-4 for ; Mon, 1 Sep 2008 10:50:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web52404.mail.re2.yahoo.com (web52404.mail.re2.yahoo.com [206.190.48.167]) by postgresql.org (Postfix) with SMTP id 0379965027E for ; Mon, 1 Sep 2008 10:50:19 -0300 (ADT) Received: (qmail 549 invoked by uid 60001); 1 Sep 2008 13:50:16 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Message-ID; b=XuYNWFB5zptrrdm/NclFVnO1qfTBf+kGWs4j9/X+ZbzdEhJy8KZRPdHcdVD6HZVmfIg4MxEZS/7991FJ6DciVXY5ZPlrdYTqow7lv6i7YkMZHXtQ6NVT6gnmgMmr8qD/k02NpH94B1pUChH+umIxKEZ9apsQt9PwHdr2thNnzOM=; X-YMail-OSG: O6zFFTYVM1nqMbRVfp5h.GItF3r4UbLrsfI3ale3_dkJues1UYlfBxKHGwUiX7C.yD5mXGlUtMfybFZqyBdHuA1cCPpWEA6V34PDFyv28j1.gx9bL9CJAkV7l8rWsd0pqs8- Received: from [115.131.21.54] by web52404.mail.re2.yahoo.com via HTTP; Mon, 01 Sep 2008 06:50:16 PDT X-Mailer: YahooMailWebService/0.7.218.2 Date: Mon, 1 Sep 2008 06:50:16 -0700 (PDT) From: Kevin Golding Reply-To: tearinghairout@yahoo.com Subject: pg_query_params and SQL injection To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <723113.98907.qm@web52404.mail.re2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.117 tagged_above=0 required=5 tests=RCVD_IN_SORBS_WEB=1.117 X-Spam-Level: * X-Archive-Number: 200809/1 X-Sequence-Number: 3887 Hi all I am just doing some playing around with PHP to learn how to avoid SQL injection attacks. It has been mentioned in a few places that pg_query_params is supposed to protect from sql injection without needing to mess around escaping quotes and things. However, I was still able to get it to drop a table by feeding in this input "1; drop table results" to the following statement: $r = pg_query_params($p, 'select * from results where res_id = $1', array($input)); Everyone keeps repeating the same "pg_query_params is safe from SQL injection", but surely someone else must have actually tried it? Where am I going wrong? I am using Postgresql 8.3 for OS X on 10.5.2, and MAMP which has PHP Version 5.2.5. Thanks Kevin