How the attack works
The domain's ms-DS-MachineAccountQuota attribute (10 by default) lets every authenticated user create computer accounts through the "Add workstations to domain" right, without any delegated permission. The creator chooses the new account's password, so the attacker ends up with a domain identity, able to hold service principal names, that they fully control.
That identity is the starting point for resource-based constrained delegation abuse, sAMAccountName spoofing (noPac) and several NTLM relay and AD CS attacks. Every creation is logged on the domain controller in event 4741 with the creating account in SubjectUserName. Accounts created through the quota also carry the creator's SID in ms-DS-CreatorSID, which separates them from accounts created by administrators or delegated groups. Where the quota was set to 0, raising it again re-opens this path. Two rules on this page watch for that change: event 4739 with a new Machine Account Quota value, and event 5136 on the ms-DS-MachineAccountQuota attribute of the domain object.
What an attacker needs
- Any domain user account, while ms-DS-MachineAccountQuota is above zero and the user still has quota left.
- Or delegated "Create Computer objects" rights on an OU.
Impact
The account is a foothold rather than privilege by itself, but it supplies the controlled computer identity that RBCD, noPac and relay chains need to reach local administrator on servers or domain compromise.
Detection rules
Computer Account Created by Another Computer Account
Detects the creation of a computer account (4741) by an account whose name ends in $, which the user-account rule of this attack leaves out. A computer account can use ms-DS-MachineAccountQuota like any user, so a computer account the attacker controls, or a computer's authentication relayed to the directory, can create the new identity that RBCD and relay chains need. Failover clusters do this on purpose: the cluster name object creates a virtual computer object for each clustered role with a client access point. Requires Audit Computer Account Management.
title: Computer Account Created by Another Computer Account
id: 02ed0edd-3749-4683-8588-478203d6afb5
status: experimental
description: >-
Detects the creation of a computer account (4741) by an account whose name
ends in $, which the user-account rule of this attack leaves out. A computer
account can use ms-DS-MachineAccountQuota like any user, so a computer
account the attacker controls, or a computer's authentication relayed to the
directory, can create the new identity that RBCD and relay chains need.
Failover clusters do this on purpose: the cluster name object creates a
virtual computer object for each clustered role with a client access point.
Requires Audit Computer Account Management.
references:
- https://attack.mitre.org/techniques/T1136/002/
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4741
- https://learn.microsoft.com/en-us/windows-server/failover-clustering/prestage-cluster-adds
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/default-workstation-numbers-join-domain
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.t1136.002
logsource:
product: windows
service: security
detection:
selection:
EventID: 4741
SubjectUserName|endswith: '$'
condition: selection
falsepositives:
- Cluster name objects of failover clusters creating virtual computer objects for new clustered roles. Exclude the cluster name objects by exact SubjectUserName; a creation by any other computer account is worth a review.
level: low
False positives
- Cluster name objects of failover clusters creating virtual computer objects for new clustered roles. Exclude the cluster name objects by exact SubjectUserName; a creation by any other computer account is worth a review.
Computer Account Created by a User Account
Detects the creation of a computer account (4741) by an account that is not itself a computer account. Every user can create computer accounts while ms-DS-MachineAccountQuota is above zero, and attackers create them as a controlled identity for RBCD, noPac and relay attacks. The rule is a baseline: tune it to the accounts that are allowed to join or pre-stage computers. Requires Audit Computer Account Management. Creations performed by a computer account (a name ending in $) are excluded by the filter and are not detected.
title: Computer Account Created by a User Account
id: 6b8f9353-dca4-409c-89f9-86e98f9e796d
status: experimental
description: >-
Detects the creation of a computer account (4741) by an account that is not
itself a computer account. Every user can create computer accounts while
ms-DS-MachineAccountQuota is above zero, and attackers create them as a
controlled identity for RBCD, noPac and relay attacks. The rule is a baseline:
tune it to the accounts that are allowed to join or pre-stage computers.
Requires Audit Computer Account Management. Creations performed by a computer
account (a name ending in $) are excluded by the filter and are not detected.
references:
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4741
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/default-workstation-numbers-join-domain
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.t1136.002
logsource:
product: windows
service: security
detection:
selection:
EventID: 4741
filter_created_by_computer:
SubjectUserName|endswith: '$'
condition: selection and not filter_created_by_computer
falsepositives:
- Domain joins and pre-staging by helpdesk, provisioning or deployment accounts (imaging and device management systems). Exclude those accounts by SubjectUserName once they are documented; where ms-DS-MachineAccountQuota is 0 the remaining events are high signal.
- Virtual computer objects created by failover clusters are created by the cluster's computer account and are excluded by the filter.
level: low
False positives
- Domain joins and pre-staging by helpdesk, provisioning or deployment accounts (imaging and device management systems). Exclude those accounts by SubjectUserName once they are documented; where ms-DS-MachineAccountQuota is 0 the remaining events are high signal.
- Virtual computer objects created by failover clusters are created by the cluster's computer account and are excluded by the filter.
Machine Account Quota Attribute Written on the Domain Object
Detects a value written to ms-DS-MachineAccountQuota (event 5136, Value Added), the attribute of the domain object that sets how many computer accounts a user may create in the domain. It is the directory change behind event 4739 and adds what that event lacks. The new value is in AttributeValue, and the event that carries the old value (Value Deleted) has the same OpCorrelationID, so the two together show whether the quota was raised. Raising it from 0 re-opens computer account creation for every user. The rule does not test the value, so the hardening change to 0 matches as well and is told apart in triage. Requires Audit Directory Service Changes and a SACL on the domain object that audits writes to the attribute.
title: Machine Account Quota Attribute Written on the Domain Object
id: f1111f84-a0e4-4279-ad38-f645d85882d6
status: experimental
description: >-
Detects a value written to ms-DS-MachineAccountQuota (event 5136, Value
Added), the attribute of the domain object that sets how many computer
accounts a user may create in the domain. It is the directory change behind
event 4739 and adds what that event lacks. The new value is in
AttributeValue, and the event that carries the old value (Value Deleted)
has the same OpCorrelationID, so the two together show whether the quota
was raised. Raising it from 0 re-opens computer account creation for every
user. The rule does not test the value, so the hardening change to 0
matches as well and is told apart in triage. Requires Audit Directory
Service Changes and a SACL on the domain object that audits writes to the
attribute.
references:
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-5136
- https://learn.microsoft.com/en-us/windows/win32/adschema/a-ms-ds-machineaccountquota
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/default-workstation-numbers-join-domain
- https://attack.mitre.org/techniques/T1136/002/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.t1136.002
logsource:
product: windows
service: security
detection:
selection:
EventID: 5136
AttributeLDAPDisplayName: ms-DS-MachineAccountQuota
OperationType:
- '%%14674'
- 'Value Added'
condition: selection
falsepositives:
- The hardening change that sets the quota to 0, and a planned temporary increase for a migration. Read the new value in AttributeValue and match the event to the change record.
level: medium
False positives
- The hardening change that sets the quota to 0, and a planned temporary increase for a migration. Read the new value in AttributeValue and match the event to the change record.
Machine Account Quota Changed to a Value Above Zero
Detects event 4739 (domain policy was changed) in which the Machine Account Quota field holds a number other than zero. The event is written when the ms-DS-MachineAccountQuota attribute of the domain is modified, and fields that did not change hold a dash, so a number in this field is the new quota. A domain hardened to a quota of 0 no longer lets ordinary users create computer accounts. Setting the quota back to a positive value re-opens that path, which several attack chains start from, and it is a change an attacker with rights on the domain object makes shortly before creating a computer account. The event does not hold the old value, so a change from one positive value to another matches as well. Requires Audit Authentication Policy Change. The event needs no SACL.
title: Machine Account Quota Changed to a Value Above Zero
id: 971528d0-f21d-4eef-afe4-76001f7807d8
status: experimental
description: >-
Detects event 4739 (domain policy was changed) in which the Machine Account
Quota field holds a number other than zero. The event is written when the
ms-DS-MachineAccountQuota attribute of the domain is modified, and fields
that did not change hold a dash, so a number in this field is the new
quota. A domain hardened to a quota of 0 no longer lets ordinary users
create computer accounts. Setting the quota back to a positive value
re-opens that path, which several attack chains start from, and it is a
change an attacker with rights on the domain object makes shortly before
creating a computer account. The event does not hold the old value, so a
change from one positive value to another matches as well. Requires Audit
Authentication Policy Change. The event needs no SACL.
references:
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4739
- https://learn.microsoft.com/en-us/windows/win32/adschema/a-ms-ds-machineaccountquota
- https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/default-workstation-numbers-join-domain
- https://attack.mitre.org/techniques/T1136/002/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.t1136.002
logsource:
product: windows
service: security
detection:
selection:
EventID: 4739
MachineAccountQuota|re: '^[1-9][0-9]*$'
condition: selection
falsepositives:
- A planned change of the quota, for example a temporary increase for a migration. It should have a change record and be reverted afterwards. A change to 0 is the hardening step and does not match.
level: medium
False positives
- A planned change of the quota, for example a temporary increase for a migration. It should have a change record and be reverted afterwards. A change to 0 is the hardening step and does not match.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Machine account quota raised and a computer account created by a user soon after
Where the quota is 0, an attacker who can write to the domain object raises it only to create the computer account an attack chain needs, and may set it back afterwards. A quota change that is followed by a computer account created by an account that does not provision computers ties the two together.
- The quota is changed to a value above zero: event 4739 with a number other than 0 in
MachineAccountQuota, or event 5136 withAttributeLDAPDisplayNamems-DS-MachineAccountQuota andOperationTypeValue Added. Keep the time andSubjectUserName. - Within 24 hours a computer account is created: event 4741 whose
SubjectUserNameis not a computer account and not one of your provisioning accounts. - Check whether the quota is set back to 0 afterwards, which shows as the same events with the value 0, and what the new computer account does next.
Events473951364741
LimitsA planned migration raises the quota and joins many computers, with a change record. The 24 hours are a starting point. An attacker who already controls a computer account does not need the quota and leaves no such sequence.
Triage
- Check whether SubjectUserName is an approved provisioning, helpdesk or deployment account.
- Read ms-DS-CreatorSID on the new computer object; a populated value means it was created through the user's quota rather than by a delegated administrator.
- Look for follow-up activity on the new account, such as a sAMAccountName rename (4781), writes of msDS-AllowedToActOnBehalfOfOtherIdentity on other computers (5136) and S4U service ticket requests (4769).
- If the creation is not explained, disable the computer account and investigate the creator.
Response
Once the attack is confirmed:
- Disable the computer account that was created and reset the password of the user who created it. That user's credentials were in the attacker's hands, and the attacker chose the password of the computer account.
- Search for other computer accounts whose ms-DS-CreatorSID is the SID of that user and disable those nobody owns.
- Undo what the account was used for. Remove it from msDS-AllowedToActOnBehalfOfOtherIdentity on other computers, revert a changed sAMAccountName, and revoke certificates that were issued to it.
- Treat every host the account obtained service tickets to as compromised and investigate it.
- Delete the unauthorized computer accounts once the evidence is preserved, and confirm that no new creations by that user follow.
Mitigation
- Set ms-DS-MachineAccountQuota to 0 on each domain.
- Delegate computer creation (Create Computer objects on specific OUs, or pre-staging) to a dedicated provisioning group.
- Remove Authenticated Users from "Add workstations to domain" in the Default Domain Controllers Policy if quota-based joins are not used.
- Review computer accounts with a populated ms-DS-CreatorSID regularly and remove the ones nobody owns.
Frequently asked questions
Why is this rule only rated low although it feeds serious attacks?
Creating a computer account is routine. Helpdesk, deployment and provisioning accounts do it every day, and the new account is a foothold, not privilege by itself. The rule is a baseline to tune to the accounts that are allowed to join or pre-stage computers. Where ms-DS-MachineAccountQuota is 0, the events that remain are high signal.
How can I tell that a computer account was created through a user's quota?
Read ms-DS-CreatorSID on the new computer object. Accounts created through ms-DS-MachineAccountQuota carry the SID of their creator there, which separates them from accounts created by administrators or delegated groups. Event 4741 shows the creating account in SubjectUserName.
Does setting ms-DS-MachineAccountQuota to 0 make this detection unnecessary?
No. Accounts with delegated Create Computer objects rights on an OU can still create computer accounts, and a compromised provisioning account is such an account. With the quota at 0 the rule produces far fewer events, and each one from outside the approved provisioning accounts is worth a review.
Which computer account creations does the rule miss?
Creations performed by a computer account, whose name ends in $, are excluded by the filter. That keeps out the virtual computer objects that failover clusters create. It also means that a creation made with a compromised computer account is not reported by this rule. A separate low-level rule on this page reports those creations; exclude your cluster name objects there.
References
- MITRE ATT&CK T1136.002: Create Account: Domain Account
- Event 4741: A computer account was created
- Event 4739: Domain Policy was changed
- Event 5136: A directory service object was modified
- Default limit to number of workstations a user can join to the domain
- Active Directory domain join permissions
- MS-DS-Machine-Account-Quota attribute
- Prestage cluster computer objects: the cluster name object creates virtual computer objects