Re:Exploiting 'INSERT INTO' SQL Injections Ninja Style
by devmach on Friday October 28, 2011 @04:18PM
(#3169904)
is it works also with prepared statements ? or only with really lame code ?
[ Parent
| on HN ]
Re:Exploiting 'INSERT INTO' SQL Injections Ninja Style
by troels on Friday October 28, 2011 @07:07PM
(#3170450)
It's injection attacks. Using prepared statements will prevent that.
Re:Exploiting 'INSERT INTO' SQL Injections Ninja Style
by jeltz on Friday October 28, 2011 @08:19PM
(#3170625)
It is not actually prepared statements that does that, it is parametrized statements. Prepared statements is a related by mostly orthogonal concept.
Prepared statements are about caching parsing and query planning and storing queries for future use, this gains performance and convenience but not necessarily security. You can use parametrized queries without storing them as prepared queries at the server. This is what Perl DBI, libpq (the C binding for PostgreSQL) and many others do.
In PostgreSQL you can use PREPARE and EXECUTE directly instead of through the convenience functions in your driver and be vulnerable to SQL injections. E.g.
PREPARE foo (boolean) AS SELECT $1;
EXECUTE foo (pg_terminate_backend(42)));