1. Resources
  2. Detection rules
  3. Computer Account Turned into a Domain Controller Account

Computer Account Turned into a Domain Controller Account detection rules

Setting the SERVER_TRUST_ACCOUNT flag on a computer account makes Active Directory treat it as a domain controller and move it into Domain Controllers. Outside a real promotion, 4742 with %%2088 marks a rogue DC account.

Platform
Active Directory
Severity
Critical
Log source
Windows System event log (domain controllers), Windows Security event log
Last updated
MITRE ATT&CK technique
T1098Account Manipulation
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Write access to userAccountControl on a computer account, the DS-Install-Replica right on the domain object, and the password or keys of that computer account.
Impact
The account can request the password hashes of every account in the domain through replication, including krbtgt, while reviews of administrative groups show nothing unusual.
Response
Disable the account that gained the flag at once, restore its workstation trust flag and reset its password, and disable or reset the account that set the flag.
Mitigation
Restrict the DS-Install-Replica right on the domain object and write access to userAccountControl on computer objects to Tier 0 administrators.
Event IDs
16990473847414742

How the attack works

What separates a domain controller's account from any other computer account is one bit of userAccountControl: SERVER_TRUST_ACCOUNT (0x2000) instead of WORKSTATION_TRUST_ACCOUNT (0x1000). When the bit is set, Active Directory also changes the account's primaryGroupID to 516, which makes it a member of the Domain Controllers group. The directory replication rights that DCSync needs are normally held by domain controllers, so the account inherits them without being added to any administrative group.

Setting the bit requires write access to the account's userAccountControl and the DS-Install-Replica control access right ("Add/Remove Replica In Domain") on the domain, which normally only administrators hold. An attacker who already has that level of access flips the bit on an ordinary computer account whose password they know and keeps a quiet replication backdoor. The domain controller logs the change in event 4742 (or 4738 if the object is a user, and 4741 if the account is created with the flag) with %%2088 ("'Server Trust Account' - Enabled") in UserAccountControl. A genuine domain controller promotion produces the same event, so the context decides. On domain controllers with the November 2021 updates, a non-administrator who tries to create an account whose object class and account type flags do not match is refused, and the System log records the attempt as Directory-Services-SAM event 16990, which a second rule on this page matches.

What an attacker needs

  • Write access to userAccountControl on a computer account and the DS-Install-Replica control access right on the domain object.
  • The password or keys of that computer account.

Impact

The account can request the password hashes of every account in the domain through replication, including krbtgt, while reviews of Domain Admins and other administrative groups show nothing unusual. The backdoor survives password resets of the real administrators.

Detection rules

SAM Blocked an Account With Mismatched Object Class and Account Type Flags

Detects event 16990 of the source Directory-Services-SAM in the System log of a domain controller. The Security Accounts Manager writes it when it blocks a non-administrator from creating an Active Directory account whose objectClass and userAccountControl account type flags do not match. Since the November 9, 2021 updates for CVE-2021-42278 a computer object must carry the workstation trust or the server trust flag, and a user object the normal account or the interdomain trust flag. For existing objects the check runs when a user without administrator rights for machine accounts changes sAMAccountName or userAccountControl. A refused request of this kind is an attempt to give an account a type it should not have, for example a user object that carries a computer or domain controller account type. The event text holds the account name, its objectClass, the userAccountControl value, the caller address and the caller SID. Microsoft's article gives the event text and does not name the event data fields, so the rule matches the event ID and the provider only. A change made by an administrator is not validated and is covered by the flag rule of this page. Collect the System log of every domain controller.

LevelMediumStatusExperimentalLog sourceWindows System event log (domain controllers)
title: SAM Blocked an Account With Mismatched Object Class and Account Type Flags
id: b842826c-51ba-4c2f-a5fc-dae2e2e5c396
status: experimental
description: >-
  Detects event 16990 of the source Directory-Services-SAM in the System log
  of a domain controller. The Security Accounts Manager writes it when it
  blocks a non-administrator from creating an Active Directory account whose
  objectClass and userAccountControl account type flags do not match. Since
  the November 9, 2021 updates for CVE-2021-42278 a computer object must
  carry the workstation trust or the server trust flag, and a user object the
  normal account or the interdomain trust flag. For existing objects the
  check runs when a user without administrator rights for machine accounts
  changes sAMAccountName or userAccountControl. A refused request of this
  kind is an attempt to give an account a type it should not have, for
  example a user object that carries a computer or domain controller account
  type. The event text holds the account name, its objectClass, the
  userAccountControl value, the caller address and the caller SID.
  Microsoft's article gives the event text and does not name the event data
  fields, so the rule matches the event ID and the provider only. A change
  made by an administrator is not validated and is covered by the flag rule
  of this page. Collect the System log of every domain controller.
references:
  - https://support.microsoft.com/en-us/topic/kb5008102-active-directory-security-accounts-manager-hardening-changes-cve-2021-42278-5975b463-4c95-45e1-831a-d120004e258e
  - https://attack.mitre.org/techniques/T1098/
author: Forestall
date: 2026-11-18
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098
logsource:
  product: windows
  service: system
detection:
  selection:
    Provider_Name|contains: Directory-Services-SAM
    EventID: 16990
  condition: selection
falsepositives:
  - A provisioning tool or script that creates accounts with a userAccountControl value that does not fit the object class. It fails every time on an updated domain controller. Fix the tool, and confirm the caller SID and address in the event before closing the alert.
level: medium

False positives

  • A provisioning tool or script that creates accounts with a userAccountControl value that does not fit the object class. It fails every time on an updated domain controller. Fix the tool, and confirm the caller SID and address in the event before closing the alert.

Server Trust Account Flag Enabled on an Account

