mcpField
P
performing-active-directory-vulnerability-assessment

performing-active-directory-vulnerability-assessment

github.com/mukul975セキュリティ35.2k82 回インストール8 週間前に更新
リポジトリ

performing-active-directory-vulnerability-assessment について

Active Directory 環境を評価するセキュリティチーム向けのスキルです。PingCastle、BloodHound、Purple Knight を用いて、設定リスク、権限、攻撃経路を調べます。

主な機能

  1. 01PingCastle のヘルスチェック実行
  2. 02BloodHound による攻撃経路分析
  3. 03Purple Knight によるセキュリティ指標評価
  4. 04Kerberos と権限リスクの確認
  5. 05検出事項の修正優先度付け

活用シーン

  1. 01企業 AD ドメインの監査
  2. 02特権グループへの経路の特定
  3. 03Kerberos の露出や古いアカウントの検出
  4. 04評価結果に基づく修正計画の作成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-active-directory-vulnerability-assessment

インストール後、Claude Code で/performing-active-directory-vulnerability-assessmentを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

詳細

Active Directory の脆弱性評価の実施

概要

Active Directory(AD)は、ほとんどのエンタープライズ環境で主要な ID・アクセス管理システムとして利用されており、攻撃者にとって重要な標的です。このスキルでは、PingCastle による健全性チェック、BloodHound による攻撃経路の分析、Purple Knight によるセキュリティ態勢のスコアリングを用いて、包括的な AD セキュリティ評価を行います。これらのツールは、設定ミス、過剰な権限、Kerberos の脆弱性、ラテラルムーブメントの機会を特定します。

使用する場面

  • Active Directory の脆弱性評価を行うセキュリティ評価を実施する場合
  • 関連するセキュリティイベントに対するインシデント対応手順に従う場合
  • 定期的なセキュリティテストや監査を実施する場合
  • 実地テストを通じてセキュリティ制御を検証する場合

