By default, any authenticated user in an Active Directory domain can create up to 10 computer accounts, and attackers use that quiet default to manufacture the machine identities they need for privilege escalation. The setting behind it, ms-DS-MachineAccountQuota, is one of the most common findings in internal penetration tests because it is almost never changed and the fix is a single attribute. The hard part is not the change itself; it is knowing which build processes, help desk habits and scripts quietly rely on users joining their own machines.
This guide explains what the quota and the related user right actually control, why a user-created computer account is useful to an attacker, how to find out who depends on the default, and how to set the quota to zero through normal change control. It complements the Kerberos Delegation Security Guide, which covers the delegation attacks that a spare computer account enables, and the Domain Join Accounts guide, which covers the accounts that should do joins instead.
Key takeaways
- The default is 10. Microsoft documents that authenticated users can join 10 machine accounts to the domain by default, controlled by
ms-DS-MachineAccountQuotaon the domain object. - Two controls work together. The quota limits joins made through the "Add workstations to domain" user right, which is granted to Authenticated Users on domain controllers by default.
- A computer account is a credential. Every computer account is a non-human identity with a password the creator chooses, which an attacker can use to authenticate to Kerberos and to set up resource-based constrained delegation.
- The fix is small. Set the quota to 0 and limit the user right to the groups that really join machines, then delegate "create computer objects" on specific OUs to dedicated join accounts.
- Patching is not a substitute. The November 2021 updates for CVE-2021-42278 and CVE-2021-42287 closed the noPac chain, but the quota still hands out identities to anyone with a domain password.
- Measure before you change. The
ms-DS-CreatorSIDattribute and computer account creation events tell you who uses the default today.
What MachineAccountQuota controls
The Active Directory schema documents ms-DS-MachineAccountQuota as "the number of computer accounts that a user is allowed to create in a domain". It is a single-valued attribute on the domain object (the Sam-Domain class), and the schema lists its update privilege as domain administrator.
Microsoft's support article on the default limit to the number of workstations a user can join sets out the behaviour:
- By default, authenticated users can join 10 machine accounts to the domain. Microsoft describes the default as existing to prevent misuse.
- Members of the Administrators or Domain Administrators groups are not restricted by the quota.
- Users with delegated permissions on Active Directory containers to create and delete computer accounts are not restricted either.
- To count how many machines a user has created, check the
ms-DS-CreatorSIDattribute on computer accounts.
In other words, the quota is a per-user allowance for people who have no other right to create computer objects. Setting it to 0 removes that allowance without affecting administrators or properly delegated join accounts.
The "Add workstations to domain" user right
The quota works together with a user right assignment. Microsoft's reference for Add workstations to domain (constant SeMachineAccountPrivilege) records the following. Note that this reference is archived, so confirm behaviour against your current Windows Server documentation.
- The right determines which users can add a device to a domain, and it must be assigned to at least one domain controller to take effect.
- The default on domain controllers is Authenticated Users.
- A user who holds this right can add up to 10 workstations. The limit applies only to joins made through the right.
- Users with the Create Computer Objects permission on an OU or the Computers container can add an unlimited number of devices, whether or not they hold the right.
- Computer accounts created through the right are owned by Domain Administrators. Accounts created through container permissions are owned by the creator.
- Microsoft rates the exposure as a moderate vulnerability: a user could join a device they control, such as one where they are local administrator, and then add a personal domain account to its local Administrators group.
- The recommended countermeasure is to let only authorised IT team members add computers to the domain. Existing computers are not affected unless they are removed and re-joined.
| Control | Where it lives | Default | Recommended setting |
|---|---|---|---|
ms-DS-MachineAccountQuota | Domain object attribute | 10 per user | 0 |
Add workstations to domain (SeMachineAccountPrivilege) | User rights assignment in a GPO linked to domain controllers | Authenticated Users on domain controllers | Only the groups that join machines, or nobody if all joins use delegated OU rights |
| Create Computer Objects permission | ACL on specific OUs or the Computers container | Not delegated | Delegated on target OUs to dedicated join accounts or groups |
Why a spare computer account matters to an attacker
A computer account is a full security principal. When a user creates one through the quota, they choose its password, so they hold working credentials for a new non-human identity that the domain trusts as a machine. That identity can request Kerberos tickets and has a service principal name, which is exactly what several well-known escalation paths need. MITRE ATT&CK tracks the creation of such accounts as T1136.002 Create Account: Domain Account and their use as T1078 Valid Accounts.
Resource-based constrained delegation
Resource-based constrained delegation (RBCD) lets a computer object decide which other accounts may delegate to it. If an attacker can write that setting on a target computer, through a weak ACL or a relayed authentication, they also need an account with a service principal name to act as the delegating service. A user-created computer account is the easiest way to get one. With the quota at 0, the attacker must first compromise an existing machine or service account, which is a much higher bar. The Kerberos Delegation Security Guide covers RBCD controls in depth, and the Active Directory ACL and Delegation Hygiene Guide covers the write permissions that make it possible.
The noPac chain (CVE-2021-42278 and CVE-2021-42287)
In November 2021 Microsoft patched two related flaws that, combined, allowed a standard user to impersonate a domain controller. Both depended on the user being able to create or rename a computer account.
- CVE-2021-42278. KB5008102 describes a security bypass that allowed domain controller impersonation through computer account sAMAccountName spoofing. The hardening validates that computer accounts carry the right account type flags and that a workstation trust account's sAMAccountName ends with a single dollar sign. Name failures return error 0x523 and other failures return access denied.
- CVE-2021-42287. KB5008380 describes a Kerberos PAC bypass in which a compromised domain account could cause the KDC to issue a service ticket with higher privileges than the account holds. The fix adds the original requestor to the PAC and has the KDC check that the requesting account matches. Enforcement mode became required from 11 October 2022 (updated 31 January 2023), after which the
PacRequestorEnforcementregistry value is no longer read.
A fully patched domain is no longer exposed to that chain, but the pattern is the lesson: when a new Active Directory flaw needs "any machine account", a quota of 10 means every user already has one available.
Rogue devices
Even without an exploit, a user who joins their own device gets a domain-trusted machine where they are local administrator, as Microsoft's user right reference notes. That device receives Group Policy and can reach domain resources as a member computer, outside your build and endpoint controls.
Finding out who depends on the default
Before setting the quota to 0, find out whether anything legitimate still relies on it. NHI Mgmt Group recommends three checks.
1. Read the current value
Read ms-DS-MachineAccountQuota on the domain object in every domain in the forest. A value of 10 means the default has never been changed. Any other non-zero value suggests someone changed it deliberately, so find the change record.
2. Count quota-created computer accounts
Computer accounts created through the quota carry the creator's SID in ms-DS-CreatorSID. Query all computer objects where that attribute is populated and group them by creator. Typical results:
- Help desk or desktop staff who join machines with their own accounts because no delegated join account exists.
- Imaging or provisioning service accounts that were never given OU-level rights and have been relying on the quota (and will stop at 10 per account unless they are also exempt in another way).
- Developers or lab users who joined test machines.
- Unexplained creators, including accounts that created computer objects with names that do not match your naming standard. Treat these as a potential incident and investigate.
3. Review creation events
KB5008102 notes that successful computer account creation, change and deletion are audited through events 4741, 4742 and 4743, and that domain controllers log events 16990 and 16991 in the System log when a non-administrator tries to create an account with mismatched flags or an invalid sAMAccountName. Collect 4741 events for at least one build cycle and compare the subject accounts with your list of approved join identities. The Active Directory Security Monitoring and Event IDs Guide covers forwarding these events.
Setting the quota to zero through change control
The change is technically simple. Microsoft's support article describes editing the attribute with ADSI Edit as a domain administrator: open the domain naming context, open the properties of the domain object, select ms-DS-MachineAccountQuota and set the number. Microsoft warns that incorrect use of ADSI Edit can cause serious problems, so many teams prefer a scripted change that is reviewed and logged. The surrounding process is what makes it safe.
- Create the replacement path first. Delegate Create Computer Objects (and the minimum write rights needed for joins) on the target OUs to a dedicated group or join account. Follow the Domain Join Accounts guide for scoping and protecting that account's secret.
- Move the workflows. Point imaging, provisioning and help desk procedures at the delegated join path. Test a join end to end in each target OU.
- Raise the change. Record the current value, the new value of 0, the business owner, the rollback (restore the previous value) and the list of consumers you contacted.
- Set the quota to 0. Apply it in each domain, starting with a lower-risk domain where you have one.
- Restrict the user right. In the GPO linked to domain controllers, replace Authenticated Users in "Add workstations to domain" with the groups that genuinely need it. Microsoft notes no restart is required for user right changes.
- Watch for breakage. For the first weeks, watch for failed joins and help desk tickets, and keep alerting on 4741 events from accounts outside the approved join group.
- Clean up. Review the computer accounts found through
ms-DS-CreatorSID. Disable or delete stale ones, and move legitimate ones into managed OUs with an owner.
Change control questions
- Which teams and service accounts have created computer objects through the quota in the last 90 days?
- Does every one of them now have a delegated, OU-scoped join path that has been tested?
- Is the quota set to 0 in every domain in the forest, not only the root domain?
- Who holds "Add workstations to domain" after the change, and is it documented?
- Is there an alert for computer account creation by anyone outside the approved join group?
- Do third-party tools or appliances that join the domain use a delegated account rather than the quota?
- What is the rollback, and who can approve it?
Detection and ongoing assurance
- Configuration drift. Check the quota value regularly, for example as part of an Active Directory posture scan, and alert if it moves away from 0.
- Unexpected creators. Alert on event 4741 where the subject is not in the approved join group or is a standard user account.
- Naming anomalies. Alert on computer names that break your naming standard, and on events 16990 and 16991 from domain controllers.
- Delegation changes. Monitor writes to the RBCD attribute on computer objects, especially where the delegating principal is a recently created computer account.
- Ownership review. Periodically list computer objects owned by individual users rather than by Domain Administrators or join accounts. Ownership by a standard user is a sign of an old join that may carry leftover rights.
Map these to NIST SP 800-53 Rev. 5 AC-2 Account Management (who may create accounts), AC-6 Least Privilege (removing a default right from all users) and CM-3 Configuration Change Control (the change and its rollback). The Active Directory Security Checklist places this control alongside other default hardening steps.
Common failure patterns
- Only fixing the root domain. The quota is per domain. Child domains keep the default of 10 unless changed.
- Setting the quota to 0 without a delegated join path. Help desk staff then ask for Domain Admin rights to keep joining machines, which is worse than the original exposure.
- Granting Create Computer Objects on the whole domain. This removes the quota limit entirely for the delegated group. Scope delegation to specific OUs.
- Leaving the user right untouched. The quota at 0 does the main job, but leaving Authenticated Users in "Add workstations to domain" invites someone to raise the quota again later to fix a ticket.
- Treating patches as the fix. Patching KB5008102 and KB5008380 closed one chain. It did not stop users from creating identities for the next one.
- Never reviewing existing quota-created accounts. Computer accounts created years ago by users can still hold passwords those users know.
- No owner for join accounts. Delegated join accounts are non-human identities too. Without an owner, rotation and scope reviews do not happen.
Practitioner checklist
- Read
ms-DS-MachineAccountQuotain every domain in the forest. - List computer objects with
ms-DS-CreatorSIDpopulated and group them by creator. - Collect event 4741 for at least one build cycle and compare against approved join identities.
- Delegate Create Computer Objects on specific OUs to a dedicated, owned join account or group.
- Move imaging, provisioning and help desk procedures to the delegated join path and test them.
- Set
ms-DS-MachineAccountQuotato 0 in every domain under a recorded change. - Remove Authenticated Users from "Add workstations to domain" on domain controllers.
- Confirm all domain controllers carry the KB5008102 and KB5008380 protections.
- Alert on quota drift, unexpected 4741 creators, events 16990 and 16991, and RBCD attribute changes.
- Review and clean up stale user-created computer accounts.
Standards and references
- Microsoft Learn: ms-DS-MachineAccountQuota attribute
- Microsoft Learn: Default limit to number of workstations a user can join to the domain
- Microsoft Learn: Add workstations to domain (archived)
- Microsoft Support: KB5008102 SAM hardening changes (CVE-2021-42278)
- Microsoft Support: KB5008380 Authentication updates (CVE-2021-42287)
- MITRE ATT&CK: T1078 Valid Accounts
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Kerberos Delegation Security Guide · Domain Join Accounts · Active Directory ACL and Delegation Hygiene Guide · Active Directory Security Checklist