在 Active Directory 侦察演变为入侵之前将其检测出来。
QuietPhase 是一款 PowerShell 工具,用于检查你的域是否已配置为检测组枚举——即攻击者梳理谁拥有特权访问权限的静默侦察阶段。它会验证域控制器的审核策略,报告哪些特权组和自定义组已启用成员读取审核,并提出修复建议(如果你选择,也可以直接应用这些修复)。
大多数组织会在有人更改特权组时发出告警。很少有组织会注意到有人读取特权组。QuietPhase 帮助弥合这一差距,并让你可以轻松设置蜜罐组,将枚举行为转化为高置信度告警。
背景阅读: The Quiet Phase: Why Active Directory Group Enumeration Deserves Your Attention
adminCount=1)会被 SDProp 重置,因此也会检查并修复 AdminSDHolder。Out-ConsoleGridView)。可用于蜜罐组或任何你想监视的对象。-Apply 时才会进行更改,且每项更改都会要求确认。支持 -WhatIf。-FixScriptPath 将所有建议的更改写入可审查的 .ps1 文件,适合变更控制流程。域控制器仅在以下两个条件同时满足时才会记录组枚举事件:
member 属性的 Success 读取。当两者均为真时,每次成员读取都会在响应查询的域控制器上生成 事件 4662。关键字段:
| 字段 | 值 | 含义 |
|---|---|---|
ObjectName | %{<objectGUID of the group>} | 被读取的组 |
Properties | {bf9679c0-0de6-11d0-a285-00aa003049e2} | member 属性 |
Properties | {bc0ac240-79a9-11d0-9020-00c04fc2d4cf} | 成员属性集(通常同时出现) |
AccessMask | 0x10 | Read Property |
SubjectUserName / SubjectUserSid | 账户 | 执行读取的账户 |
SubjectLogonId | 例如 0x3A7F21 | 与事件 4624(TargetLogonId)关联以获取源 IP 和工作站 |
注意: 基于 SAMR 的工具(如
net group /domain)不会触发此 4662 信号。请通过进程创建日志(事件 4688 / Sysmon / EDR)或网络检测(如 Microsoft Defender for Identity)覆盖该路径。
Out-ConsoleGridView,它是 Microsoft.PowerShell.ConsoleHost 模块的一部分,而该模块是 Microsoft.PowerShell.ConsoleGuiTools 的依赖项。安装在 CurrentUser 作用域中。# Report only (default): check the discovered DC, privileged groups, then pick custom groups
.\QuietPhase.ps1
# Check audit policy on every DC in the domain
.\QuietPhase.ps1 -AllDomainControllers
# Export proposed fixes for review or change approval
.\QuietPhase.ps1 -AllDomainControllers -FixScriptPath .\QuietPhase-Fix.ps1
# Preview changes, then apply them (each change is confirmed)
.\QuietPhase.ps1 -Apply -WhatIf
.\QuietPhase.ps1 -Apply
# Propose rules for Authenticated Users instead of Everyone
.\QuietPhase.ps1 -Apply -AuditPrincipal AuthenticatedUsers
| 参数 | 默认值 | 描述 |
|---|---|---|
-Server | 发现的 DC | 要作为目标的 DC 或域 |
-AllDomainControllers | 关闭 | 检查每个 DC 上的审核策略,而不仅仅是目标 DC |
-AuditPrincipal | Everyone | 用于建议规则的主体:Everyone 或 AuthenticatedUsers。检查时任一均视为已配置。 |
-Apply | 关闭 | 应用建议的更改,每项更改都会弹出确认提示 |
-SkipCustomGroups | 关闭 | 跳过阶段 3(自定义组选择) |
-FixScriptPath | 无 | 将所有建议的修复导出到 .ps1 文件 |
-WhatIf / -Confirm | 标准 | 与 -Apply 一起使用时预览更改或控制提示 |
auditpol 命令,然后停止。在此项就位之前,组 SACL 毫无用处。当有任何内容需要更改时,运行结束时会出现一个 NEXT STEPS 块,其中包含可直接粘贴的 -Apply、-WhatIf、-FixScriptPath 或手动 ADUC 步骤命令。
==============================================================================
PHASE 1 - Domain controller audit policy
==============================================================================
Domain: contoso.com Target DC: DC01.contoso.com DCs checked: 1
DC01.contoso.com
Audit Directory Service Access: Success
Audit Security Group Management: Success
Force audit policy subcategory settings: enabled (or default)
PHASE 1 PASSED: Directory Service Access auditing is enabled.
==============================================================================
PHASE 2 - Well-known privileged groups
==============================================================================
Group Status Protected Detail
----- ------ --------- ------
Domain Admins NeedsChange Yes No audit rule for reads of 'member' (2 other audit rule(s))
Enterprise Admins NeedsChange Yes No audit rule for reads of 'member' (2 other audit rule(s))
Schema Admins Configured Yes Everyone: Success ReadProperty on member (direct)
Administrators (Builtin) NeedsChange Yes No audit rule for reads of 'member' (1 other audit rule(s))
DnsAdmins NeedsChange No No audit rule for reads of 'member' (0 other audit rule(s))
AdminSDHolder (DC=contoso,DC=com) NeedsChange (template) No audit rule for reads of 'member' (2 other audit rule(s))
REMEDIATION - well-known privileged groups
5 object(s) need an audit rule: Everyone | Success | Read member
- Domain Admins
- Enterprise Admins
- Administrators (Builtin)
- DnsAdmins
- AdminSDHolder (DC=contoso,DC=com)
(AdminSDHolder is included because SDProp resets protected groups from it about every 60 minutes.)
Options for resolving these are listed under NEXT STEPS at the end of the run.
==============================================================================
SUMMARY
==============================================================================
Configured 1
NeedsChange 5
Unknown 0
NEXT STEPS
5 object(s) still need an enumeration audit rule. Choose one of these options:
1. Apply the changes with this script (you confirm each change):
.\QuietPhase.ps1 -Apply -WhatIf # preview only, no changes
.\QuietPhase.ps1 -Apply
2. Export a fix script to review, edit, or attach to a change request, then run it elevated:
.\QuietPhase.ps1 -FixScriptPath '.\QuietPhase-Fix.ps1'
3. Fix manually in ADUC (View > Advanced Features) or ADSI Edit:
Group > Properties > Security > Advanced > Auditing > Add: Everyone, Success, This object only, 'Read member'
(输出已省略。在控制台中,已配置的组显示为绿色,需要更改的组显示为黄色。)
“Cannot read SACL: A required privilege is not held by the client”(或类似的访问错误) 读取 SACL 需要在 DC 上拥有 Manage auditing and security log(SeSecurityPrivilege)权限。请以 Domain Admin 身份从提升的会话中运行。林根组(Enterprise Admins、Schema Admins、Enterprise Key Admins)需要 Enterprise Admin 权限。
“auditpol.exe failed ... (elevation required)”
本地 auditpol 查询需要提升的会话。对于远程 DC,请确认你是该 DC 上的管理员,并且 WinRM 可访问(Test-WSMan <dc>)。
审计策略显示为“not a recognized (English) auditpol value”
QuietPhase 以英文解析 auditpol 输出。在本地化的 DC 上,请使用 auditpol /get /category:* 手动验证该设置。
ConsoleGuiTools 安装失败或 Out-ConsoleGridView 无法打开
确认你使用的是 PowerShell 7.2 或更高版本($PSVersionTable.PSVersion),并且可以访问 PowerShell Gallery。如果 PSGallery 不受信任,请接受提示,或手动运行 Install-Module Microsoft.PowerShell.ConsoleGuiTools -Scope CurrentUser。请在真实终端(Windows Terminal、pwsh 控制台)中运行 QuietPhase,而不是在 VS Code 集成控制台或 ISE 中运行。
某个组显示为“NotFound” 该组可能在此域中不存在(例如,Enterprise Admins 位于林根),或者根域的 DC 不可访问。请检查 DNS 以及到林根的信任连接性。
审计规则从受保护组中消失
具有 adminCount=1 的组会被 SDProp 从 AdminSDHolder 重置。请确保 AdminSDHolder 也带有该审计规则。QuietPhase 会自动检查并提出此建议。