Translated ['', 'src/pentesting-cloud/azure-security/az-enumeration-tool

This commit is contained in:
Translator
2026-05-26 19:12:44 +00:00
parent 5b94620859
commit 7e6fbf0402
@@ -5,7 +5,7 @@
## LinuxにPowerShellをインストール
> [!TIP]
> LinuxではPowerShell Coreをインストールする必要があります:
> linuxではPowerShell Coreをインストールする必要があります:
```bash
sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common
@@ -24,19 +24,19 @@ pwsh
# Az cli
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
```
## MacOSPowerShellをインストール
## MacOSPowerShell をインストール
手順は[**documentation**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4):
[**documentation**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4) の手順:
1. まだインストールしていない場合は `brew` をインストールします:
1. まだインストールしていない場合は `brew` をインストールす:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
2. PowerShell の最新の安定版をインストールしてください:
2. PowerShell の最新の安定版をインストールする:
```sh
brew install powershell/tap/powershell
```
3. PowerShell を実行する:
3. PowerShell を実行:
```sh
pwsh
```
@@ -45,23 +45,23 @@ pwsh
brew update
brew upgrade powershell
```
## 主要な列挙ツール
## Main Enumeration Tools
### az cli
[**Azure Command-Line Interface (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) は、Pythonで書かれたクロスプラットフォームツールで、(ほとんどの)AzureおよびEntra IDリソースの管理と運用を行います。Azureに接続し、コマンドラインやスクリプト経由で管理コマンドを実行します。
[**Azure Command-Line Interface (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) は、Azure と Entra ID のリソースの(ほとんど)を管理・運用するために Python で書かれたクロスプラットフォームツールです。コマンドラインやスクリプト経由で Azure に接続し、管理コマンドを実行します。
インストールについては、次のリンクを参照してください: [**installation instructions¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install).
[**installation instructions¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install) はこのリンクを参照してください。
Commands in Azure CLI are structured using a pattern of: `az <service> <action> <parameters>`
Azure CLI のコマンドは、`az <service> <action> <parameters>` というパターンで構成されます。
#### Debug | MitM az cli
Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending:
パラメータ **`--debug`** を使うと、ツール **`az`** が送信しているすべてのリクエストを確認できます:
```bash
az account management-group list --output table --debug
```
ツールに対して**MitM**を行い、送信しているすべての**requests**を手動で確認するには、以下を実行します:
In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do:
{{#tabs }}
{{#tab name="Bash" }}
@@ -105,42 +105,42 @@ $env:HTTP_PROXY="http://127.0.0.1:8080"
{{#endtabs }}
<details>
<summary><strong>CA cert does not include key usage extensionの修正</strong></summary>
<summary><strong>CA cert does not include key usage extensionの修正</strong></summary>
### なぜこのエラーが発生するのか
### なぜこのエラーが起きるのか
Azure CLIが認証する、HTTPSリクエストを行います(MSAL → Requests → OpenSSL経由)。BurpTLSをインターセプトしている場合、Burp`login.microsoftonline.com`のようなサイト用に“on the flyで証明書を生成し、BurpCAで署名します。
Azure CLI が認証するとき、HTTPS リクエストを送信します(MSAL → Requests → OpenSSL 経由)。BurpTLS をインターセプトしている場合、Burp`login.microsoftonline.com` のようなサイト向けに「on the flyで証明書を生成し、BurpCA で署名します。
新しいスタック(Python 3.13 + OpenSSL 3)では、CAの検証がより厳格になっています:
新しいスタック(Python 3.13 + OpenSSL 3)では、CA の検証がより厳格です。
- CA証明書は **Basic Constraints: `CA:TRUE`** を含み、証明書署名を許可する **Key Usage** 拡張(**`keyCertSign`**、通常は **`cRLSign`**)を持っている必要があります。
- CA 証明書**Basic Constraints: `CA:TRUE`** 、証明書署名を許可する **Key Usage** 拡張(**`keyCertSign`**、通常は **`cRLSign`** も)が必要です。
BurpのデフォルトCAPortSwigger CA)は古く、通常 Key Usage 拡張が欠けているため、OpenSSLはそれを「信頼している」場合でも却下します。
Burp のデフォルト CAPortSwigger CA)は古く、通常 Key Usage 拡張がないため、たとえ「信頼済み」にしていても OpenSSL は拒否します。
その結果、以下のようなエラーが発生します
その結果、のようなエラーがます
- `CA cert does not include key usage extension`
- `CERTIFICATE_VERIFY_FAILED`
- `self-signed certificate in certificate chain`
したがって、次を行う必要があります:
そのため、次の対応が必要です。
1. モダンなCA適切なKey Usageを持つを作成する。
2. Burpにそれを使わせてインターセプトした証明書署名させる。
3. そのCAmacOSで信頼する。
4. Azure CLI / RequestsにそのCAバンドルを指し示す
1. 適切な Key Usage を持つ आधुनिकな CA を作成する。
2. Burp にそれを使てインターセプトした証明書署名させる。
3. その CAmacOS で信頼する。
4. Azure CLI / Requests にその CA bundle を指定する
### ステップバイステップ:動作する構成
### 手順: 動作する設定
#### 0) 前提条件
- Burpがローカルで稼働している(proxy `127.0.0.1:8080`
- Azure CLIがインストールされているHomebrew
- `sudo`が使える(システムキーチェーンにCAを信頼させるため)
- Burp がローカルで起動していることproxy `127.0.0.1:8080`
- Azure CLI がインストール済みHomebrew
- `sudo` が使えること(システム keychain に CA を信頼済みとして追加するため)
#### 1) Create a standards-compliant Burp CA (PEM + KEY)
#### 1) 標準準拠の Burp CAPEM + KEY)を作成する
OpenSSLの設定ファイルを作成して、CA拡張を明示的に設定します
CA 拡張を明示的に設定する OpenSSL config file を作成します
```bash
mkdir -p ~/burp-ca && cd ~/burp-ca
@@ -172,18 +172,18 @@ openssl req -x509 -new -nodes \
-out burp-ca.pem \
-config burp-ca.cnf
```
サニティチェック(Key Usage 必ず表示されていることを確認してください:
Sanity check (Key Usage 必ず確認してください):
```bash
openssl x509 -in burp-ca.pem -noout -text | egrep -A3 "Basic Constraints|Key Usage"
```
以下のような内容が含まれているはずです:
のようなものが含まれているはずです:
- `CA:TRUE`
- `Key Usage: ... Certificate Sign, CRL Sign`
#### 2) PKCS#12 に変換する (Burp インポート形式)
#### 2) PKCS#12 に変換する (Burp import format)
Burp は certificate + private key 必要とし、最も簡単なのは PKCS#12 です:
Burp は certificate + private key 必要、最も簡単なのは PKCS#12 です:
```bash
openssl pkcs12 -export \
-out burp-ca.p12 \
@@ -191,66 +191,66 @@ openssl pkcs12 -export \
-in burp-ca.pem \
-name "Burp Custom Root CA"
```
エクスポート用のパスワードを要求されます(必ず設定してくださいBurpも同じパスワードを要求します)。
エクスポートパスワードを求められます(設定してくださいBurp がそのパスワードを要求します)。
#### 3) CAをBurpにインポートしてBurpを再起動する
#### 3) CAをBurpにインポートして Burp を再起動する
Burpで:
Burp で:
- Proxy → Options
- Find Import / export CA certificate
- Import / export CA certificate を見つける
- Click Import CA certificate
- Choose PKCS#12
- Select `burp-ca.p12`
- Enter the password
- Restart Burp completely (important)
- PKCS#12 を選択
- `burp-ca.p12` を選択
- パスワードを入力
- Burp を完全に再起動する(重要)
なぜ再起動するのかBurpは再起動するまで古いCAを使い続ける可能性があります。
なぜ再起動するのか? Burp は再起動するまで古い CA を使い続けることがあります。
#### 4) macOSのシステムキーチェーンで新しいCAを信頼する
#### 4) macOS system keychain で新しい CA を信頼する
これによりシステムアプリや多くのTLSスタックがそのCAを信頼るようになります。
これにより system apps と多くの TLS stacks がその CA を信頼できるようになります。
```bash
sudo security add-trusted-cert \
-d -r trustRoot \
-k /Library/Keychains/System.keychain \
~/burp-ca/burp-ca.pem
```
(If you prefer GUI: Keychain Access → System → Certificates → import → set “Always Trust”.)
(もしGUIを使うなら: Keychain Access → System → Certificates → import → “Always Trust” に設定。)
#### 5) プロキシの環境変数を設定
#### 5) proxy env vars を設定する
```bash
export HTTPS_PROXY="http://127.0.0.1:8080"
export HTTP_PROXY="http://127.0.0.1:8080"
```
#### 6) Requests/Azure CLI を Burp CA を信頼するように設定する
Azure CLI は内部で Python Requests を使用します。次の両方を設定してください:
Azure CLI は内部で Python Requests を使用する; 次の両方を設定する:
```bash
export REQUESTS_CA_BUNDLE="$HOME/burp-ca/burp-ca.pem"
export SSL_CERT_FILE="$HOME/burp-ca/burp-ca.pem"
```
Notes:
- `REQUESTS_CA_BUNDLE` は Requests によって使用されます。
- `SSL_CERT_FILE` は他の TLS クライアントやエッジケースで役立ちます。
- CA が正しく設定されていれば、通常は古い `ADAL_PYTHON_SSL_NO_VERIFY` / `AZURE_CLI_DISABLE_CONNECTION_VERIFICATION` は不要です。
- `REQUESTS_CA_BUNDLE` は Requests が使用します。
- `SSL_CERT_FILE` は他の TLS consumers や edge cases に有用です。
- 通常、CA が正しければ古い `ADAL_PYTHON_SSL_NO_VERIFY` / `AZURE_CLI_DISABLE_CONNECTION_VERIFICATION` は不要です。
#### 7) Burpが実際に新しいCAで署名していることを確認する(重要なチェック
#### 7) Burp が実際に新しい CA で signing していることを確認する(重要な確認
これにより、インターセプトチェーンが正しいこと確認できます:
これで、interception chain が正しいこと確認できます:
```bash
openssl s_client -connect login.microsoftonline.com:443 \
-proxy 127.0.0.1:8080 </dev/null 2>/dev/null \
| openssl x509 -noout -issuer
```
期待される発行者にはあなたの CA 名が含まれます。例:
Expected issuer contains your CA name, e.g.:
`O=Burp Custom CA, CN=Burp Custom Root CA`
それでも PortSwigger CA が表示される場合、Burp はインポートした CA を使用していません → インポートを再確認して再起動してください。
#### 8) Python Requests が Burp 経由で動作することを確認する
#### 8) Verify Python Requests works through Burp
```bash
python3 - <<'EOF'
import requests
@@ -258,23 +258,21 @@ requests.get("https://login.microsoftonline.com")
print("OK")
EOF
```
期待値: `OK`
#### 9) Azure CLI テスト
```bash
az account get-access-token --resource=https://management.azure.com/
```
すでにログインしている場合、`accessToken` を含む JSON を返すはずです。
If youre already logged in, it should return JSON with an `accessToken`.
</details>
### Az PowerShell
Azure PowerShell は、PowerShell コマンドラインから Azure リソースを直接管理するための cmdlets を含むモジュールです。
Azure PowerShell は、PowerShell コマンドラインから直接 Azure リソースを管理するための cmdlets を備えたモジュールです。
Follow this link for the [**installation instructions**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell).
[**installation instructions**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell) に従ってください。
Commands in Azure PowerShell AZ Module are structured like: `<Action>-Az<Service> <parameters>`
Azure PowerShell AZ Module のコマンドは、次のような形式です: `<Action>-Az<Service> <parameters>`
#### Debug | MitM Az PowerShell
@@ -282,37 +280,37 @@ Commands in Azure PowerShell AZ Module are structured like: `<Action>-Az<Service
```bash
Get-AzResourceGroup -Debug
```
ツールに対して**MitM**を行い、送信しているすべてのリクエストを手動で**確認する**ために、`HTTPS_PROXY``HTTP_PROXY` の環境変数を [**docs**](https://learn.microsoft.com/en-us/powershell/azure/az-powershell-proxy) に従って設定できます。
ツールに対して **MitM** を行い、送信される **すべての requests を手動で確認** したい場合は、[**docs**](https://learn.microsoft.com/en-us/powershell/azure/az-powershell-proxy) に従って env variables `HTTPS_PROXY``HTTP_PROXY`設定できます。
### Microsoft Graph PowerShell
Microsoft Graph PowerShell はクロスプラットフォームの SDK で、単一のエンドポイントを使って SharePoint、Exchange、Outlook のようなサービスを含むすべての Microsoft Graph APIs アクセスできます。PowerShell 7+、MSAL を使ったモダン認証、外部アイデンティティ、および高度なクエリをサポートします。最小権限アクセスに重点を置き、安全な操作を保証するとともに、最新の Microsoft Graph API 機能に合わせて定期的にアップデートされます。
Microsoft Graph PowerShell はSharePoint、Exchange、Outlook などのサービスを含むすべての Microsoft Graph APIs へのアクセスを、単一の endpoint から可能にする cross-platform SDK です。PowerShell 7+、MSAL による modern authentication、external identities、advanced queries をサポートします。least privilege access に重点を置き、secure operations を確保し、最新の Microsoft Graph API features に合わせるために定期的に更新されます。
インストール手順は [**installation instructions**](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation) を参照してください。
[**installation instructions**](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation) はこのリンクを参照してください。
Microsoft Graph PowerShell のコマンドは次のような形式です: `<Action>-Mg<Service> <parameters>`
Microsoft Graph PowerShell の commands は次のような形式です: `<Action>-Mg<Service> <parameters>`
#### Debug Microsoft Graph PowerShell
パラメータ **`-Debug`** を使用すると、ツールが送信しているすべてのリクエストを確認できます:
パラメータ **`-Debug`** を使と、ツールが送信しているすべての requests を確認できます:
```bash
Get-MgUser -Debug
```
### ~~**AzureAD Powershell**~~
Azure Active Directory (AD) モジュールは、現在 **deprecated** で、Azure AD リソース管理を行う Azure PowerShell の一部です。ユーザーグループ、アプリケーション登録の管理など、Entra ID 上での作業を行うための cmdlets を提供します。
Azure Active Directory (AD) module は、現在 **deprecated** で、Azure AD リソース管理するための Azure PowerShell の一部です。ユーザーグループ、Entra ID のアプリケーション登録の管理などのタスク向け cmdlet を提供します。
> [!TIP]
> これは Microsoft Graph PowerShell に置き換えられています
> これは Microsoft Graph PowerShell に置き換えられています
インストール手順は次のリンクを参照してください: [**installation instructions**](https://www.powershellgallery.com/packages/AzureAD).
[**installation instructions**](https://www.powershellgallery.com/packages/AzureAD) はこのリンクを参照してください。
## 自動化された Recon & コンプライアンスツール
## Automated Recon & Compliance Tools
### [turbot azure plugins](https://github.com/orgs/turbot/repositories?q=mod-azure)
Turbot steampipepowerpipe を使って Azure と Entra ID から情報を収集し、コンプライアンスチェックや構成ミスの検出を行えます。現在推奨される Azure モジュールは次のとおりです:
Turbot steampipepowerpipe を使うと、Azure と Entra ID から情報を収集し、compliance チェックや misconfiguration の発見を行えます。現在、実行が最も推奨される Azure モジュールは以下です:
- [https://github.com/turbot/steampipe-mod-azure-compliance](https://github.com/turbot/steampipe-mod-azure-compliance)
- [https://github.com/turbot/steampipe-mod-azure-insights](https://github.com/turbot/steampipe-mod-azure-insights)
@@ -343,9 +341,9 @@ powerpipe server
```
### [Prowler](https://github.com/prowler-cloud/prowler)
Prowler は、AWS、Azure、Google Cloud、Kubernetesセキュリティベストプラクティスに関する評価、監査、インシデント対応、継続的モニタリング、ハードニング、およびフォレンジック準備を行うためのオープンソースのセキュリティツールです。
Prowlerは、AWS、Azure、Google Cloud、Kubernetesに対してセキュリティベストプラクティスの評価、audit、incident response、continuous monitoring、hardening、forensics readinessを実施するためのOpen Source security toolです。
基本的に、Azure 環境に対して数百件のチェックを実行し、セキュリティの誤設定を検出して結果を json(およびその他のテキスト形式)で収集したり、ウェブ上で確認したりできます。
基本的に、Azure環境に対して数百のcheckを実行してsecurity misconfigurationsを見つけ、結果をjson(および他のtext format)で収集したり、webで確認したりできます。
```bash
# Create a application with Reader role and set the tenant ID, client ID and secret in prowler so it access the app
@@ -367,9 +365,9 @@ docker run --rm -e "AZURE_CLIENT_ID=<client-id>" -e "AZURE_TENANT_ID=<tenant-id>
```
### [Monkey365](https://github.com/silverhack/monkey365)
自動で Azure サブスクリプションおよび Microsoft Entra ID のセキュリティ構成レビューを実行できます。
Azure subscriptions と Microsoft Entra ID のセキュリティ設定レビューを自動で実行できます。
HTML レポートは、github リポジトリフォルダ内の `./monkey-reports` ディレクトリに格納されます。
HTML レポートは、github リポジトリフォルダ内の `./monkey-reports` ディレクトリに保存されます。
```bash
git clone https://github.com/silverhack/monkey365
Get-ChildItem -Recurse monkey365 | Unblock-File
@@ -390,7 +388,7 @@ Invoke-Monkey365 -TenantId <tenant-id> -ClientId <client-id> -ClientSecret $Secu
```
### [ScoutSuite](https://github.com/nccgroup/ScoutSuite)
Scout Suite は手動検査用の構成データを収集し、リスク領域を強調表示します。マルチクラウドのセキュリティ監査ツールで、クラウド環境のセキュリティ態勢の評価を可能にします。
Scout Suiteは、手動確認のための設定データを収集し、リスク領域をハイライトします。これは multi-cloud の security-auditing tool で、cloud 環境の security posture assessment を可能にします。
```bash
virtualenv -p python3 venv
source venv/bin/activate
@@ -406,18 +404,26 @@ python scout.py azure --cli
```
### [Azure-MG-Sub-Governance-Reporting](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)
これはpowershellスクリプトで、**Management GroupEntra IDテナント内のすべてのリソースと権限を可視化**し、セキュリティの設定を見つけるのに役立ちます。
Management GroupEntra ID テナント内のすべてのリソースと権限を**可視化**し、セキュリティの設定ミスを見つけるのに役立つ powershell script です。
Az PowerShell module を使用して動作するため、Az PowerShell module がサポートする認証方式はすべてこのツールで利用できます。
Az PowerShell module を使て動作するため、この tool でサポートされている認証はすべて tool でもサポートされています。
```bash
import-module Az
.\AzGovVizParallel.ps1 -ManagementGroupId <management-group-id> [-SubscriptionIdWhitelist <subscription-id>]
```
## Automated Post-Exploitation tools
### [**ROADRecon**](https://github.com/dirkjanm/ROADtools)
### [**ROADtools**](https://github.com/dirkjanm/ROADtools) / ROADrecon / ROADtx
ROADReconのenumerationは、Entra IDの設定(users、groups、roles、conditional access policiesなど)に関する情報を提供します。
ROADtools は、Entra ID に対する offensive research のための主要なオープンソースフレームワークの1つです。主なコンポーネントは以下のとおりです。
- **`roadrecon`**: tenant の discovery とローカル dataset の生成(users、groups、roles、devices、service principals、applications、directory settings)。
- **`roadtx`**: token の acquisition/exchange、refresh-token の reuse、device registration、PRT workflows。
- **`roadlib`**: 他のモジュールで使われる低レベルの auth/API library。
収集されたデータはローカルの SQLite database に保存され、ROADrecon の web UI で調査できます。これは、persistence や lateral movement を計画する前に、特権ユーザー、role assignments、devices、service principals、application 関係を把握するのに役立ちます。
#### ROADrecon collection
```bash
cd ROADTools
pipenv shell
@@ -428,25 +434,58 @@ roadrecon auth --as-app --client "<client-id>" --password "<secret>" --tenant "<
roadrecon gather
roadrecon gui
```
ROADrecon は元々 Azure AD Graph を対象としていました。**2026年5月22日**時点で、公式リポジトリは依然として Microsoft Graph サポートを **`msgraph`** ブランチに保持しており、**Tom2Byrne/ROADtools** のようなコミュニティ fork も Graph ベースの収集を更新し続けています。Graph 対応ビルドでは、ROADrecon は **`-mg`** スイッチを追加し、**`/users`**、**`/groups`**、**`/devices`**、**`/servicePrincipals`**、**`/applications`** などのエンドポイントを列挙します。
```bash
# Graph-capable ROADrecon builds
roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
roadrecon gather -mg
roadrecon gui
```
#### ROADtx high-value use cases
すでに有効な credentials、refresh token、または PRT-derived session を持っている場合、ROADtx は一般的に次の用途で使われます:
- **rogue Entra ID device を登録する** against **`urn:ms-drs:enterpriseregistration.windows.net`** ことで device keys/certificates を取得し、耐久性のある device-backed access を作成する。
- **refresh tokens を交換/再利用する** ことで、対話的 sign-in を繰り返さずに新しい Microsoft Graph または他の resource tokens を取得する。
- **PRT workflows を悪用する** ことで、バックグラウンドで新しい access tokens を静かに発行する。
有用な hunting の手がかりとして、デフォルトの **`roadtx device`** 値はこれまで次のようになっていました:
- **OS**: `Windows`
- **OS version**: `10.0.19041.928`
- **Name**: `DESKTOP-<RANDOM 8 DIGITS>`
これらの値は簡単に変更できるため、**弱い指標**として扱ってください。それでも、異常な device registration events、企業由来ではない命名パターン、不審な source IPs/geos/ASNs、または scripted user agents と組み合わせると有用です。
#### ROADtools opsec / hunting notes
ROADtools は正規の Microsoft identity APIs を使うため、防御側は malware-like signatures を期待するのではなく、token activity、enumeration patterns、user-agent anomalies の**組み合わせ**を追うべきです。有用な signals には次が含まれます:
- `Add device``Add registered owner to device``Add registered user to device``Register device` などの **Device registration** audit operations
- **Device Registration Service** に紐づく requests や sign-ins
- **`python-requests`**、**`urllib`**、**`curl`** のような script-like user agents
- **`/users`**、**`/groups`**、**`/devices`**、**`/servicePrincipals`**、**`/applications`** のような discovery-heavy endpoints に対する bursty Microsoft Graph reads
- audit data に現れる強力な OAuth scopes、特に **`Directory.ReadWrite.All`**, **`Device.ReadWrite.All`**, **`Application.ReadWrite.All`**, **`AuditLog.ReadWrite.All`**, **`Policy.ReadWrite.All`**
### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound)
AzureHoundMicrosoft Entra IDAzure向けのBloodHoundコレクターです。Windows/Linux/macOS用の単一の静的Goバイナリで、直接次にアクセスします:
- Microsoft Graph (Entra ID directory, M365) および
- Azure Resource Manager (ARM) の制御プレーン (subscriptions, resource groups, compute, storage, key vault, app services, AKS, etc.)
AzureHoundMicrosoft Entra IDAzure 向けの BloodHound collector です。Windows/Linux/macOS 用の単一の static Go binary で、次に直接接続します:
- Microsoft Graph (Entra ID directory, M365)
- Azure Resource Manager (ARM) control plane (subscriptions, resource groups, compute, storage, key vault, app services, AKS, etc.)
主な特徴
- パブリックインターネット上のどこからでも tenant APIs に対して実行可能(内部ネットワークアクセスは不要
- JSONを出力し、BloodHound CE に取り込んでアイデンティティとクラウドリソース間の攻撃経路を可視化
- 観測されるデフォルトのUser-Agent: azurehound/v2.x.x
Key traits
- public internet のどこからでも tenant APIs に対して動作する (internal network access は不要)
- attack paths を identities と cloud resources 全体で可視化するための BloodHound CE ingestion 向け JSON を出力する
- Default User-Agent observed: azurehound/v2.x.x
認証オプション
- ユーザー名 + パスワード: -u <upn> -p <password>
Authentication options
- Username + password: -u <upn> -p <password>
- Refresh token: --refresh-token <rt>
- JSON Web Token (access token): --jwt <jwt>
- Service principal secret: -a <appId> -s <secret>
- Service principal certificate: -a <appId> --cert <cert.pem> --key <key.pem> [--keypass <pass>]
使用例
Examples
```bash
# Full tenant collection to file using different auth flows
## User creds
@@ -481,37 +520,37 @@ azurehound list storage-containers -t "<tenant-id>" -o containers.json
azurehound list web-apps -t "<tenant-id>" -o webapps.json
azurehound list function-apps -t "<tenant-id>" -o funcapps.json
```
What gets queried
- Graph エンドポイント(例):
何がクエリされるか
- Graph endpoints(例):
- /v1.0/organization, /v1.0/users, /v1.0/groups, /v1.0/roleManagement/directory/roleDefinitions, directoryRoles, owners/members
- ARM エンドポイント(例):
- ARM endpoints(例):
- management.azure.com/subscriptions/.../providers/Microsoft.Storage/storageAccounts
- .../Microsoft.KeyVault/vaults, .../Microsoft.Compute/virtualMachines, .../Microsoft.Web/sites, .../Microsoft.ContainerService/managedClusters
Preflight behavior and endpoints
- 各 azurehound list <object> は、列挙の前に通常以下のテストコールを実行します:
事前確認の動作と endpoints
- 各 azurehound list <object> は通常、enumeration の前に次のテスト呼び出しを実行する:
1) Identity platform: login.microsoftonline.com
2) Graph: GET https://graph.microsoft.com/v1.0/organization
3) ARM: GET https://management.azure.com/subscriptions?api-version=...
- クラウド環境のベースURLは Government/China/Germany で異なります。リポジトリの constants/environments.go を参照してください
- Government/China/Germany では cloud environment の base URLs が異なる。repo の constants/environments.go を参照。
ARM-heavy objects (less visible in Activity/Resource logs)
- 以下のターゲットは主に ARM コントロールプレーンの読み取りを使用します: automation-accounts, container-registries, function-apps, key-vaults, logic-apps, managed-clusters, management-groups, resource-groups, storage-accounts, storage-containers, virtual-machines, vm-scale-sets, web-apps.
- これらの GET/list 操作は通常 Activity Logs に書き込まれません。データプレーンの読み取り(例: *.blob.core.windows.net, *.vault.azure.net)はリソースレベルの Diagnostic Settings でカバーされます
ARM-heavy objectsActivity/Resource logs では見えにくい)
- 以下の list 対象は主に ARM control plane の reads を使う: automation-accounts, container-registries, function-apps, key-vaults, logic-apps, managed-clusters, management-groups, resource-groups, storage-accounts, storage-containers, virtual-machines, vm-scale-sets, web-apps.
- これらの GET/list operations は通常 Activity Logs に記録されない; data-plane reads(例: *.blob.core.windows.net, *.vault.azure.net)は resource level の Diagnostic Settings でカバーされ
OPSEC and logging notes
- Microsoft Graph Activity Logs はデフォルトで有効になっていません。Graph コールの可視化ために有効化して SIEM にエクスポートしてください。Graph のプリフライト GET /v1.0/organization UA azurehound/v2.x.x で行われることを想定してください
- Entra ID の non-interactive sign-in ログは、AzureHound が使用する identity platform auth (login.microsoftonline.com) を記録します。
- ARM のコントロールプレーンの read/list 操作は Activity Logs に記録されません。多くの azurehound list 操作はそこに表示されません。サービスエンドポイントへの読み取りを記録するのは、Diagnostic Settings 経由のデータプレーンロギングのみです
- Defender XDR GraphApiAuditEvents (preview) は Graph コールやトークン識別子を露出する可能性がありますが、UserAgent が欠落していたり保持期間が短い場合があります
OPSEC logging の注意
- Microsoft Graph Activity Logs はデフォルトで有効ではない; Graph calls を可視化するために有効化して SIEM に export する。Graph preflight の GET /v1.0/organization UA azurehound/v2.x.x を想定する
- Entra ID の non-interactive sign-in logs は、AzureHound が使用する identity platform authlogin.microsoftonline.comを記録す
- ARM control-plane の read/list operations は Activity Logs に記録されない; resources に対する多くの azurehound list operations はそこに現れない。service endpoints への reads は data-plane loggingDiagnostic Settings 経由)だけが記録する
- Defender XDR GraphApiAuditEventspreviewは Graph calls と token identifiers を公開できるが、UserAgent が欠けていて retention が限られる場合があ
Tip: 権限経路を列挙する際は、ユーザー、グループ、ロール、およびロール割り当てをダンプしてから BloodHound に取り込み、事前構築された Cypher クエリを使用して Global Administrator/Privileged Role Administrator やネストされたグループおよび RBAC 割り当て経由の推移的昇格を可視化してください
Tip: privilege paths を列挙する際は、users, groups, roles, role assignments を dump し、その後 BloodHound に ingest して prebuilt cypher queries を使い、Global Administrator/Privileged Role Administrator と、nested groups と RBAC assignments を介した transitive escalation を可視化する
Launch the BloodHound web with `curl -L https://ghst.ly/getbhce | docker compose -f - up` and import the `output.json` file. Then, in the EXPLORE tab, in the CYPHER section you can see a folder icon that contains pre-built queries.
`curl -L https://ghst.ly/getbhce | docker compose -f - up` で BloodHound web を起動し、`output.json` file を import する。次に、EXPLORE tab CYPHER section で、pre-built queries を含む folder icon を確認できる。
### [**MicroBurst**](https://github.com/NetSPI/MicroBurst)
MicroBurst includes functions and scripts that support Azure Services discovery, weak configuration auditing, and post exploitation actions such as credential dumping. It is intended to be used during penetration tests where Azure is in use.
MicroBurst には、Azure Services discoveryweak configuration auditingpost exploitation actionscredential dumping など)を支援する functions と scripts が含まれている。Azure が使われている penetration tests で使用することを意図している。
```bash
Import-Module .\MicroBurst.psm1
Import-Module .\Get-AzureDomainInfo.ps1
@@ -519,9 +558,9 @@ Get-AzureDomainInfo -folder MicroBurst -Verbose
```
### [**PowerZure**](https://github.com/hausec/PowerZure)
PowerZureは、Azure、EntraID、および関連リソースに対してreconnaissanceexploitationの両方を実行できるフレームワークの必要性から作れました。
PowerZure は、Azure、EntraID、および関連リソースに対して reconnaissanceexploitation の両方を実行できる framework が必要だったことから作成されました。
これは**Az PowerShell**モジュールを使用しているため、このツールがサポートする認証方式はすべて利用可能です。
これは **Az PowerShell** module を使用しているため、この tool でサポートされている any authentication は tool でもサポートされます。
```bash
# Login
Import-Module Az
@@ -552,7 +591,7 @@ Invoke-AzureRunCommand -Command <command> -VMName <vmname>
```
### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner)
GraphRunnerは、Microsoft Graph APIとやり取りするためのpost-exploitationツールセットです。Microsoft Entra ID (Azure AD) アカウントからデータのreconnaissance、persistence、およびpillagingを行うための各種ツールを提供します。
GraphRunnerは、Microsoft Graph APIとやり取りするためのpost-exploitationツールセットです。Microsoft Entra ID (Azure AD) アカウントに対して、reconnaissance、persistence、そしてデータのpillagingを行うためのさまざまなツールを提供します。
```bash
#A good place to start is to authenticate with the Get-GraphTokens module. This module will launch a device-code login, allowing you to authenticate the session from a browser session. Access and refresh tokens will be written to the global $tokens variable. To use them with other GraphRunner modules use the Tokens flag (Example. Invoke-DumpApps -Tokens $tokens)
Import-Module .\GraphRunner.ps1
@@ -596,9 +635,9 @@ Invoke-GraphRunner -Tokens $tokens
```
### [Stormspotter](https://github.com/Azure/Stormspotter)
StormspotterAzure サブスクリプション内のリソースのattack graphを作成します。これにより red teamspentesterstenant 内の attack surfacepivot の機会を可視化でき、defendersincident response 作業を迅速に把握優先付けできるようになります。
Stormspotterは、Azure subscription内のリソースのattack graphを作成します。これによりred teamspentestersは、tenant内のattack surfacepivot opportunitiesを可視化でき、さらにdefendersincident response作業の状況把握優先順位付けを素早く行えるようになります。
**残念ながら、メンテナンスされていないようです**
**残念ながら、メンテナンスされていないようです**
```bash
# Start Backend
cd stormspotter\backend\
@@ -616,8 +655,12 @@ az login -u test@corp.onmicrosoft.com -p Welcome2022!
python stormspotter\stormcollector\sscollector.pyz cli
# This will generate a .zip file to upload in the frontend (127.0.0.1:9091)
```
## 参考文献
## References
- [Cloud Discovery With AzureHound (Unit 42)](https://unit42.paloaltonetworks.com/threat-actor-misuse-of-azurehound/)
- [Paved With Intent: ROADtools and Nation-State Tactics in the Cloud](https://unit42.paloaltonetworks.com/roadtools-cloud-attacks/)
- [ROADtools repository](https://github.com/dirkjanm/ROADtools)
- [ROADtools msgraph branch](https://github.com/dirkjanm/ROADtools/tree/msgraph)
- [Tom2Byrne/ROADtools](https://github.com/Tom2Byrne/ROADtools)
- [AzureHound repository](https://github.com/SpecterOps/AzureHound)
- [BloodHound repository](https://github.com/SpecterOps/BloodHound)
- [AzureHound Community Edition Flags](https://bloodhound.specterops.io/collect-data/ce-collection/azurehound-flags)