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 属性の成功読み取りを監査する SACL エントリが存在する。両方が真の場合、メンバーシップの読み取りごとに、クエリに応答した DC 上で イベント 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 | 送信元 IP とワークステーションを得るためにイベント 4624(TargetLogonId)と結合する |
注:
net group /domainのような SAMR ベースのツールは、この 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 で監査ポリシーを確認する |
-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>)を確認してください。