Skip to content
Access control Write-up Intermediate

Azure AD Misconfiguration: The $40K Bing Takeover

A multi-tenant Azure AD app used by Bing's content management system allowed any Azure account to log in without checking tenant or user authorisation. An attacker could edit live Bing search results and inject scripts that could read a victim's Office 365 data.

medium.com

Published on medium.com

Bug Bounty

Muhammad Asim Shahzad, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Bing.com is Microsoft's public search engine, and behind parts of it sit internal content tools that Microsoft staff use to publish and edit what searchers see. One of those tools was a content management system called Bing Trivia, which fed items into a carousel of results on the live site. The admin panel for that tool was an Azure AD application, and the way it was registered with Azure AD is what this case study is about.

AI-generated illustration From the original on medium.com

The illustration above is AI-generated and opens the write-up; it carries no technical detail.

This is an analytical case study of a public disclosure by Wiz Research, not the author's own discovery. The bug was fixed in early 2023, and reproduction details are deliberately left out. The bounty was $40,000 from Microsoft, which Wiz said it would donate. No CVE was reported, and no severity rating was published.

Setup

Azure App Services and Azure Functions offer a login button out of the box. When an app is marked multi-tenant, any Azure AD tenant can issue a valid token for it. The platform verifies that the token is genuine; deciding whether the tenant or the user behind it belongs in your application is left to your own code.

Wiz calls the resulting gap shared-responsibility confusion. Its scans found that roughly a quarter of multi-tenant apps were exposed this way. One of them was Bing Trivia.

The researchers signed in with a user from their own Azure AD tenant. They signed in with a user from that tenant and landed in the Bing Trivia admin panel.

Finding it

The flaw is not a broken token check. The token was valid, and Azure AD correctly vouched for the identity in it. What was missing was the second question: does this tenant, and this user, have any business being here? A multi-tenant registration answers yes to every tenant by design, and the application never added a check of its own. To the researchers, an admin panel that accepted a login from an unrelated tenant was the signal that the authorisation step had been skipped.

Exploitation

Step 1: sign in from a foreign tenant

The researchers authenticated to the Bing Trivia admin panel with a user from their own Azure AD tenant. The login succeeded and gave them the panel's administrative interface.

Step 2: change live content

That panel fed real Bing content. The researchers swapped one item in the carousel for a "best soundtracks" search. The change appeared on Bing.com.

Step 3: test script execution

They also ran a harmless script test through the same channel, and it executed. A harmless script test also ran, meaning a malicious edit could have executed in every searcher's browser.

Step 4: chain to Office 365 data

During disclosure, Wiz showed that such a script could obtain an Office 365 token for the visitor, exposing mail, calendar, Teams chats and files. They tested this only against their own account and reverted their edits.

Root cause

The mistake is an authorisation gap in a multi-tenant Azure AD registration. Marking an app multi-tenant tells Azure AD to issue tokens to users from any tenant, and the platform only checks that the token is genuine. Whether that tenant or user should be allowed in is the application's responsibility, and Bing Trivia did not perform that check. The panel's output reached a public site, and a harmless script test ran there, so a malicious edit could have executed in searchers' browsers.

Existing defences did not stop it because the token validation itself was working as designed: the login was legitimate from Azure AD's point of view. Nothing in the flow asked whether the tenant was on an allowlist or whether the user was assigned to the app.

Wiz also found other exposed internal Microsoft apps, including an MSN newsletter panel and a file system it described as holding over 4 exabytes.

Impact

Bing has a vast audience, so one poisoned popular result could reach a huge number of users. Through the stored script, an attacker could have obtained an Office 365 token for a visitor and with it access to that person's mail, calendar, Teams chats and files. The researchers demonstrated the chain only against their own account.

Microsoft said the affected apps were out of bounty scope but rewarded the Azure AD improvements the research prompted. Wiz notes that Azure AD logs cannot show past abuse; application logs are the place to look for evidence of it.

Fix

Microsoft fixed the issue in early 2023. The write-up does not describe the specific changes made to the Bing Trivia registration. The author's own recommendations for multi-tenant apps are:

  1. Stay single-tenant unless you truly need more. It is a settings change.
  2. Authorise after you authenticate: check the tenant ID against an allowlist, then check that the user is assigned to the app.
  3. Escape CMS output. An admin tool that publishes to a public site is an XSS source.

The author's illustrative authorisation logic, reproduced as published:

Text
ALLOWED_TENANTS = {"<your-tenant-id>"}def authorize(request):    claims = verify_token(request.bearer)              if claims is None:        return deny(401)    if claims["tid"] not in ALLOWED_TENANTS:        audit("foreign_tenant_login", claims["tid"], claims["oid"])        return deny(403, "tenant_not_allowed")    user = app_users.find(tenant=claims["tid"], object_id=claims["oid"])    if user is None or "cms_editor" not in user.roles:        return deny(403, "not_assigned")    return allow(user)

