mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-31 23:15:48 -08:00
Translated ['src/pentesting-cloud/azure-security/README.md', 'src/pentes
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
Azure Active Directory (Azure AD) は、Microsoft のクラウドベースのアイデンティティおよびアクセス管理サービスです。これは、従業員がサインインし、Microsoft 365、Azure ポータル、その他の多くの SaaS アプリケーションを含む、組織内外のリソースにアクセスするのを可能にする上で重要です。Azure AD の設計は、**認証、承認、およびユーザー管理**を主に含む、基本的なアイデンティティサービスを提供することに焦点を当てています。
|
||||
|
||||
Azure AD の主な機能には、**多要素認証**と**条件付きアクセス**が含まれ、他の Microsoft セキュリティサービスとのシームレスな統合も行われています。これらの機能は、ユーザーのアイデンティティのセキュリティを大幅に向上させ、組織がアクセスポリシーを効果的に実施および強制するのを支援します。Microsoft のクラウドサービスエコシステムの基本的なコンポーネントとして、Azure AD はユーザーアイデンティティのクラウドベースの管理において重要です。
|
||||
Azure AD の主な機能には、**多要素認証**と**条件付きアクセス**が含まれ、他の Microsoft セキュリティサービスとのシームレスな統合が行われています。これらの機能は、ユーザーのアイデンティティのセキュリティを大幅に向上させ、組織がアクセスポリシーを効果的に実施および強制するのを可能にします。Microsoft のクラウドサービスエコシステムの基本的なコンポーネントとして、Azure AD はユーザーアイデンティティのクラウドベースの管理において重要です。
|
||||
|
||||
## 列挙
|
||||
|
||||
@@ -66,12 +66,23 @@ $token = (az account get-access-token --resource https://graph.microsoft.com --q
|
||||
$secureToken = ConvertTo-SecureString $token -AsPlainText -Force
|
||||
Connect-MgGraph -AccessToken $secureToken
|
||||
|
||||
# Get token from session
|
||||
Parameters = @{
|
||||
Method = "GET"
|
||||
Uri = "/v1.0/me"
|
||||
OutputType = "HttpResponseMessage"
|
||||
}
|
||||
$Response = Invoke-MgGraphRequest @Parameters
|
||||
$Headers = $Response.RequestMessage.Headers
|
||||
$Headers.Authorization.Parameter
|
||||
|
||||
|
||||
# Find commands
|
||||
Find-MgGraphCommand -command *Mg*
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
Connect-AzAccount #Open browser
|
||||
# Using credentials
|
||||
@@ -80,15 +91,11 @@ $creds = New-Object System.Management.Automation.PSCredential("test@corp.onmicro
|
||||
Connect-AzAccount -Credential $creds
|
||||
|
||||
# Get Access Token
|
||||
(Get-AzAccessToken).Token
|
||||
# Request access token to other endpoints: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, MSGraph, OperationalInsights, ResourceManager, Storage, Synapse
|
||||
(Get-AzAccessToken -ResourceTypeName MSGraph).Token
|
||||
(Get-AzAccessToken -Resource "https://graph.microsoft.com").Token
|
||||
(ConvertFrom-SecureString (Get-AzAccessToken -ResourceTypeName Arm -AsSecureString).Token -AsPlainText)
|
||||
|
||||
# Connect with access token
|
||||
Connect-AzAccount -AccountId test@corp.onmicrosoft.com -AccessToken $token
|
||||
Connect-AzAccount -AccessToken $token -GraphAccessToken $graphaccesstoken -AccountId <ACCOUNT-ID>
|
||||
## The -AccessToken is from management.azure.com
|
||||
Connect-AzAccount -AccountId test@corp.onmicrosoft.com [-AccessToken $ManagementToken] [-GraphAccessToken $AADGraphToken] [-MicrosoftGraphAccessToken $MicrosoftGraphToken] [-KeyVaultAccessToken $KeyVaultToken]
|
||||
|
||||
# Connect with Service principal/enterprise app secret
|
||||
$password = ConvertTo-SecureString 'KWEFNOIRFIPMWL.--DWPNVFI._EDWWEF_ADF~SODNFBWRBIF' -AsPlainText -Force
|
||||
@@ -151,7 +158,7 @@ Connect-AzureAD -AccountId test@corp.onmicrosoft.com -AadAccessToken $token
|
||||
|
||||
Azureに**CLI**を通じてログインするとき、あなたは**Microsoft**に属する**テナント**からの**Azureアプリケーション**を使用しています。これらのアプリケーションは、あなたのアカウントで作成できるものと同様に、**クライアントID**を持っています。**コンソールで見ることができる許可されたアプリケーションのリスト**にはすべて表示されませんが、**デフォルトで許可されています**。
|
||||
|
||||
例えば、**認証**を行う**PowerShellスクリプト**は、クライアントID**`1950a258-227b-4e31-a9cf-717495945fc2`**を持つアプリを使用します。アプリがコンソールに表示されなくても、システム管理者は**そのアプリケーションをブロック**して、ユーザーがそのアプリを介して接続できないようにすることができます。
|
||||
例えば、**認証**を行う**PowerShellスクリプト**は、クライアントID **`1950a258-227b-4e31-a9cf-717495945fc2`**を持つアプリを使用します。アプリがコンソールに表示されなくても、システム管理者は**そのアプリケーションをブロック**して、ユーザーがそのアプリを介して接続できないようにすることができます。
|
||||
|
||||
しかし、**Azureに接続を許可する他のクライアントID**のアプリケーションもあります:
|
||||
```bash
|
||||
@@ -279,7 +286,7 @@ Get-AzureADMSAdministrativeUnit | where { Get-AzureADMSAdministrativeUnitMember
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
# Enumerate users
|
||||
Get-AzADUser
|
||||
@@ -346,6 +353,22 @@ az role assignment list --include-groups --include-classic-administrators true -
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
# Get all groups
|
||||
Get-AzADGroup
|
||||
# Get details of a group
|
||||
Get-AzADGroup -ObjectId <id>
|
||||
# Search group by string
|
||||
Get-AzADGroup -SearchString "admin" | fl * #Search at the beginnig of DisplayName
|
||||
Get-AzADGroup |?{$_.Displayname -match "admin"}
|
||||
# Get members of group
|
||||
Get-AzADGroupMember -GroupDisplayName <resource_group_name>
|
||||
# Get roles of group
|
||||
Get-AzRoleAssignment -ResourceGroupName <resource_group_name>
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Azure AD" }}
|
||||
```bash
|
||||
# Enumerate Groups
|
||||
@@ -373,22 +396,6 @@ Get-AzureADMSAdministrativeUnit | where { Get-AzureADMSAdministrativeUnitMember
|
||||
Get-AzureADGroup -ObjectId <id> | Get-AzureADGroupAppRoleAssignment | fl *
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
```bash
|
||||
# Get all groups
|
||||
Get-AzADGroup
|
||||
# Get details of a group
|
||||
Get-AzADGroup -ObjectId <id>
|
||||
# Search group by string
|
||||
Get-AzADGroup -SearchString "admin" | fl * #Search at the beginnig of DisplayName
|
||||
Get-AzADGroup |?{$_.Displayname -match "admin"}
|
||||
# Get members of group
|
||||
Get-AzADGroupMember -GroupDisplayName <resource_group_name>
|
||||
# Get roles of group
|
||||
Get-AzRoleAssignment -ResourceGroupName <resource_group_name>
|
||||
```
|
||||
{{#endtab }}
|
||||
{{#endtabs }}
|
||||
|
||||
#### グループにユーザーを追加
|
||||
@@ -433,28 +440,7 @@ az ad sp list --query '[?length(keyCredentials) > `0` || length(passwordCredenti
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Azure AD" }}
|
||||
```bash
|
||||
# Get Service Principals
|
||||
Get-AzureADServicePrincipal -All $true
|
||||
# Get details about a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | fl *
|
||||
# Get SP by string name or Id
|
||||
Get-AzureADServicePrincipal -All $true | ?{$_.DisplayName -match "app"} | fl
|
||||
Get-AzureADServicePrincipal -All $true | ?{$_.AppId -match "103947652-1234-5834-103846517389"}
|
||||
# Get owner of SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalOwner |fl *
|
||||
# Get objects owned by a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalOwnedObject
|
||||
# Get objects created by a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalCreatedObject
|
||||
# Get groups where the SP is a member
|
||||
Get-AzureADServicePrincipal | Get-AzureADServicePrincipalMembership
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalMembership |fl *
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
# Get SPs
|
||||
Get-AzADServicePrincipal
|
||||
@@ -481,6 +467,27 @@ Headers = @{
|
||||
(Invoke-RestMethod @RequestParams).value
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Azure AD" }}
|
||||
```bash
|
||||
# Get Service Principals
|
||||
Get-AzureADServicePrincipal -All $true
|
||||
# Get details about a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | fl *
|
||||
# Get SP by string name or Id
|
||||
Get-AzureADServicePrincipal -All $true | ?{$_.DisplayName -match "app"} | fl
|
||||
Get-AzureADServicePrincipal -All $true | ?{$_.AppId -match "103947652-1234-5834-103846517389"}
|
||||
# Get owner of SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalOwner |fl *
|
||||
# Get objects owned by a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalOwnedObject
|
||||
# Get objects created by a SP
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalCreatedObject
|
||||
# Get groups where the SP is a member
|
||||
Get-AzureADServicePrincipal | Get-AzureADServicePrincipalMembership
|
||||
Get-AzureADServicePrincipal -ObjectId <id> | Get-AzureADServicePrincipalMembership |fl *
|
||||
```
|
||||
{{#endtab }}
|
||||
{{#endtabs }}
|
||||
|
||||
> [!WARNING]
|
||||
@@ -625,6 +632,19 @@ az ad app list --query '[?length(keyCredentials) > `0` || length(passwordCredent
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
# Get Apps
|
||||
Get-AzADApplication
|
||||
# Get details of one App
|
||||
Get-AzADApplication -ObjectId <id>
|
||||
# Get App searching by string
|
||||
Get-AzADApplication | ?{$_.DisplayName -match "app"}
|
||||
# Get Apps with password
|
||||
Get-AzADAppCredential
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Azure AD" }}
|
||||
```bash
|
||||
# List all registered applications
|
||||
@@ -637,19 +657,6 @@ Get-AzureADApplication -All $true | %{if(Get-AzureADApplicationPasswordCredentia
|
||||
Get-AzureADApplication -ObjectId <id> | Get-AzureADApplicationOwner |fl *
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
```bash
|
||||
# Get Apps
|
||||
Get-AzADApplication
|
||||
# Get details of one App
|
||||
Get-AzADApplication -ObjectId <id>
|
||||
# Get App searching by string
|
||||
Get-AzADApplication | ?{$_.DisplayName -match "app"}
|
||||
# Get Apps with password
|
||||
Get-AzADAppCredential
|
||||
```
|
||||
{{#endtab }}
|
||||
{{#endtabs }}
|
||||
|
||||
> [!WARNING]
|
||||
@@ -667,7 +674,7 @@ Get-AzADAppCredential
|
||||
|
||||
### Managed Identities
|
||||
|
||||
Managed Identities についての詳細は、以下を確認してください:
|
||||
Managed Identities についての詳細は以下を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
../az-basic-information/
|
||||
@@ -716,7 +723,7 @@ az role assignment list --all --query "[?principalName=='carlos@carloshacktricks
|
||||
```
|
||||
{{#endtab }}
|
||||
|
||||
{{#tab name="Az PowerShell" }}
|
||||
{{#tab name="Az" }}
|
||||
```bash
|
||||
# Get role assignments on the subscription
|
||||
Get-AzRoleDefinition
|
||||
@@ -851,11 +858,11 @@ Get-AzureADMSAdministrativeUnit | where { Get-AzureADMSAdministrativeUnitMember
|
||||
|
||||
> [!WARNING]
|
||||
> デバイス (VM) が **AzureAD に参加している** 場合、AzureAD のユーザーは **ログインできる** ようになります。\
|
||||
> さらに、ログインしているユーザーがデバイスの **所有者** である場合、彼は **ローカル管理者** になります。
|
||||
> さらに、ログインしているユーザーがデバイスの **オーナー** である場合、彼は **ローカル管理者** になります。
|
||||
|
||||
### 管理単位
|
||||
|
||||
管理単位に関する詳細情報は、以下を確認してください:
|
||||
管理単位に関する詳細情報は以下を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
../az-basic-information/
|
||||
@@ -936,9 +943,9 @@ PIM が有効になっていると、各ロールに対して次のような特
|
||||
|
||||
### Entra アイデンティティ保護 <a href="#title-text" id="title-text"></a>
|
||||
|
||||
Entra アイデンティティ保護は、**ユーザーまたはサインインが受け入れられるにはリスクが高すぎる場合を検出する**セキュリティサービスで、ユーザーまたはサインインの試行を**ブロック**することができます。
|
||||
Entra アイデンティティ保護は、**ユーザーまたはサインインが受け入れられるにはリスクが高すぎる場合を検出する**セキュリティサービスであり、ユーザーまたはサインインの試行を**ブロック**することができます。
|
||||
|
||||
管理者は、リスクが「低およびそれ以上」、「中程度およびそれ以上」または「高」である場合に試行を**ブロック**するように設定できます。ただし、デフォルトでは完全に**無効**です:
|
||||
管理者は、リスクが「低およびそれ以上」、「中程度およびそれ以上」または「高い」場合に試行を**ブロック**するように設定できます。ただし、デフォルトでは完全に**無効**です:
|
||||
|
||||
<figure><img src="../../../images/image (356).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
@@ -948,7 +955,7 @@ Entra アイデンティティ保護は、**ユーザーまたはサインイン
|
||||
### Entra パスワード保護
|
||||
|
||||
Entra パスワード保護 ([https://portal.azure.com/index.html#view/Microsoft_AAD_ConditionalAccess/PasswordProtectionBlade](https://portal.azure.com/#view/Microsoft_AAD_ConditionalAccess/PasswordProtectionBlade)) は、**複数の不成功なログイン試行が発生した場合にアカウントをロックアウトすることで弱いパスワードの悪用を防ぐ**セキュリティ機能です。\
|
||||
また、提供する必要がある**カスタムパスワードリストを禁止する**こともできます。
|
||||
また、提供する必要のある**カスタムパスワードリストを禁止する**こともできます。
|
||||
|
||||
これは、クラウドレベルとオンプレミスの Active Directory の両方に**適用**できます。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user