Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

unknown user has rights in the db's Expand / Collapse
Author
Message
Posted Tuesday, December 17, 2013 3:52 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:13 AM
Points: 925, Visits: 861
Hi All,

Help me solve this quiz. I removed individual user logins and introduced group logins of which is working well. I'm baffled by one whose account can drop and do more stuff, when i check under each db and security folder the user doesnt exist. all the groups are granted correct permission

i ran xp_logininfo nothing of that user, what more can i check?

thanks





It's better to fail while trying, rather than fail without trying!!!
Post #1523593
Posted Tuesday, December 17, 2013 6:03 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:24 AM
Points: 12,744, Visits: 31,069
i'm thinking that your user is in a windows group that grants them permissions you didn't expect.

this query seems to get all the individual mappings for all the groups i have added on my server;
from there, i can query it and find myself, and what groups i belong to:

IF OBJECT_ID('tempdb.dbo.#tmp') IS NOT NULL
DROP TABLE #tmp

CREATE TABLE [dbo].[#TMP] (
[ACCOUNT NAME] NVARCHAR(256) NULL ,
[TYPE] VARCHAR(8) NULL ,
[PRIVILEGE] VARCHAR(8) NULL ,
[MAPPED LOGIN NAME] NVARCHAR(256) NULL ,
[PERMISSION PATH] NVARCHAR(256) NULL )

DECLARE @groupname NVARCHAR(256)

DECLARE c1 CURSOR FOR SELECT name FROM master.sys.server_principals WHERE type_desc = 'WINDOWS_GROUP' AND CHARINDEX('$',name) = 0
OPEN c1
FETCH NEXT FROM c1 INTO @groupname
WHILE @@FETCH_STATUS <> -1
BEGIN
INSERT INTO #tmp([ACCOUNT NAME],[TYPE],[PRIVILEGE],[MAPPED LOGIN NAME],[PERMISSION PATH])
EXEC master..xp_logininfo @acctname = @groupname,@option = 'members' -- show group members
FETCH NEXT FROM c1 INTO @groupname
END
CLOSE c1
DEALLOCATE c1

SELECT * FROM [#TMP]
--WHERE [MAPPED LOGIN NAME] = 'mydomain\Lowell'






Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1523648
Posted Tuesday, December 17, 2013 9:15 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:16 AM
Points: 153, Visits: 945
When You impersonate that user and tun SELECT USER_NAME(), what do you get?
Next: what does sys.fn_mypermissions return?


Andreas

---------------------------------------------------
MVP SQL Server
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.insidesql.org/blogs/andreaswolter
www.andreas-wolter.com
Post #1523756
Posted Tuesday, December 17, 2013 9:57 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:13 AM
Points: 925, Visits: 861
Thanks for the response will test and advise




It's better to fail while trying, rather than fail without trying!!!
Post #1523937
Posted Wednesday, December 18, 2013 3:58 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:13 AM
Points: 925, Visits: 861
I ran the command from his SSMS then return "guest" but the user guest is disabled from the user db's only active in the master and tempdb




It's better to fail while trying, rather than fail without trying!!!
Post #1524016
Posted Wednesday, December 18, 2013 11:02 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:16 AM
Points: 153, Visits: 945
what do the following DMVs return?

select * from sys.user_token
select * from sys.login_token

use impersonation, so you can copy the result
->
execute as login = 'XYZ'


Andreas

---------------------------------------------------
MVP SQL Server
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.insidesql.org/blogs/andreaswolter
www.andreas-wolter.com
Post #1524252
Posted Thursday, December 19, 2013 5:55 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:13 AM
Points: 925, Visits: 861
Please attachement when running user_token




It's better to fail while trying, rather than fail without trying!!!


  Post Attachments 
SQL.JPeG (9 views, 41.38 KB)
Post #1524532
Posted Thursday, December 19, 2013 6:31 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:16 AM
Points: 153, Visits: 945
Well
as you can see, your user is member of the Windows Group "Domain\SHR_Dev"
and thereby member of the db_datareader database role inside this database

But you said that at the same time that user's user-name is "guest"? This doesn't make sense at all to me. It should show up as "Domain\SHR_Dev".

Also do a check for permissions for that individual with the function I provided..


Andreas

---------------------------------------------------
MVP SQL Server
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.insidesql.org/blogs/andreaswolter
www.andreas-wolter.com
Post #1524544
Posted Friday, December 20, 2013 3:00 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:13 AM
Points: 925, Visits: 861
when i ran it first time i was on the master db, then connected to the user db




It's better to fail while trying, rather than fail without trying!!!
Post #1524906
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse