PIM (Privileged Identity Management) Activation Forensics & Anomaly Hunting
Entra Privileged Identity Management (PIM) logs role activations as "Add member to role completed (PIM activation)" alongside user-entered Justification text and initiator IP. During an AiTM takeover of an eligible admin, the attacker activates Global or Exchange Admin inside the stolen session—often entering generic justification text like "maintenance" or tampering with "Update role setting in PIM".
Why This Artifact Matters in M365 Incident Response
Deploying Microsoft Entra Privileged Identity Management (PIM) eliminates standing Global Administrators—dramatically shrinking day-to-day attack surface. Yet PIM is not magic armor against session hijacking: if an eligible admin falls for an Evilginx AiTM lure while un-elevated, the attacker sitting inside that stolen session can click straight into PIM and activate Global Administrator unless PIM enforces a fresh Conditional Access Authentication Context with Phishing-Resistant MFA.
Investigating PIM audit trails lets defenders catch both unauthorized admin activations and stealth policy weakening.
In Entra Audit Logs (and Purview RecordType 8), watch three distinct PIM signals: `Add member to role requested (PIM activation)` / `Add member to role completed (PIM activation)`, `Update role setting in PIM` (which exposes someone turning off approval gates, dropping MFA on activation, or extending maximum activation windows to 24 hours), and `Add eligible member to role`.
Always correlate the PIM activation timestamp against the administrator’s Entra Interactive and Non-Interactive Sign-In logs over the preceding 15 minutes: if the admin signed in from Houston at 13:50 UTC, yet PIM activation came from a Frankfurt IP (`194.26.135.210`) at 14:04 UTC, you have undeniable proof of AiTM privilege elevation.
Step-by-Step Attack Reconstruction Timeline
An eligible Exchange Administrator opens a phishing PDF at 13:55 UTC on an AiTM proxy. At 14:04 UTC, the attacker triggers `Add member to role completed (PIM activation)` for `Exchange Administrator` with `resultReason: "urgent maintenance"` from `194.26.135.210`.
Because PIM only checked whether the existing browser cookie already contained an MFA claim rather than demanding a fresh FIDO2 tap via Conditional Access Authentication Context, elevation succeeds immediately—until AuditVane (`AV-011` + `AV-009`) correlates the Frankfurt IP with the PIM event.
PIM Activation Event in Entra Directory Audit JSON
{
"activityDateTime": "2026-12-02T14:04:19Z",
"activityDisplayName": "Add member to role completed (PIM activation)",
"category": "RoleManagement",
"initiatedBy": { "user": { "userPrincipalName": "sysadmin@contoso-demo.invalid", "ipAddress": "194.26.135.210" } },
"targetResources": [{ "displayName": "Exchange Administrator", "type": "Role" }],
"resultReason": "urgent maintenance"
}
Notice `initiatedBy.user.ipAddress` (`194.26.135.210`) alongside `resultReason: "urgent maintenance"`—comparing this IP directly against the admin’s Entra Sign-In JSON exposes the compromised session instantly.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
Add member to role completed (PIM activation) | Eligible admin activated directory role | Cross-check IP, SessionId & ticket number in Justification |
Update role setting in PIM | Modified MFA, approval, or duration rule | Flagged Critical by AuditVane AV-011 |
resultReason / Justification | Free-text justification supplied by user | Compare against real ITSM change tickets (look for ".") |
ExpirationDuration | How long elevated privilege lasts | Look for 8h–24h abnormal max-duration pulls |
TicketNumber | Optional ITSM reference field | Blank or bogus "1234" warrants verification |
CA Authentication Context | Forces fresh FIDO2/Compliant check on PIM activate | Best defense against stolen AiTM session elevation |
Inspect Active PIM Schedules & Audit PIM Activations via Graph
Connect-MgGraph -Scopes "RoleManagement.Read.Directory","AuditLog.Read.All"
# 1. Inspect currently active PIM role activations:
Get-MgRoleManagementDirectoryRoleAssignmentScheduleInstance -All |
Where-Object { $_.AssignmentType -eq "Activated" } |
Format-Table PrincipalId, RoleDefinitionId, StartDateTime, EndDateTime
# 2. Query recent PIM activation & setting audit logs:
Get-MgAuditLogDirectoryAudit -Filter "category eq 'RoleManagement'" -Top 100 |
Where-Object { $_.ActivityDisplayName -match "PIM|role setting" } |
Select-Object ActivityDateTime, ActivityDisplayName, ResultReason, @{N="Actor";E={$_.InitiatedBy.User.UserPrincipalName}}
Sample Active PIM Elevation Audit
ActivityDateTime ActivityDisplayName ResultReason Actor
---------------- ------------------- ------------ -----
2026-12-02T14:04:19Z Add member to role completed (PIM activation) urgent maintenance sysadmin@contoso.invalid
Weak PIM Configuration vs. AiTM-Resistant PIM Hardening
| PIM Setting | Vulnerable to AiTM Session Theft? | Recommended Hardened Control |
|---|---|---|
| Require Azure MFA on activation (Legacy) | YES — satisfied by existing stolen MFA cookie | Switch to Require Entra Conditional Access Authentication Context |
| Phishing-Resistant MFA Auth Context | NO — forces fresh FIDO2/Passkey tap at activation | Bind Tier-0 roles to Phishing-Resistant Auth Strength Context |
| Require Approval on Global Admin | Mitigates single-admin takeover | Require peer approval from 2nd verified Tier-0 admin |
| Maximum Activation Duration | 8–24 hours gives attacker wide dwell window | Cap Global/Priv Role Admin activations to 1–4 hours |
Step-by-Step Triage, Containment & Verification
- Drop Entra Directory Audit JSON and Sign-In JSON together into AuditVane and inspect AV-011 findings.
- Review every `PIM activation` and `Update role setting` event alongside the actor’s Entra Sign-In IP and `riskLevelDuringSignIn`.
- Verify `resultReason` strings directly against approved change-management / helpdesk tickets.
- If suspicious, immediately deactivate the active PIM assignment in Entra PIM, revoke user sessions (`Revoke-MgUserSignInSession`), and reset admin credentials.
- Upgrade PIM role settings for Global Admin, Privileged Role Admin, and Exchange Admin to require **Conditional Access Authentication Context** enforcing Phishing-Resistant MFA (FIDO2) and peer approval.
How to Verify Containment Completed Cleanly
- All currently Activated PIM assignments checked and unauthorized ones deactivated.
- Update role setting in PIM audited to verify MFA, approval, and max duration weren’t weakened.
- Tier-0 PIM roles linked to Conditional Access Authentication Context (Phishing-Resistant MFA).
Analyst Blind Spots, Licensing Quirks & False Positives
A widely misunderstood quirk in Entra PIM: checking "Require Azure MFA on activation" inside PIM role settings ONLY checks whether the user’s current session token already holds an MFA claim—meaning a stolen AiTM session satisfies it silently with zero prompt! Only Conditional Access **Authentication Context** with Sign-In Frequency (`Every time`) + Phishing-Resistant MFA forces a fresh hardware key check at activation.
Also watch `Update role setting in PIM`: an attacker who already holds Privileged Role Admin can lower activation rules first before elevating.
Frequently Asked Questions
Can an AiTM attacker activate PIM without knowing the admin’s MFA device?
Yes, unless PIM uses Conditional Access Authentication Context configured with Sign-In Frequency Every Time and Phishing-Resistant MFA.
How do attackers abuse Update role setting in PIM?
They disable peer approval, turn off activation notifications, or expand activation duration up to 24 hours.
Does AuditVane highlight PIM role mutations?
Yes! Rule AV-011 catches Add member to role, Add eligible member to role, and Update role setting events automatically.
Should regular admins check PIM justification logs periodically?
Yes—auditing vague justifications (".", "test", "maintenance") alongside Sign-In IPs quickly surfaces anomalous activations.