Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Protection from...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 23 Topic 3439 of 3799
Post > Topic >>

Protection from SQL injection

by thomas.tom.mueller@[EMAIL PROTECTED] ("Thomas Mueller") Apr 26, 2008 at 06:32 PM

Hi,

As you know, "SQL injection" is the main security problem of databases
today.

I think I have a solution: 'disabling literals'. Or you may call it
'enforcing the use of parameterized statements'. This means that SQL
statements with embedded user input are rejected at runtime. My
solution goes beyond saying "developers ~should~ use parameterized
statements". That is not a solution because developers are lazy. My
solution is: "developers MUST use parameterized statements". It goes
like this: Literals are disabled using the SQL statement:

SET ALLOW_LITERALS NONE;

Afterwards, SQL statements with text are not allowed any more. That
means, SQL statement of the form "SELECT * FROM USERS WHERE
PASSWORD='qerkllkj'" will fail with the exception 'Literals are not
allowed, please use parameters'. It is like the database does not know
what ='qerkllkj' means. Only statements of the secure form are
allowed, for example "SELECT * FROM USERS WHERE PASSWORD=?". This
solves the problem because SQL injection is almost impossible if user
input is not directly embedded in SQL statements.

The 'ALLOW_LITERALS NONE' mode is enabled by the developer itself, or
by an administrator. It is still possible to generate SQL statements
dynamically, and use the same APIs as before, as long as SQL
statements don't include literals. Literals can still be used when
using query tools, or in applications considered 'safe'. To ease
converting the application to use parameterized queries, there should
be a second mode where number literals are allowed: SET ALLOW_LITERALS
NUMBERS. To allow all literals, execute SET ALLOW_LITERALS ALL (this
is the default setting).

So far this feature is implemented in my little database H2. More
information about this feature is described here:
http://www.h2database.com/html/advanced.html#sql_injection

What do you think about it? Do you think it makes sense to implement
this security feature in PostgreSQL as well? If not why not? Does
PostgreSQL have another solution or plan to solve the SQL injection
problem?

Regards,
Thomas

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 23 Posts in Topic:
Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-26 18:32:35 
Re: Protection from SQL injection
tgl@[EMAIL PROTECTED] (T  2008-04-26 13:05:14 
Re: Protection from SQL injection
systemguards@[EMAIL PROTE  2008-04-26 13:16:10 
Fwd: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-26 20:16:56 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-26 20:19:40 
Re: Protection from SQL injection
systemguards@[EMAIL PROTE  2008-04-26 16:31:46 
Re: Protection from SQL injection
spam_eater@[EMAIL PROTECT  2008-04-26 23:32:58 
Re: Protection from SQL injection
scott.marlowe@[EMAIL PROT  2008-04-26 18:21:48 
Re: Protection from SQL injection
tgl@[EMAIL PROTECTED] (T  2008-04-26 23:42:14 
Re: Protection from SQL injection
scott.marlowe@[EMAIL PROT  2008-04-26 21:50:10 
Re: Protection from SQL injection
tgl@[EMAIL PROTECTED] (T  2008-04-26 23:58:40 
Re: Protection from SQL injection
scott.marlowe@[EMAIL PROT  2008-04-26 23:24:59 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-27 09:08:30 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-27 10:48:55 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-27 11:08:56 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-27 11:14:11 
Re: Protection from SQL injection
mail@[EMAIL PROTECTED] (  2008-04-27 11:29:09 
Re: Protection from SQL injection
mail@[EMAIL PROTECTED] (  2008-04-27 12:38:48 
Re: Protection from SQL injection
mail@[EMAIL PROTECTED] (  2008-04-27 14:22:53 
Re: Protection from SQL injection
dev@[EMAIL PROTECTED] (J  2008-04-27 11:55:18 
Re: Protection from SQL injection
mail@[EMAIL PROTECTED] (  2008-04-27 19:18:40 
Re: Protection from SQL injection
thomas.tom.mueller@[EMAIL  2008-04-27 20:43:32 
Re: Protection from SQL injection
dev@[EMAIL PROTECTED] (J  2008-04-27 14:25:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:57:51 CST 2008.