
Microsoft Entra ID (Azure AD) 未認証列挙
ソース: EvilMist Toolkit - Invoke-EntraEnum.ps1 - https://github.com/Logisek/EvilMist
公開 API を使用してテナント情報を検出します。
azmap.dev サービスからテナントの詳細を取得します。
# Replace DOMAIN with target domain (e.g., example.com)
curl -s "https://azmap.dev/api/tenant?domain=DOMAIN&extract=true"
レスポンスに含まれるもの: tenantId、displayName、countryCode
トークンエンドポイントを含む OpenID Connect 構成を取得します。
# Replace DOMAIN with target domain
curl -s "https://login.microsoftonline.com/DOMAIN/v2.0/.well-known/openid-configuration"
レスポンスに含まれるもの: token_endpoint、authorization_endpoint、jwks_uri、issuer
ドメインの名前空間とフェデレーション構成を取得します。
# Replace DOMAIN with target domain
curl -s "https://login.microsoftonline.com/getuserrealm.srf?login=enum@DOMAIN&json=1"
レスポンスに含まれるもの:
NameSpaceType - "Managed" または "Federated"AuthURL - フェデレーション認証 URL(フェデレーションの場合)CloudInstanceName - クラウドインスタンス(例:"microsoftonline.com")FederationBrandName - 組織のブランド名DomainName - 検証済みドメインAzure AD にユーザーが存在するかどうかを確認します。ユーザーの存在に基づいて異なるコードを返します。
# Replace EMAIL with target email address
curl -s -X POST "https://login.microsoftonline.com/common/GetCredentialType" \
-H "Content-Type: application/json" \
-d '{
"Username": "EMAIL",
"isOtherIdpSupported": true,
"checkPhones": false,
"isRemoteNGCSupported": true,
"isCookieBannerShown": false,
"isFidoSupported": true,
"originalRequest": "",
"country": "US",
"forceotclogin": false,
"isExternalFederationDisallowed": false,
"isRemoteConnectSupported": false,
"federationFlags": 0,
"isSignup": false,
"flowToken": "",
"isAccessPassSupported": true
}'
IfExistsResult コード:
0 = ユーザーが存在(Azure IdP)1 = ユーザーは存在しない2 = 無効なリクエスト4 = サーバーエラー5 = ユーザーが存在(フェデレーション IdP)6 = ユーザーが存在(外部の非 Microsoft IdP)Azure/M365 関連レコードの DNS クエリを実行します。dig、nslookup、または host コマンドを使用します。
# Main domain CNAME
dig CNAME DOMAIN
# Autodiscover CNAME
dig CNAME autodiscover.DOMAIN
dig CNAME lyncdiscover.DOMAIN
dig CNAME sip.DOMAIN
dig TXT DOMAIN
dig SRV _ldap._tcp.DOMAIN
dig SRV _kerberos._tcp.DOMAIN
dig SRV _autodiscover._tcp.DOMAIN
dig SRV _sip._tls.DOMAIN
dig SRV _sipfederationtls._tcp.DOMAIN
dig MX DOMAIN
完全に検知不可能 - 監査ログは生成されません。
OneDrive 個人サイトの URL をプローブすることで、ユーザーの存在を確認します。
# Replace TENANT with tenant name (e.g., example)
# Replace USERPATH with email formatted as: user_domain_com (@ and . replaced with _)
# Example: [email protected] becomes john_doe_example_com
curl -s -o /dev/null -w "%{http_code}" -I \
"https://TENANT-my.sharepoint.com/personal/USERPATH/_layouts/15/onedrive.aspx"
ステータスコード:
200 = ユーザーが存在、OneDrive にアクセス可能401/403 = ユーザーが存在、アクセス拒否404 = ユーザーは存在しないcurl -s -o /dev/null -w "%{http_code}" -I \
"https://example-my.sharepoint.com/personal/john_doe_example_com/_layouts/15/onedrive.aspx"
署名証明書とトークンエンドポイントを含むフェデレーションメタデータを取得します。
# Replace DOMAIN with target domain
curl -s "https://login.microsoftonline.com/DOMAIN/FederationMetadata/2007-06/FederationMetadata.xml"
レスポンスに含まれるもの (XML):
デスクトップ SSO(シームレス シングル サインオン)が有効かどうかを検出します。
# Replace DOMAIN with target domain
curl -s "https://login.microsoftonline.com/getuserrealm.srf?login=user@DOMAIN&json=1"
確認する項目: DesktopSsoEnabled: true
# Replace TENANT_ID with the tenant GUID
curl -s -o /dev/null -w "%{http_code}" \
"https://autologon.microsoftazuread-sso.com/TENANT_ID/winauth/trust/2005/usernamemixed"
テナントに関連付けられた Azure リソースを検出します。DNS 解決を使用します。
# Replace TENANT with tenant name
# Primary tenant domain
dig A TENANT.onmicrosoft.com
# SharePoint
dig A TENANT.sharepoint.com
# OneDrive
dig A TENANT-my.sharepoint.com
# Azure Blob Storage
dig A TENANT.blob.core.windows.net
# Azure Files
dig A TENANT.file.core.windows.net
# Azure Queue
dig A TENANT.queue.core.windows.net
# Azure Table
dig A TENANT.table.core.windows.net
# Key Vault
dig A TENANT.vault.azure.net
# Azure SQL
dig A TENANT.database.windows.net
# App Service
dig A TENANT.azurewebsites.net
# Kudu/Git Deployment
dig A TENANT.scm.azurewebsites.net
# Cloud Services
dig A TENANT.cloudapp.net
dig A TENANT.cloudapp.azure.com
# Exchange Online Protection
dig A TENANT.mail.protection.outlook.com
# Container Registry
dig A TENANT.azurecr.io
# Redis Cache
dig A TENANT.redis.cache.windows.net
# Service Bus
dig A TENANT.servicebus.windows.net
# Front Door
dig A TENANT.azurefd.net
# Azure AD B2C
dig A TENANT.b2clogin.com
# API Management
dig A TENANT.azure-api.net
# Traffic Manager
dig A TENANT.trafficmanager.net
# HDInsight
dig A TENANT.azurehdinsight.net
# Cosmos DB
dig A TENANT.documents.azure.com
# Cognitive Search
dig A TENANT.search.windows.net
# Cognitive Services
dig A TENANT.cognitiveservices.azure.com
# Common suffixes: dev, prod, staging, test, uat, qa, backup, dr, api, app, web, data
dig A TENANTdev.blob.core.windows.net
dig A TENANTprod.azurewebsites.net
dig A TENANTstaging.vault.azure.net
Autodiscover V2 の JSON エンドポイントを介してユーザーの存在を確認します。
# Replace EMAIL with target email address
curl -s -o /dev/null -w "%{http_code}" -L --max-redirs 0 \
"https://autodiscover-s.outlook.com/autodiscover/autodiscover.json?Email=EMAIL&Protocol=Autodiscoverv1"
ステータスコード:
200 = ユーザーが存在302(リダイレクト)= ユーザーは存在しない401/403 = ユーザーが存在(認証が必要)ユーザー列挙のためのレガシー XML ベースの Autodiscover エンドポイントです。
# Replace DOMAIN with target domain
# Replace EMAIL with target email address
curl -s -X POST "https://autodiscover.DOMAIN/autodiscover/autodiscover.xml" \
-H "Content-Type: text/xml; charset=utf-8" \
-d '<?xml version="1.0" encoding="utf-8"?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
<Request>
<EMailAddress>EMAIL</EMailAddress>
<AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
</Request>
</Autodiscover>'
レスポンスの指標:
RedirectAddr = ユーザーが存在RedirectUrl = 存在を示す可能性ありErrorCode: InvalidUser = ユーザーは存在しないErrorCode: NoError = ユーザーが存在公開状況を確認するために EWS エンドポイントをプローブします。
# Office 365 EWS endpoints
curl -s -o /dev/null -w "%{http_code}" \
"https://outlook.office365.com/EWS/Exchange.asmx"
curl -s -o /dev/null -w "%{http_code}" \
"https://outlook.office.com/EWS/Exchange.asmx"
# On-premises/custom domain endpoints
# Replace DOMAIN with target domain
curl -s -o /dev/null -w "%{http_code}" \
"https://DOMAIN/EWS/Exchange.asmx"
curl -s -o /dev/null -w "%{http_code}" \
"https://mail.DOMAIN/EWS/Exchange.asmx"
curl -s -o /dev/null -w "%{http_code}" \
"https://ews.DOMAIN/EWS/Exchange.asmx"
利用可能性を示すステータスコード:
200、301、302、307、308 = 利用可能401、403 = 利用可能(認証が必要)404 = 利用不可SharePoint および Teams サイトを検出します。
# Replace TENANT with tenant name
# Tenant root
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com"
# OneDrive root
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT-my.sharepoint.com"
# Common site names to check
# Sites: intranet, portal, hr, finance, it, projects, marketing, sales, support, admin, security, dev
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com/sites/intranet"
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com/sites/portal"
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com/sites/hr"
# Teams sites
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com/teams/intranet"
curl -s -o /dev/null -w "%{http_code}" \
"https://TENANT.sharepoint.com/teams/it"
ステータスコード:
200 = サイトが存在し、公開アクセス可能401、403 = サイトが存在、認証が必要301、302、307、308 = サイトが存在、リダイレクト中404 = サイトは存在しないLync for Business の検出エンドポイントをプローブします。
# Replace DOMAIN with target domain
curl -s -o /dev/null -w "%{http_code}" \
"https://lyncdiscover.DOMAIN"
curl -s -o /dev/null -w "%{http_code}" \
"https://lyncdiscoverinternal.DOMAIN"
curl -s -o /dev/null -w "%{http_code}" \
"https://sip.DOMAIN"
# MX Records
dig MX DOMAIN
# SPF (TXT record)
dig TXT DOMAIN
# DMARC
dig TXT _dmarc.DOMAIN
# DKIM (common selectors)
dig TXT selector1._domainkey.DOMAIN # Microsoft 365
dig TXT selector2._domainkey.DOMAIN # Microsoft 365
dig TXT google._domainkey.DOMAIN # Google Workspace
dig TXT default._domainkey.DOMAIN
dig TXT dkim._domainkey.DOMAIN
dig TXT mail._domainkey.DOMAIN
dig TXT k1._domainkey.DOMAIN # Mailchimp
dig TXT s1._domainkey.DOMAIN
dig TXT s2._domainkey.DOMAIN
# MTA-STS
dig TXT _mta-sts.DOMAIN
# BIMI
dig TXT default._bimi.DOMAIN
# TLS-RPT
dig TXT _smtp._tls.DOMAIN
# Replace DOMAIN with target domain
curl -s "https://mta-sts.DOMAIN/.well-known/mta-sts.txt"
テナント ID を指定すると、関連付けられたリソースを検出します。
# Replace TENANT_ID with the tenant GUID
# OpenID Configuration (v2.0)
curl -s "https://login.microsoftonline.com/TENANT_ID/v2.0/.well-known/openid-configuration"
# OpenID Configuration (v1.0)
curl -s "https://login.microsoftonline.com/TENANT_ID/.well-known/openid-configuration"
# Graph Tenant Information (requires auth but reveals info in error)
curl -s "https://graph.microsoft.com/v1.0/tenantRelationships/findTenantInformationByTenantId(tenantId='TENANT_ID')"
# Device Code Endpoint
curl -s "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/devicecode"
# OAuth Authorize (reveals tenant branding)
curl -s "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/authorize?client_id=00000000-0000-0000-0000-000000000000&response_type=code&scope=openid"
既知のアプリケーション ID のエラーメッセージ分析を通じて OAuth 構成を列挙します。
# Replace TENANT with tenant ID or domain
# Well-known Microsoft Application IDs to test:
# Microsoft Graph
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=00000003-0000-0000-c000-000000000000&response_type=code&scope=openid"
# Azure AD Graph (Deprecated)
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=00000002-0000-0000-c000-000000000000&response_type=code&scope=openid"
# Office 365 Exchange Online
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=00000002-0000-0ff1-ce00-000000000000&response_type=code&scope=openid"
# Office 365 SharePoint Online
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=00000003-0000-0ff1-ce00-000000000000&response_type=code&scope=openid"
# Skype for Business Online
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=00000004-0000-0ff1-ce00-000000000000&response_type=code&scope=openid"
# Azure Service Management API
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=797f4846-ba00-4fd7-ba43-dac1f8f63013&response_type=code&scope=openid"
# Microsoft Azure PowerShell
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=1950a258-227b-4e31-a9cf-717495945fc2&response_type=code&scope=openid"
# Microsoft Azure CLI
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&response_type=code&scope=openid"
# Microsoft Office
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=d3590ed6-52b3-4102-aeff-aad2292ab01c&response_type=code&scope=openid"
# Microsoft Teams
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=1fec8e78-bce4-4aaf-ab1b-5451cc387264&response_type=code&scope=openid"
# Microsoft Planner
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=9bc3ab49-b65d-410a-85ad-de819febfddc&response_type=code&scope=openid"
# Microsoft Graph Command Line Tools
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=de8bc8b5-d9f9-48b1-a8ad-b748da725064&response_type=code&scope=openid"
# Azure Portal
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=c44b4083-3bb0-49c1-b47d-974e53cbdf3c&response_type=code&scope=openid"
# Microsoft App Access Panel
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=0000000c-0000-0000-c000-000000000000&response_type=code&scope=openid"
# Microsoft Outlook
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=5d661950-3475-41cd-a2c3-d671a3162bc1&response_type=code&scope=openid"
# Microsoft OneDrive
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=eb1cec80-a830-486e-b45b-f57094f163f9&response_type=code&scope=openid"
# SharePoint Online Client
curl -s "https://login.microsoftonline.com/TENANT/oauth2/v2.0/authorize?client_id=57fb890c-0dab-4253-a5e0-7188c88b2bb4&response_type=code&scope=openid"
分析対象の AADSTS エラーコード:
AADSTS700016 = ディレクトリ内にアプリケーションが見つからないAADSTS650057 = 無効なリソース(アプリは存在するが構成に問題がある)AADSTS65001 = ユーザー/管理者の同意が必要(アプリは存在する)AADSTS50011 = 応答 URL の不一致(アプリは存在する)AADSTS90002 = テナントが見つからない| 手法 | エンドポイント | HTTP メソッド |
|---|
| テナント情報 | https://azmap.dev/api/tenant?domain={domain}&extract=true | GET |
| OpenID 構成 | https://login.microsoftonline.com/{domain}/v2.0/.well-known/openid-configuration | GET |
| ドメインレルム | https://login.microsoftonline.com/getuserrealm.srf?login=user@{domain}&json=1 | GET |
| ユーザー列挙 | https://login.microsoftonline.com/common/GetCredentialType | POST |
| OneDrive 列挙 | https://{tenant}-my.sharepoint.com/personal/{user_path}/_layouts/15/onedrive.aspx | HEAD |
| フェデレーションメタデータ | https://login.microsoftonline.com/{domain}/FederationMetadata/2007-06/FederationMetadata.xml | GET |
| 自動ログオン | https://autologon.microsoftazuread-sso.com/{tenant_id}/winauth/trust/2005/usernamemixed | GET |
| Autodiscover V2 | https://autodiscover-s.outlook.com/autodiscover/autodiscover.json?Email={email}&Protocol=Autodiscoverv1 | GET |
| Autodiscover V1 | https://autodiscover.{domain}/autodiscover/autodiscover.xml | POST |
| EWS | https://outlook.office365.com/EWS/Exchange.asmx | GET |
| SharePoint | https://{tenant}.sharepoint.com/sites/{site} | GET |
| Lync | https://lyncdiscover.{domain} | GET |
| MTA-STS ポリシー | https://mta-sts.{domain}/.well-known/mta-sts.txt | GET |
| OAuth プローブ | https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?client_id={app_id}&response_type=code&scope=openid | GET |