Variants to test

  • Foreign-tenant login on internal admin tools. Register or use an account in a different Azure AD tenant and attempt to sign in to any internal app you are authorised to test. A positive result is a successful login and a usable admin interface rather than an error page.
  • Tenant allowlist bypass. A positive result is access granted to a tenant that should not be on the list.
  • User assignment bypass. After passing the tenant check, test a user in the right tenant who is not assigned to the app. A positive result is access without an assignment or role.
  • Stored XSS through CMS output. If an admin panel publishes to a public site, submit a harmless script marker in editable content and view the public page. A positive result is the marker executing in the public context.
  • Log coverage check. Confirm whether Azure AD sign-in logs would record a foreign-tenant login to the app, and whether the application logs it. Wiz notes Azure AD logs cannot show past abuse; application logs are the place to look.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

Bing.com is Microsoft's public search engine. Behind parts of it sit internal tools that Microsoft staff use to publish and edit what searchers see. One of those tools was a content management system (CMS) called Bing Trivia, which fed items into a carousel of results on the live site. A carousel is the row of cards or suggestions that slides across a page. The admin panel for that tool was an Azure AD application, and the way it was registered with Azure AD is what this case study is about.

AI-generated illustration From the original on medium.com

The illustration above is AI-generated and opens the write-up; it carries no technical detail.

A few words before we start, because the rest of the article leans on them.

  • Azure AD (now called Microsoft Entra ID) is Microsoft's cloud service for signing people in. When you click "Sign in with Microsoft" somewhere, Azure AD is the thing that checks your password and hands the website a note saying who you are. A tenant is one organisation's own separate area inside Azure AD: every company that uses Microsoft's cloud gets its own tenant, with its own users.
  • Multi-tenant means an application is willing to accept sign-ins from users in any tenant, not just its own. That is useful for a public product that any company should be able to use. It is dangerous for an internal admin tool that only Microsoft staff should reach.
  • A token is that note Azure AD hands over after a successful login. It is a long string of characters that the website can check to confirm the identity inside it. Think of a cloakroom ticket: the attendant checks the ticket is genuine, but the ticket does not by itself prove you are allowed into the VIP room.

This is an analytical case study of a public disclosure by Wiz Research, not the author's own discovery. The bug was fixed in early 2023, and reproduction details are deliberately left out. The bounty was $40,000 from Microsoft, which Wiz said it would donate. No CVE was reported, and no severity rating was published. A CVE is a public catalogue number given to a known security flaw so people can refer to it unambiguously; not every bug gets one.

Setup

Azure App Services and Azure Functions are Microsoft's building blocks for running web apps and small pieces of code in the cloud. They offer a login button out of the box: you tick a box, and your app suddenly has "Sign in with Microsoft" working. When an app is marked multi-tenant, any Azure AD tenant can issue a valid token for it. The platform verifies that the token is genuine; deciding whether the tenant or the user behind it belongs in your application is left to your own code.

That split is the heart of the story. Microsoft's platform does the first half ("is this token real?") and leaves the second half ("should this person be here?") to whoever built the app. If the app builder forgets the second half, the door is unlocked for the whole internet.

Wiz calls the resulting gap shared-responsibility confusion. The phrase means: two parties each assume the other one is doing a check, and nobody does it. Its scans found that roughly a quarter of multi-tenant apps were exposed this way. One of them was Bing Trivia.

The researchers signed in with a user from their own Azure AD tenant. They signed in with a user from that tenant and landed in the Bing Trivia admin panel.

Finding it

The flaw is not a broken token check. The token was valid, and Azure AD correctly vouched for the identity in it. What was missing was the second question: does this tenant, and this user, have any business being here? A multi-tenant registration answers yes to every tenant by design, and the application never added a check of its own. To the researchers, an admin panel that accepted a login from an unrelated tenant was the signal that the authorisation step had been skipped.

Two words that beginners often mix up:

  • Authentication is proving who you are. Showing a passport at the airport.
  • Authorisation is deciding what you are allowed to do once you are in. The passport does not get you into the cockpit.

This bug is an authorisation failure. Authentication worked perfectly. The app simply never asked the second question.

Exploitation

Step 1: sign in from a foreign tenant

The researchers authenticated to the Bing Trivia admin panel with a user from their own Azure AD tenant. The login succeeded and gave them the panel's administrative interface.

Why this step matters: it is the whole vulnerability in one action. If a login from an unrelated tenant succeeds and produces a working admin screen, the app has no tenant check. The researchers did not need to break anything; they used the front door as designed, and the design was wrong.

Step 2: change live content

That panel fed real Bing content. The researchers swapped one item in the carousel for a "best soundtracks" search. The change appeared on Bing.com, confirming that the admin panel writes to production search results rather than to a staging copy.

