AD - Search Privileged Groups

mehdi dakhama 336 Reputation points MVP
2022-01-24T12:28:37.65+00:00

Hello everyone,

I'm working for a Script to AD hardening process, I want for the first step to list the ALL privileged groups, i used this command but i ask if the are a same other ways ? without of corse use name, perhaps same things with SID or other attributes

Get-ADUser -Filter "admincount -eq '1'" | Get-ADPrincipalGroupMembership | select name

Thanks,

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,178 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,906 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,729 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gary Reynolds 9,391 Reputation points
    2022-01-27T07:17:28.107+00:00

    Hi @mehdi dakhama - starting a new answer as I ran out of characters!

    Ok to summarize, you want to restrict the users, that can read properties of groups that provide elevated permissions in your AD environment. The list of groups goes beyond the groups that are current protected by the SDProp process.

    I do need to make the official Microsoft statement here: The standard operating model for AD is to allow authenticated users to read the attributes of other AD objects. Changing the operating model to restrict what attributes that can be read by authenticated users, is outside the scope of the normal operating model for Active Directory and could impacts the operation of Active Directory or services that use AD for authenticate or applications that use AD (i.e. Exchange). It could also impact future updates or patches that rely on this functionality. Changes to the standard operating model may also result in issues get support from Microsoft.

    There are two approach to deliver the required restriction:

    1. Add an explicit deny permissions to prevent users from see the attributes of the selected groups
    2. Changing default permissions for existing and new user and group objects

    The simplest approach is to use the explicit deny method on objects that you don't want users to read, and then assign this right to a group that contains users you want to block from reading the attributes of the group. However this approach will require on going maintenance to ensure new users are added to the deny group.

    The more complicated approach, with the higher risk of breaking functionality is change the default permissions, however, this has the highest risk of breaking functionality and will be very hard to remove or reverse once implemented, I don't recommend this approach.

    The recommendation is to use option 1 and assign an explicit deny permission.

    If you do want to continue with changing the access permissions, I would suggest that you test it in a test environment, before implementing any changes in your production environment.

    Deny Permissions Approach

    If you assign an explicit deny permission to the groups, in this case the group is called test-group1, this will prevent the user from reading the group details. in this example the permission is applied to a specific user, but you would assign the permission to a group and then add the users you want to restrict.

    168883-image.png

    With this permission in place the user is not able to see the attributes of the groups

    168807-image.png

    And if the restricted user views the properties of a user that is a member of the group, their membership of the group is not displayed:
    168927-image.png

    Where a user that is not restricted can see the group membership of the restricted group
    168808-image.png

    This is simplest to implement for the specific groups but is also the simplest to remove if it's found to causes issues at a later date. You would need to add this permission to the AdminSDHolder container so the SDprop process will apply it the protected groups, and also directly to the groups that are not protected by the SDProp process. You just need to create a new group that will be used to assign the permission. I would not recommend using any the default groups like domain users or authenticated users as these groups include every user and will result in loss of access to all users.

    You then just need to add an additional step to the user provisioning process to add new users to the deny group. I would also have some sort of schedule task to add missing users back into the restriction group.

    Gary.


5 additional answers

Sort by: Most helpful
  1. Thameur-BOURBITA 32,586 Reputation points
    2022-01-24T13:37:26.497+00:00

    Hi,

    You can launch this command to list all privileged groups with admincount = 1:

    Get-ADGroup -Filter "admincount -eq '1'" | select Name
    Get-ADGroup -Filter "admincount -eq '1'" | select DistinguishedName
    

    Please don't forget to mark helpful reply as answer

    1 person found this answer helpful.

  2. Thameur-BOURBITA 32,586 Reputation points
    2022-01-24T16:23:15.417+00:00

    Hi,

    **But i search for other groups in Bultin not listen, like replicate users or Administrators hyper-v, or backup there havent a value in admincount.

    i think use the SID like here :
    http://support.microsoft.com/kb/243330**

    Regarding the builtin groups you can use the following command:

    Get-ADGroup -filter * -Searchbase "CN=Builtin,DC=domainName,DC=lan" select ExpandProperty SamaccountName
    

    Please don't forget to mark helpful reply as answer


  3. Gary Reynolds 9,391 Reputation points
    2022-01-24T21:17:21.333+00:00

    Hi @mehdi dakhama

    For reference have a look at the SDProp option in NetTools, it provides a full list of the user and groups that are protected by the SDProp process, with the group nesting, showing why a user or group were protected. It will also show any objects that have been orphaned by the process.

    Gary.


  4. Limitless Technology 39,376 Reputation points
    2022-01-25T10:37:54.547+00:00

    Hello Mehdidakhama

    You can use the groups SID as referenced here:

    Privileged Group Membership for the following groups:

    - Enterprise Admins - SID: S-1-5-21root domain-519

    - Schema Admins - SID: S-1-5-21root domain-518

    - Domain Admins - SID: S-1-5-21domain-512

    - Cert Publishers - SID: S-1-5-21domain-517

    - Administrators - SID: S-1-5-32-544

    - Account Operators - SID: S-1-5-32-548

    - Server Operators - SID: S-1-5-32-549

    - Backup Operators - SID: S-1-5-32-551

    - Print Operators - SID: S-1-5-32-550

    Reference: http://support.microsoft.com/kb/243330


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments