
AD 그룹 열거 감사용 Pwsh 도구
액티브 디렉터리 정찰이 침해로 이어지기 전에 탐지하십시오.
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로 읽는 것을 감사하는 SACL 항목이 있어야 합니다.두 조건이 모두 참이면, 각 구성원 읽기는 쿼리에 응답한 도메인 컨트롤러에서 이벤트 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에 의존합니다. 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이 무용지물입니다.변경이 필요한 항목이 있으면 실행은 -Apply, -WhatIf, -FixScriptPath 또는 수동 ADUC 단계에 대해 바로 붙여넣을 수 있는 명령으로 구성된 NEXT STEPS 블록으로 끝납니다.
==============================================================================
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에 대한 감사 및 보안 로그 관리(SeSecurityPrivilege) 권한이 필요합니다. Domain Admin으로 상승된 세션에서 실행하십시오. 포리스트 루트 그룹(Enterprise Admins, Schema Admins, Enterprise Key Admins)은 Enterprise Admin 권한이 필요합니다.
"auditpol.exe failed ... (elevation required)"
로컬 auditpol 쿼리에는 상승된 세션이 필요합니다. 원격 DC의 경우 DC에 대한 관리자 권한이 있고 WinRM에 연결할 수 있는지 확인하십시오(Test-WSMan <dc>).