Production means the real, public version of the site that ordinary people use, as opposed to a test copy. This step showed the change appeared on the live site. The change was visible on the live site, not hidden in a back office.

Step 3: test script execution

They also ran a harmless script test through the same channel, and it executed. A harmless script test also ran, meaning a malicious edit could have executed in every searcher's browser.

Some terms here, from zero:

  • A script is a small program that a web page can run inside your browser. Legitimate pages use scripts for menus, animations and search suggestions.
  • Cross-site scripting (XSS) is when an attacker gets their own script into a page that other people visit, so it runs in their browsers. The "cross-site" part means the script crosses from the attacker's input into someone else's session.
  • Stored XSS is the worst kind: the malicious script is saved on the server (in this case, in the CMS content) and served to every visitor afterwards. It is like writing graffiti on a sign that the whole city reads, rather than shouting at one person.
  • An authentication bypass is getting in without the check that should have stopped you. Here, the bypass was the foreign-tenant login.

The researchers ran a harmless script test rather than a real attack. The point was to prove the channel existed, not to harm anyone.

Step 4: chain to Office 365 data

During disclosure, Wiz showed that such a script could obtain an Office 365 token for the visitor, exposing mail, calendar, Teams chats and files. They tested this only against their own account and reverted their edits.

A chain in security means combining several small weaknesses into one bigger attack. Wiz showed that such a script could obtain an Office 365 token for the visitor. Each link alone looks modest; together they reach a person's email and files.

Disclosure is the process of telling the vendor about a bug and agreeing when it can be made public. Wiz tested only against their own account and undid their changes, which is the responsible way to demonstrate impact without touching real users.

Root cause

The mistake is an authorisation gap in a multi-tenant Azure AD registration. Marking an app multi-tenant tells Azure AD to issue tokens to users from any tenant, and the platform only checks that the token is genuine. Whether that tenant or user should be allowed in is the application's responsibility, and Bing Trivia did not perform that check. The panel's output reached a public site, and a harmless script test ran there, so a malicious edit could have executed in searchers' browsers.

If a CMS stores <script> and the public page prints it raw, the browser runs it. If the CMS escapes it, the browser shows the literal characters and nothing happens. An admin tool that publishes to a public site is therefore an XSS source by nature.

Existing defences did not stop it because the token validation itself was working as designed: the login was legitimate from Azure AD's point of view. Nothing in the flow asked whether the tenant was on an allowlist or whether the user was assigned to the app. An allowlist is a list of things explicitly permitted; anything not on the list is refused. The app had no such list.

Wiz also found other exposed internal Microsoft apps, including an MSN newsletter panel and a file system it described as holding over 4 exabytes. An exabyte is a very large unit of data storage; the point is that the exposure was not limited to Bing.

Impact

Bing has a vast audience, so one poisoned result could reach a huge number of users. Through the stored script, an attacker could have obtained an Office 365 token for a visitor and with it access to that person's mail, calendar, Teams chats and files. The researchers demonstrated the chain only against their own account.

Microsoft said the affected apps were out of bounty scope but rewarded the Azure AD improvements the research prompted. Bounty scope is the list of systems a company has agreed to pay for; a finding outside that list can still be real and still be rewarded at the company's discretion. Wiz notes that Azure AD logs cannot show past abuse; application logs are the place to look for evidence of it. Logs are the automatic records a system keeps of who did what and when.

Fix

Microsoft fixed the issue in early 2023. The write-up does not describe the specific changes made to the Bing Trivia registration. The author's own recommendations for multi-tenant apps are:

  1. Stay single-tenant unless you truly need more. It is a settings change.
  2. Authorise after you authenticate: check the tenant ID against an allowlist, then check that the user is assigned to the app.
  3. Escape CMS output. An admin tool that publishes to a public site is an XSS source.

The author's illustrative authorisation logic, reproduced as published:

Text
ALLOWED_TENANTS = {"<your-tenant-id>"}def authorize(request):    claims = verify_token(request.bearer)              if claims is None:        return deny(401)    if claims["tid"] not in ALLOWED_TENANTS:        audit("foreign_tenant_login", claims["tid"], claims["oid"])        return deny(403, "tenant_not_allowed")    user = app_users.find(tenant=claims["tid"], object_id=claims["oid"])    if user is None or "cms_editor" not in user.roles:        return deny(403, "not_assigned")    return allow(user)

