How the attack works
The Security Account Manager remote protocol (SAMRPC) is one of the interfaces a domain controller offers for reading accounts and groups. Microsoft describes the risk in its own words: a low-privileged user can use it to enumerate users, including privileged accounts such as domain administrators, and groups and group memberships from Active Directory, and this information can serve as a starting point for an attacker. On domain controllers the default security descriptor for these calls allows Everyone, to preserve compatibility.
An attacker who has a first account in the domain reads the members of the administrative groups to learn which accounts to go after. Tools that map a domain do the same for every group, one after another. The domain controller records the access when the audit subcategory Audit SAM is enabled: event 4661, a handle to an object was requested, with the object server Security Account Manager, the object type (SAM_GROUP for a group that is not a local group, SAM_ALIAS for a local group) and, as object name, the SID of the group.
The rules on this page read that event for the most privileged groups and count how many different groups one account opens in a short time. They see requests that go through SAM only. The same information can be read over LDAP, which leaves no event 4661, and no public incident report describes this step at the level of the audit event.
What an attacker needs
- Any authenticated account in the domain and a network path to a domain controller.
Impact
The attacker learns which accounts hold administrative rights and which groups lead to them. Nothing is changed in the directory. The value of the event is that it shows the reconnaissance before the first attack on one of those accounts.
Detection rules
One Account Opened Many Groups Through SAM
Counts, per requesting account, the distinct groups for which a domain controller logged event 4661 with the object server Security Account Manager and the object type SAM_GROUP or SAM_ALIAS. The object name holds the SID of the group, so the count is the number of different groups the account opened. One account that opens 30 or more groups within 5 minutes is walking through the groups of the domain, which is what a tool that maps group memberships over the SAM remote protocol does. A person who looks at a few groups stays far below that. The threshold and the window are starting points to tune against your own baseline. Requires Audit SAM on domain controllers, which Microsoft rates as high volume there.
Fires when one SubjectUserName has at least 30 different ObjectName values within 5 minutes.
title: SAM Handle Requested for a Group (Reconnaissance Base Event)
id: 00361b0f-17df-4044-a27b-72717174d5ba
name: sam_handle_requested_for_group
status: experimental
description: >-
Base event of the threshold rule in this file. Event 4661 (a handle to an
object was requested) in which the Security Account Manager opened a group
(object type SAM_GROUP or SAM_ALIAS), requested by an account that is not a
computer account.
logsource:
product: windows
service: security
detection:
selection:
EventID: 4661
ObjectServer: 'Security Account Manager'
ObjectType:
- SAM_GROUP
- SAM_ALIAS
filter_computer_account:
SubjectUserName|endswith: '$'
condition: selection and not filter_computer_account
level: low
---
title: One Account Opened Many Groups Through SAM
id: 1a4a0e61-fdcf-47dd-9b75-0b9dc7d2cb01
status: experimental
description: >-
Counts, per requesting account, the distinct groups for which a domain
controller logged event 4661 with the object server Security Account
Manager and the object type SAM_GROUP or SAM_ALIAS. The object name holds
the SID of the group, so the count is the number of different groups the
account opened. One account that opens 30 or more groups within 5 minutes
is walking through the groups of the domain, which is what a tool that maps
group memberships over the SAM remote protocol does. A person who looks at
a few groups stays far below that. The threshold and the window are
starting points to tune against your own baseline. Requires Audit SAM on
domain controllers, which Microsoft rates as high volume there.
references:
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4661
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/audit-sam
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/network-access-restrict-clients-allowed-to-make-remote-sam-calls
- https://attack.mitre.org/techniques/T1069/002/
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1069.002
correlation:
type: value_count
rules:
- sam_handle_requested_for_group
group-by:
- SubjectUserName
timespan: 5m
condition:
field: ObjectName
gte: 30
falsepositives:
- Identity management, access review and inventory products that read all groups on a schedule. Their runs repeat at the same times from the same account. Exclude those accounts by SubjectUserName once confirmed.
- Administrative scripts that report group memberships for the whole domain.
- The values of 30 groups and 5 minutes are starting points, not tested limits. Measure how many groups an account normally opens and adjust both.
level: medium
False positives
- Identity management, access review and inventory products that read all groups on a schedule. Their runs repeat at the same times from the same account. Exclude those accounts by SubjectUserName once confirmed.
- Administrative scripts that report group memberships for the whole domain.
- The values of 30 groups and 5 minutes are starting points, not tested limits. Measure how many groups an account normally opens and adjust both.
SAM Handle Requested for an Administrative Group
Detects event 4661 (a handle to an object was requested) in which the Security Account Manager opened one of the most privileged groups: Domain Admins (RID 512), Schema Admins (518), Enterprise Admins (519) or the built-in Administrators group (S-1-5-32-544). Microsoft documents that the object type is SAM_GROUP for a group that is not a local group and SAM_ALIAS for a local group, and that the object name holds the SID of the group. A program that lists the members of these groups over the SAM remote protocol produces this event on the domain controller. Requests by computer accounts are excluded, because domain controllers and member servers open these groups themselves. The requester is in SubjectUserName and SubjectLogonId. Reading the same groups over LDAP produces no such event. Requires Audit SAM on domain controllers, which Microsoft rates as high volume there.
title: SAM Handle Requested for an Administrative Group
id: 0ca7364b-8595-4264-ac67-c575ba9c33ba
status: experimental
description: >-
Detects event 4661 (a handle to an object was requested) in which the
Security Account Manager opened one of the most privileged groups: Domain
Admins (RID 512), Schema Admins (518), Enterprise Admins (519) or the
built-in Administrators group (S-1-5-32-544). Microsoft documents that the
object type is SAM_GROUP for a group that is not a local group and SAM_ALIAS
for a local group, and that the object name holds the SID of the group. A
program that lists the members of these groups over the SAM remote protocol
produces this event on the domain controller. Requests by computer accounts
are excluded, because domain controllers and member servers open these
groups themselves. The requester is in SubjectUserName and SubjectLogonId.
Reading the same groups over LDAP produces no such event. Requires Audit SAM
on domain controllers, which Microsoft rates as high volume there.
references:
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4661
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/audit-sam
- https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/network-access-restrict-clients-allowed-to-make-remote-sam-calls
- https://attack.mitre.org/techniques/T1069/002/
author: Forestall, based on work by Samir Bousseaden
date: 2026-11-18
related:
- id: 35ba1d85-724d-42a3-889f-2e2362bcaf23
type: derived
tags:
- attack.discovery
- attack.t1069.002
logsource:
product: windows
service: security
detection:
selection:
EventID: 4661
ObjectServer: 'Security Account Manager'
ObjectType:
- SAM_GROUP
- SAM_ALIAS
ObjectName|endswith:
- '-512'
- '-518'
- '-519'
- '-32-544'
filter_computer_account:
SubjectUserName|endswith: '$'
condition: selection and not filter_computer_account
falsepositives:
- Administrators who list the members of these groups with tools that use the SAM interface, and help desk, identity management or access review products that read them on a schedule. Exclude their accounts by SubjectUserName once confirmed.
- Any member server or workstation that forwards its Security log matches for its own local Administrators group. Scope the rule to domain controllers by Computer.
level: medium
False positives
- Administrators who list the members of these groups with tools that use the SAM interface, and help desk, identity management or access review products that read them on a schedule. Exclude their accounts by SubjectUserName once confirmed.
- Any member server or workstation that forwards its Security log matches for its own local Administrators group. Scope the rule to domain controllers by Computer.
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.
Members of the administrative groups read over LDAP by an account outside your known readers
The same reconnaissance done with an LDAP query opens no SAM handle and leaves no event 4661. An audit entry on the administrative group objects that audits reading their member attribute makes the domain controller log event 4662 for each read, with the reader and the property. Reads by accounts outside the administrators and the products that are known to read these groups are the LDAP form of the same step.
- On the administrative group objects, add an audit entry (SACL) for Everyone that audits successful Read Property on the member attribute, and enable Audit Directory Service Access on the domain controllers.
- Take event 4662 whose
ObjectNameis the object GUID of one of those groups and whosePropertieshold the GUID of the member attribute, bf9679c0-0de6-11d0-a285-00aa003049e2.AccessMask0x10 is Read Property. - Leave out computer accounts and your baseline of known readers: administrators, identity and access review products and monitoring.
- Report every other
SubjectUserName, with the source address of its session from event 4624 with the same logon ID.
Events46624624
LimitsMany applications read group membership, so measure the volume on one group before covering all of them. A reader that learns the members from the memberOf attribute of user objects reads no group object and is not seen. The event shows that the attribute was read, not the query that read it.
Triage
- Read the account that requested the handle (SubjectUserName, SubjectLogonId) and the group (ObjectName holds its SID).
- Find the source of that logon session (event 4624 with the same logon ID) and decide whether that host and account have a reason to read administrative groups, for example a help desk tool or an identity management system.
- Look at what the same account did next from the same source. Requests for service tickets (4769), failed sign-ins for the members of the group (4771, 4625) and directory changes are the usual follow-up.
- Check whether the account opened many other groups or user objects at the same time, which points to a tool that maps the whole domain.
Response
Once the attack is confirmed:
- Treat the account that made the requests as compromised until its owner confirms the activity. Reset its password and end its sessions.
- Isolate the host the requests came from and examine it.
- Watch the members of the groups that were read more closely for the following days, especially for password guessing and ticket requests against them.
- Review what else the account read or changed in the directory during the same session.
Mitigation
- Keep the number of accounts in the administrative groups small and separate from everyday accounts, so that the list an attacker obtains offers few targets.
- Remove Anonymous Logon and Everyone from the Pre-Windows 2000 Compatible Access group and disable anonymous access to domain controllers, so that reading groups at least requires an account.
- Review Microsoft's policy "Network access: Restrict clients allowed to make remote calls to SAM" and test its audit mode. On domain controllers the default allows Everyone, and a restriction has to be tested against the applications that read the directory this way.
- Enable Audit SAM on domain controllers if you can carry the volume, which Microsoft rates as high there, and collect event 4661.
Frequently asked questions
Does a legitimate administrator produce the same event?
Yes. Any program that opens the group through the Security Account Manager produces event 4661, including command line tools administrators use to list group members and products that review privileged access. The account and the host decide. A workstation account that has never administered the domain and opens Domain Admins is worth a look.
Why do the rules not see the same reconnaissance over LDAP?
Event 4661 with the object server Security Account Manager is written for access through the SAM interface. A program that reads the same groups with LDAP queries does not open a SAM handle, so no rule on this page fires. LDAP reconnaissance needs other sources, such as a network sensor on the domain controllers, or an audit entry that logs reads of the member attribute of the administrative groups, which the Detection logic section describes.
What has to be enabled for event 4661 on a domain controller?
Microsoft lists the event under the audit subcategories Audit SAM and Audit Directory Service Access, and its page for the event adds that it is generated only if success auditing is enabled for Audit Handle Manipulation. Microsoft rates the volume of Audit SAM as high on domain controllers and gives no general recommendation for it, so test the volume before enabling it everywhere.
References
- MITRE ATT&CK T1069.002: Permission Groups Discovery: Domain Groups
- Event 4661: A handle to an object was requested
- Audit SAM
- Network access: Restrict clients allowed to make remote calls to SAM
- Defender for Identity security alerts (Anomalous Samr activity)
- Security identifiers (well-known SIDs and RIDs)
- Event 4662: An operation was performed on an object
- Member attribute (System-Id-Guid bf9679c0-0de6-11d0-a285-00aa003049e2)
- Event 4624: An account was successfully logged on