|
|
|
date: Fri, 19 Sep 2008 05:15:00 -0700,
group: microsoft.public.sqlserver.security
back
Re: Securing System Tables
Scott M (ScottM@discussions.microsoft.com) writes:
> In light of the recent sql injection attack that iterates through system
> tables, we are tightening down security for our Application Logins.
>
> I am not able to deny select on views in the "sys" & "INFORMATION_SCHEMA
> "schemas for a role I have created called "DenySystemTableSelect". I used
> this statement:
It may be related to that the sys schema lives in mssqlsystemresource.
In any case, I don't think it is a very good idea to pursue, as it
could break a lot of things. Nor is there any need to.
By default, in SQL 2005, a user may only see the definition of object
he has access to. If you grant a user access to an object, he also gets
VIEW DEFINITION permissions on the database.
If you want to hide all metadata for a user you can do
DENY VIEW DEFINITION TO someuser
The user cannot read any metadata.
But it is not uncommon for application to run meta-data queries to find
out the columns of tables or parameters of stored procedures. They will
break.
Furthermore, what you are achieving is only security by obscurity. As long
as your code is open to SQL injection and your application login has
write access to the tables, you will still be open to SQL injection. The
intruder will just have to blindly guess the table names. But intruders
often have plenty of time on their hands, so that is a small issue.
If you really want to protect yourself against SQL injection, first step
is to have application to use parameterised commands. A second step
would be to move to use stored procedures which would permit you to
revoke direct permissions on the tables. (Although it could be argued
that stored procedures also falls in the security-by-obscurity category.)
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
date: Sat, 20 Sep 2008 06:35:22 -0700
author: Erland Sommarskog
|
|