Line by line, in plain words:

  • ALLOWED_TENANTS = {"<your-tenant-id>"} sets up the allowlist: a set containing the one tenant ID that is permitted. In real code you would put your own tenant's identifier where the placeholder is.
  • def authorize(request): starts a function called authorize that takes an incoming request. A function is a named block of code that runs when called.
  • claims = verify_token(request.bearer) takes the token the caller presented (the bearer token, meaning "whoever bears this token is treated as its owner") and checks it. The result, claims, is the set of facts inside the token: who the user is, which tenant they belong to, and so on.
  • if claims is None: asks whether verification failed and returned nothing.
  • return deny(401) refuses the request with HTTP status 401, which means "not authenticated". HTTP status codes are the short numbers servers send back to describe the result; 401 is "who are you?" and 403 is "I know who you are, and no".
  • if claims["tid"] not in ALLOWED_TENANTS: checks the tenant ID (tid) inside the token against the allowlist. This is the check Bing Trivia was missing.
  • audit("foreign_tenant_login", claims["tid"], claims["oid"]) writes an audit record naming the event and the tenant and object IDs. oid is the user's object ID, a unique identifier for that account. This line is what gives defenders something to search later.
  • return deny(403, "tenant_not_allowed") refuses with 403 and a clear reason: the tenant is not on the list.
  • user = app_users.find(tenant=claims["tid"], object_id=claims["oid"]) looks the user up in the application's own user store, matching both tenant and object ID. This is the second question: even from the right tenant, is this specific person registered here?
  • if user is None or "cms_editor" not in user.roles: refuses if no such user exists, or if the user exists but lacks the cms_editor role. A role is a label that grants permissions, like "editor" or "admin".
  • return deny(403, "not_assigned") refuses with 403 and the reason "not assigned".
  • return allow(user) is reached only when the token is valid, the tenant is allowed, and the user exists with the right role. Only then is access granted.

The order matters: authenticate first, then authorise, then check the role. Each step narrows who gets through.

Variants to test

These are the same checks a defender or an authorised tester can run on their own apps. "Positive result" means the test found the weakness.

  • Foreign-tenant login on internal admin tools. Register or use an account in a different Azure AD tenant and attempt to sign in to any internal app you are authorised to test. A positive result is a successful login and a usable admin interface rather than an error page.
  • Tenant allowlist bypass. A B2B-invited user is an outside person invited into a tenant as a guest. A positive result is access granted to a tenant that should not be on the list.
  • User assignment bypass. After passing the tenant check, test a user in the right tenant who is not assigned to the app. A positive result is access without an assignment or role.
  • Stored XSS through CMS output. If an admin panel publishes to a public site, submit a harmless script marker in editable content and view the public page. A positive result is the marker executing in the public context.
  • Log coverage check. Confirm whether Azure AD sign-in logs would record a foreign-tenant login to the app, and whether the application logs it. Wiz notes Azure AD logs cannot show past abuse; application logs are the place to look.

Glossary

  • Allowlist: a list of things explicitly permitted; anything not on it is refused.
  • Authentication: proving who you are, for example by signing in.
  • Authorisation: deciding what an authenticated person is allowed to do.
  • Azure AD (Microsoft Entra ID): Microsoft's cloud service for signing users in and issuing tokens.
  • Azure App Services / Azure Functions: Microsoft's cloud building blocks for running web apps and small pieces of code.
  • B2B-invited user: an outside person invited into a tenant as a guest.
  • Bearer token: a token where whoever holds it is treated as its owner.
  • Bounty scope: the list of systems a company has agreed to pay rewards for.
  • Carousel: a sliding row of cards or suggestions on a web page.
  • Chain: combining several small weaknesses into one larger attack.
  • Claims: the facts stored inside a token, such as user and tenant identifiers.
  • CMS (content management system): a tool for creating and editing content that appears on a website.
  • Cross-site scripting (XSS): getting an attacker's script to run in other people's browsers through a website.
  • CVE: a public catalogue number for a known security flaw.
  • Disclosure: the process of reporting a bug to the vendor and agreeing when it becomes public.
  • Escaping: converting special characters so a browser shows them as text instead of running them as code.
  • Exabyte: a billion gigabytes.
  • Function: a named block of code that runs when called.
  • HTTP status codes: short numbers a server returns to describe the result, such as 401 (not authenticated) and 403 (forbidden).
  • Logs: automatic records of who did what and when.
  • Multi-tenant: willing to accept sign-ins from users in any tenant.
  • Object ID (oid): a unique identifier for a user account.
  • Production: the real, public version of a site that ordinary people use.
  • Role: a label that grants permissions, such as editor or admin.
  • Script: a small program a web page can run in your browser.
  • Shared-responsibility confusion: a gap where two parties each assume the other is doing a check, so nobody does it.
  • Single-tenant: accepting sign-ins only from one organisation's own tenant.
  • Stored XSS: XSS where the malicious script is saved on the server and served to every visitor.
  • Tenant: one organisation's separate area inside Azure AD, with its own users.
  • Tenant ID (tid): the identifier of the tenant a token belongs to.
  • Token: a string issued after login that a website can check to confirm the identity inside it.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.