You’ve Got (Graph) Mail – Leveraging Microsoft Graph API Change Notifications for Data Exfiltration
Microsoft Graph API change notifications (subscriptions) can be created by a compromised user or service principal to send rich notifications containing actual mailbox and Teams message content to an attacker-controlled webhook. An attacker with a stolen token could therefore exfiltrate email previews and full Teams messages without touching the mailbox or chat directly.
Published on netspi.com
Technical / Cloud Pentesting
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a design gap: the subscription feature lets a token holder direct rich notification data to any external webhook, and the tenant admin portal offers no view of existing subscriptions.
Impact
An attacker holding a stolen token could exfiltrate email previews and full Teams messages for a limited subscription lifetime, with minimal visibility and alerting, though Outlook content is limited to the first 255 characters of the body.
What the attacker needed
Stolen Graph access token; attacker-controlled HTTPS webhook; encryption certificate and private key; victim mailbox or chat activity
The fix
Microsoft added a new GraphNotificationsActivityLogs table that records every triggered change notification, improving detection rather than blocking the technique.
How it was found
- Obtain Graph API tokens for the target user, for example via device code login with a first-party app.
- Send a POST request to the subscriptions endpoint with includeResourceData set to true, an encryption certificate, and the target resource such as the inbox messages or all chat messages.
- Complete the webhook validation handshake so Microsoft registers the subscription.
- Wait for the victim to create, update or delete mail or chat items, which triggers notifications to the webhook.
- Decrypt the rich notification payload with the matching private key to read the content.
- Optionally extend the subscription before it expires to keep receiving data.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Microsoft Graph is the API behind Microsoft 365 services such as Outlook and Teams. A subscription is a standing request that tells Microsoft to send a copy of new or changed items to a web address you choose. If an attacker steals a user's login token, they can set up such a subscription pointing at their own server and quietly receive the victim's emails and chat messages.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.