Allow 'Workstation-Admins' to Join and Remove computers from the Domain
Setting the ms-DS-MachineAccountQuota to 0 removes the default ability for authenticated users (i.e., any domain user) to add computers to the domain, which is essential for minimizing security risks. By default, this attribute allows any authenticated user to add up to 10 computers, which can potentially expose the domain to attacks involving unauthorized device additions
Restricting Computer Account Creation in Active Directory
By default, Active Directory allows any authenticated user to add up to 10 computers to the domain. This setting, controlled by the ms-DS-MachineAccountQuota attribute, can be exploited in various attack scenarios. Setting this value to 0 enhances security by restricting computer account creation to only those with specific delegated permissions, such as members of the Workstation-Admins group.
Steps to Set ms-DS-MachineAccountQuota to 0
- Open Active Directory Users and Computers (ADUC).
- Right-click on your domain name (e.g.,
mad.caponato.es) and select Properties. - Go to the Attribute Editor tab.(If the Attribute Editor tab is not visible, ensure that Advanced Features is enabled under the View menu.)
- In the Attribute Editor tab, locate and double-click on the attribute ms-DS-MachineAccountQuota.
- Set the value to 0 to disable the default quota, thereby preventing any authenticated user from adding computers to the domain.
- Click OK and then Apply to save the changes.
By setting ms-DS-MachineAccountQuota to 0, only users or groups with explicit permissions (like Workstation-Admins) can add or remove computers from the domain. This change restricts domain access and minimizes risks of unauthorized device additions, which are commonly exploited in various attack vectors.
Creating the Workstation-Admins Group in Active Directory
Follow these steps to create the Workstation-Admins group in Active Directory.
- Open Active Directory Users and Computers (ADUC):
- Press Win + R, type
dsa.msc, and press Enter to open ADUC.
- Navigate to the Organizational Unit (OU) or location where you want to create the group.
- Right-click the OU, select New, and then select Group.
- In the New Object - Group window:
- Enter
Workstation-Adminsas the group name. - Ensure the Group Scope is set to
Global. - Set the Group Type to
Security.
- Click OK to create the group.
- Add users needed to manage computer joins
The Workstation-Admins group is now available. You can add users to this group as needed to delegate permissions for adding and removing computers in the domain.
Delegating Domain-Level Permissions to Workstation-Admins in Active Directory
Warning : this procedure grants permissions at the domain level, if you require on a OU, then a custom delagation must be granted. This is not covered in this tutorial.
To enable the Workstation-Admins group to add and remove computers at the domain level, follow these steps:
- Open Active Directory Users and Computers (ADUC):
- Press Win + R, type
dsa.msc, and press Enter to launch ADUC.
- Right-click on your domain name (e.g.,
mad.caponato.es) and select Delegate Control. - In the Delegation of Control Wizard:
- Click Next on the welcome screen.
- Click Add… to add the Workstation-Admins group, then click Next.
- On the Tasks to Delegate page:
- Select Delegate the following common tasks.
- Select Join a Computer to the domain.
- Click next and Finish
This grants the “Join (create)” permission only. Let's also grant “Delete” permission.
- Open Active Directory Users and Computers (ADUC) if not already open:
- Press Win + R, type
dsa.msc, and press Enter to launch ADUC.
- Right-click on your domain name (e.g.,
mad.caponato.es) and select Security - Click on Advanced
- Locate the entry for Workstation-Admins and click Edit
- In the permissions list, “Create Computer Objects” is selected, select also “Delete Computer Objects”
- Click OK, then again OK, and then OK one more time.
The Workstation-Admins group now has the necessary permissions to add and remove computer accounts at the domain level.
Caponato's Samba notebook. Start here or else Main menu
