db_owner permission required?

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 08-Jan-2006 17:25:16   

Is it a true statement that the SQL User account being used by the DQE must be a member of the db_owner role in order to run code that performs select, insert, update, and delete statements?

I was under the impression that the when the DQE runs, it turns the object graph into a call to sp_executesql, and that this stored procedure required db_owner level access?

I was also under the impression that simply adding the sql user account in question to the db_datareader and db_datawriter role would not be sufficient.

The reason I am asking this is because I have a client who beleives that using LLBLGen will violate their threat model because of 1. sql injection, and 2. elevate permissions that are required.

With regards to sql injection, I have tried to explain to them that the only way you could possibly be faced with sql injection would be when someone injected their own object into the DQE pipeline, and that if something like that should happen, then they have much worse problems to deal with.

So I am still battling with regards to the permissions issue.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Jan-2006 19:01:19   

Devildog74 wrote:

Is it a true statement that the SQL User account being used by the DQE must be a member of the db_owner role in order to run code that performs select, insert, update, and delete statements?

No. 1) the user specified in the connection string has to be a member of the 'public' role of the catalog 2) the user specified in the connection string has to have select rights on the tables it accesses, insert rights on the table it inserts data in etc. That's it.

I was under the impression that the when the DQE runs, it turns the object graph into a call to sp_executesql, and that this stored procedure required db_owner level access?

It calls ADO.NET statements. The SqlClient of .NET turns a command execution into a call to sp_executesql.

I was also under the impression that simply adding the sql user account in question to the db_datareader and db_datawriter role would not be sufficient.

The reason I am asking this is because I have a client who beleives that using LLBLGen will violate their threat model because of 1. sql injection, and 2. elevate permissions that are required.

sql injection is impossible, all values are parameterized. There's no value inserted into the query. the user doesn't have to be owner of the db.

With regards to sql injection, I have tried to explain to them that the only way you could possibly be faced with sql injection would be when someone injected their own object into the DQE pipeline, and that if something like that should happen, then they have much worse problems to deal with. So I am still battling with regards to the permissions issue.

What have you tried and what failed?

Be sure the user is part of the public role so it can actually access the db.

Frans Bouma | Lead developer LLBLGen Pro
sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 08-Jan-2006 19:01:21   

Strange I just tried this with and without db_owner assess and did not see any problems. Is there any more information you can supply so that I could replicate?

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 09-Jan-2006 17:56:49   

Otis wrote:

What have you tried and what failed?

Be sure the user is part of the public role so it can actually access the db.

I think that I must have just confused myself. In normal ADO.NET, if I take a command and set its text to "sp_executesql 'insert a sql statement here'", I thought the user needed to be a member of db_owner. Since this was my assumption, I may have made an invalid assumption regarding llblgen and its internal operations.