Detects a computer or user account created or changed (4741, 4742, 4738) with "'Server Trust Account' - Enabled" (%%2088) in its User Account Control changes. The flag marks the account as a domain controller: Active Directory moves it into the Domain Controllers group (primaryGroupID 516), whose members can replicate directory secrets. Outside a domain controller promotion this is a rogue domain controller account. Requires Audit Computer Account Management and Audit User Account Management.

LevelHighStatusExperimentalLog sourceWindows Security event log
title: Server Trust Account Flag Enabled on an Account
id: fc17d95a-25ec-4709-a646-9804c54c4030
status: experimental
description: >-
  Detects a computer or user account created or changed (4741, 4742, 4738) with
  "'Server Trust Account' - Enabled" (%%2088) in its User Account Control
  changes. The flag marks the account as a domain controller: Active Directory
  moves it into the Domain Controllers group (primaryGroupID 516), whose members
  can replicate directory secrets. Outside a domain controller promotion this is
  a rogue domain controller account. Requires Audit Computer Account Management
  and Audit User Account Management.
references:
  - https://attack.mitre.org/techniques/T1098/
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4742
  - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4738
  - https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/a2ad3e15-b839-49dc-9fa2-ee81b85bdcb1
author: Forestall
date: 2026-11-11
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID:
      - 4738
      - 4741
      - 4742
    UserAccountControl|contains: '%%2088'
  condition: selection
falsepositives:
  - Promotion of a new domain controller, which enables the flag on that server's computer account. Match the event to the change record and confirm that the computer became a domain controller.
level: high

False positives

  • Promotion of a new domain controller, which enables the flag on that server's computer account. Match the event to the change record and confirm that the computer became a domain controller.

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.

Server trust flag set on an account with no domain controller promotion around it

Detection hypothesisSequence of eventsJoins two logs

A real promotion gives the computer a server object and an NTDS Settings (nTDSDSA) object, which represents its directory service, under its site in the Configuration partition. An account that only gains the flag gets no such object. Joining the flag change to the creation of directory service objects for the same host separates a promotion from a backdoor, and a replication request by an account without that object confirms it.

  1. Take event 4742, 4738 or 4741 whose UserAccountControl contains %%2088 (Server Trust Account enabled), and keep TargetSid, TargetUserName and the time.
  2. Look in a window of 24 hours before and after, a starting value, for event 5137 with ObjectClass nTDSDSA or server whose ObjectDN holds CN=<the computer name without $>,CN=Servers under CN=Sites,CN=Configuration.
  3. Report every flag change with no such object in the window.
  4. Raise the priority when event 4662 with the replication rights GUIDs in Properties shows the same account in SubjectUserSid requesting replication.

Events47424738474151374662

LimitsThe 5137 events need a SACL that audits child creation under CN=Sites, otherwise every flag change is reported. A promotion that fails and is rolled back looks the same. A server object named differently from the computer account is missed by the name match, so compare it with the serverReference of the object where you can.

Triage

  • Identify the account (TargetUserName, TargetSid) and who changed it (SubjectUserName, SubjectLogonId), and compare OldUacValue with NewUacValue in the same event.
  • Confirm whether a domain controller promotion was planned. A promoted server ends up in the Domain Controllers OU with an NTDS Settings object under its site; an account that only gained the flag has neither.
  • Look for directory replication requested by the account afterwards (event 4662 with the replication rights) and for its logons (4624, 4768) from unexpected addresses.
  • If not explained, restore the workstation trust flag, reset the account's password and, if replication was requested, treat all domain credentials as exposed.

Response

Once the attack is confirmed:

  1. Disable the account that gained the flag at once, so that it can no longer request replication.
  2. Restore the workstation trust flag on the account, confirm that its primary group is Domain Computers (515) again, and reset its password, which the attacker knows.
  3. Disable or reset the account that set the flag. Setting it takes the DS-Install-Replica right on the domain, so an identity with administrator-level rights is compromised.
  4. If the account requested directory replication while it carried the flag, every credential in the domain is exposed, krbtgt included. Start the recovery described for DCSync.
  5. Sweep the domain for further accounts of this kind right away. One unauthorized domain controller account is a reason to expect a second.

Mitigation

  • Review regularly which computer accounts carry SERVER_TRUST_ACCOUNT or have primaryGroupID 516 and confirm that each one is a real domain controller.
  • Restrict the DS-Install-Replica right on the domain object and write access to userAccountControl on computer objects to Tier 0 administrators.
  • Keep domain controllers on current security updates; the SAM hardening in KB5008102 validates the account-type flags of computer accounts created or changed by non-administrators.
  • Enable "Audit Computer Account Management" and "Audit User Account Management" on all domain controllers.

Frequently asked questions

How do I tell a real domain controller promotion from an unauthorized account?

A promoted server ends up in the Domain Controllers OU and has an NTDS Settings object under its site. An account that only gained the flag has neither. A promotion also has a change record, so match the event to it and confirm that the computer became a domain controller.

Why does the account not show up when administrative groups are reviewed?

It is not a member of Domain Admins or of any other administrative group. When the flag is set, Active Directory changes the primary group of the account to Domain Controllers (516), and the replication rights come with that group. A review of the administrative groups therefore shows nothing unusual.

Do the November 2021 updates prevent this change?

Only for non-administrators. The SAM hardening in KB5008102 validates the account-type flags of computer accounts that non-administrators create or change. An attacker who already has write access to userAccountControl and the DS-Install-Replica right on the domain can still set the flag, which is why the event matters.

Why does resetting administrator passwords not remove this backdoor?

The rights do not come from an administrator account. They come from the flag on a computer account whose password the attacker knows. Until the flag is removed and the password of that account is reset, it can keep requesting the password hashes of the domain through replication.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.