Skip to content
OAuth / SSO Write-up Intermediate

Would You Click ‘Accept’? Automatically detecting malicious Azure OAuth applications using LLMs

The text describes malicious OAuth applications in Microsoft Entra ID that impersonate legitimate services to trick users into granting consent, allowing attackers to access emails and files. It also presents a detection pipeline using LLMs to identify such apps across environments.

Shahar Dorfman Follow

Published on wiz.io

This app looks like a standard Microsoft prompt, but there’s a catch: the name starts with a zero, not the letter O.

Shahar Dorfman, on wiz.io

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 the lack of verification and contextual analysis of OAuth application metadata, allowing attackers to create convincing fake apps that users consent to.

Impact

Attackers could read user emails and files, maintain access through delegated permissions, and exfiltrate data without triggering MFA or anomalous login alerts.

What the attacker needed

Victim clicks a link; victim signs in; victim grants consent

The fix

Restrict user consent to apps from unverified publishers, regularly audit OAuth grants, monitor first-time apps, and baseline reply URLs.

How it was found

  1. Attacker creates an application in their own Azure environment with a legitimate-looking name and logo.
  2. Attacker sends a phishing email to the victim, luring them to click a link.
  3. The link leads to a real Microsoft sign-in page, and after sign-in, the user sees a consent prompt.
  4. The user clicks 'Accept', granting permissions to the attacker's app.
  5. The access token is sent to the attacker's redirect URL, giving them access to the user's data.
  6. The service principal persists in the victim tenant, allowing continued access.

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.

OAuth applications are third-party apps that you can grant permission to access your data, like letting a calendar app read your email. Attackers create fake apps with names similar to real ones and trick users into clicking 'Accept' on a permission prompt, giving the attacker access to the user's files and emails without needing their password.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by Shahar Dorfman

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.