前提条件

  • スキャン用のドメイン参加済みワークステーション、またはドメイン管理者アクセス権
  • PingCastle(https://github.com/netwrix/pingcastle)
  • SharpHound コレクターを含む BloodHound Community Edition
  • Semperis の Purple Knight(無料のコミュニティツール)
  • 分析スクリプト用の Python 3.9+
  • Windows で PingCastle を使用するための .NET Framework 4.7+

ツール 1:PingCastle ヘルスチェック

インストールと実行
# Download PingCastle
Invoke-WebRequest -Uri "https://github.com/netwrix/pingcastle/releases/latest/download/PingCastle.zip" `
  -OutFile "PingCastle.zip"
Expand-Archive PingCastle.zip -DestinationPath C:\Tools\PingCastle

# Run health check against current domain
cd C:\Tools\PingCastle
.\PingCastle.exe --healthcheck

# Run health check against specific domain
.\PingCastle.exe --healthcheck --server dc01.corp.local --user CORP\scanner_account --password P@ssw0rd

# Run in scanner mode for multiple domains
.\PingCastle.exe --scanner --scannerlp

# Generate consolidated report
.\PingCastle.exe --healthcheck --level Full
PingCastle のスコアリングカテゴリ
カテゴリ説明リスク領域
古いオブジェクト非アクティブなアカウント、古いパスワード、旧式の OSゴーストアカウント、期限切れの認証情報
特権アカウント過剰な管理者権限、入れ子になったグループドメイン管理者の拡散、SID 履歴
信頼関係フォレストおよびドメインの信頼関係設定推移的な信頼関係の悪用、SID フィルタリング
異常セキュリティ設定の逸脱GPO の設定ミス、スキーマの問題
PingCastle の主なチェック項目
# Critical items to review in PingCastle report:
- Accounts with "Password Never Expires" flag
- Accounts with Kerberos pre-authentication disabled (AS-REP roastable)
- Accounts with Kerberos delegation (unconstrained/constrained)
- Domain Controllers running unsupported OS versions
- AdminSDHolder permission modifications
- Accounts in privileged groups (Domain Admins, Enterprise Admins, Schema Admins)
- Trust relationships with SID filtering disabled
- GPO vulnerabilities allowing privilege escalation

ツール 2:BloodHound による攻撃経路の分析

SharpHound によるデータ収集
# Download SharpHound collector
# https://github.com/SpecterOps/BloodHound/tree/main/packages/csharp/SharpHound

# Run SharpHound collection (all methods)
.\SharpHound.exe --collectionmethods All --domain corp.local --zipfilename bloodhound_data.zip

# Stealthy collection (minimal noise)
.\SharpHound.exe --collectionmethods Session,LoggedOn --domain corp.local --stealth

# Collection with specific domain controller
.\SharpHound.exe --collectionmethods All --domain corp.local --domaincontroller dc01.corp.local

# Run via PowerShell
Import-Module .\SharpHound.ps1
Invoke-BloodHound -CollectionMethod All -Domain corp.local -OutputDirectory C:\BH_Data
BloodHound CE のセットアップ
# Deploy BloodHound Community Edition with Docker
curl -L https://ghst.ly/getbhce -o docker-compose.yml
docker compose up -d

# Access BloodHound CE at http://localhost:8080
# Default credentials shown in docker compose logs

# Upload SharpHound data through web UI or API
curl -X POST "http://localhost:8080/api/v2/file-upload/start" \
  -H "Authorization: Bearer $BH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"fileName": "bloodhound_data.zip"}'
BloodHound の重要なクエリ
# Find shortest path to Domain Admin
MATCH p=shortestPath((u:User)-[*1..]->(g:Group {name:"DOMAIN [email protected]"}))
WHERE u.name <> "[email protected]"
RETURN p

# Find Kerberoastable accounts with admin privileges
MATCH (u:User {hasspn:true})-[:MemberOf*1..]->(g:Group)
WHERE g.name CONTAINS "ADMIN"
RETURN u.name, u.serviceprincipalnames

# Find computers where Domain Admins are logged in
MATCH (c:Computer)-[:HasSession]->(u:User)-[:MemberOf*1..]->(g:Group {name:"DOMAIN [email protected]"})
RETURN c.name, u.name

# Find AS-REP roastable accounts
MATCH (u:User {dontreqpreauth:true})
RETURN u.name, u.description

# Find unconstrained delegation hosts
MATCH (c:Computer {unconstraineddelegation:true})
WHERE NOT c.name CONTAINS "DC"
RETURN c.name

# Find GPO abuse paths
MATCH p=(u:User)-[:GenericAll|GenericWrite|WriteOwner|WriteDacl]->(g:GPO)
RETURN p

ツール 3:Purple Knight による評価

# Download Purple Knight from https://www.purple-knight.com/
# Run as domain admin or with appropriate read permissions

.\PurpleKnight.exe

# Purple Knight checks 130+ security indicators across:
# - Account Security (password policies, privileged accounts)
# - AD Infrastructure (replication, DNS, LDAP signing)
# - Group Policy (GPO permissions, security settings)
# - Kerberos Security (delegation, encryption types, SPN)
# - AD Delegation (AdminSDHolder, OU permissions)
Purple Knight のスコアカテゴリ
スコア範囲評価必要な対応
90-100優秀現在のセキュリティ態勢を維持する
75-89良好高リスクの検出事項に対処する
60-74普通修正計画を優先する
40-59不良直ちに修正する
0-39危機的緊急対応が必要

よくある AD の脆弱性

1. Kerberoasting のリスク
# Find SPNs assigned to user accounts (Kerberoasting targets)
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName |
  Select-Object Name, ServicePrincipalName, PasswordLastSet, Enabled
2. AS-REP Roasting のリスク
# Find accounts with pre-auth disabled
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth |
  Select-Object Name, DoesNotRequirePreAuth, Enabled
3. LLMNR/NBT-NS ポイズニングのリスク
# Check if LLMNR is disabled via GPO
Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name EnableMulticast -ErrorAction SilentlyContinue
4. 特権グループへの過剰なメンバー登録
# Count members in critical groups
$groups = @("Domain Admins", "Enterprise Admins", "Schema Admins", "Account Operators", "Backup Operators")
foreach ($group in $groups) {
    $count = (Get-ADGroupMember -Identity $group -Recursive).Count
    Write-Output "$group : $count members"
}

修正の優先順位

検出事項リスク修正方法
Kerberoasting が可能な管理者アカウント重大SPN を削除するか、MSA/gMSA を使用する
DC 以外での制約のない委任重大制約付き委任/RBCD に切り替える
管理者アカウントでパスワードの有効期限が無効高パスワードの定期変更ポリシーを有効にする
AS-REP Roasting が可能なアカウント高Kerberos の事前認証を有効にする
AdminSDHolder の変更高監査し、既定の ACL を復元する
古いコンピューターアカウント(90 日以上)中無効化し、隔離 OU に移動する
LDAP 署名が強制されていない中すべての DC で GPO を通じて有効にする

参考資料

コメント