Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

BTL Admin

Abusing federation and account linking

Trusting the wrong sign-in

The photo application lets customers create an account with an email address and a passkey. It also lets them sign in with accounts they already have elsewhere: a large consumer identity provider at id.example.test, a smaller social site at social.example.test, and, for business customers, their company's own identity provider. Each provider the application accepts is a door into it. Whatever a trusted provider asserts about who signed in, the application believes, as Trust across systems explains. The application can check that a message is genuine and meant for it. It cannot check whether the provider told the truth.

That makes the application only as strict as the least careful provider it trusts. Some providers let anyone create an account and type any name or email address into their profile. Some host sign-in for many organizations, so anyone can create a new organization there and become its administrator. A business partner's identity provider may be run with less care than the application's own sign-in. An attacker who controls a trusted provider, by running one, creating a tenant at one, or taking one over, can make it assert whatever they like about who signed in. At a provider that hosts many organizations, only the issuer shows which tenant is speaking, which is why Forged tokens and stolen signing keys treats accepting another tenant's issuer as a validation flaw.

A provider speaks with authority about its own users: the accounts it created and the subject identifiers it assigned. Trouble starts when an application lets a provider's statement decide which of the application's own accounts someone may enter.

Matching on the wrong attribute

The simplest form of that mistake is linking on email. A sign-in arrives from a provider with the email address of an existing photo account, and the application treats the person as that account's owner. Now look at it from the attacker's side. They sign up at a provider the application trusts, set their profile email to the victim's address, and sign in to the photo application through that provider. The provider asserts the address because the attacker typed it. The application finds an existing account with the same address, links the new sign-in to it, and opens the victim's albums.

An attacker signs up at a provider that does not verify email addresses, sets the profile email to the victim's address, alex@mail.example.test, and signs in to the photo application through that provider. The provider asserts its own issuer, a new subject, and the victim's email, which matches the victim's existing photo account. An application that links on email opens the victim's account for the attacker. An application that matches on issuer and subject finds no stored link and asks for the existing account's own sign-in first, which the attacker cannot complete. An attacker signs up at a provider that does not verify email addresses, sets the profile email to the victim's address, alex@mail.example.test, and signs in to the photo application through that provider. The provider asserts its own issuer, a new subject, and the victim's email, which matches the victim's existing photo account. An application that links on email opens the victim's account for the attacker. An application that matches on issuer and subject finds no stored link and asks for the existing account's own sign-in first, which the attacker cannot complete.
The provider's message is genuine. The only false thing in it is the email address, and an application that links on email trusts exactly that.

Email fails as a key in several ways. Some providers never verify the addresses people enter. Some verify an address once and then let the person change it without checking again. Addresses are reassigned when someone leaves a company or abandons a mailbox, and a lapsed domain can be registered by someone new, along with every address under it. Usernames, phone numbers, and display names share the weakness: they describe an account at a moment in time, and they can change hands.

The stable key is the pair of issuer and subject: the provider's identifier, and the identifier it assigned to this person and never reassigns. Trust across systems explained why both are needed. The application stores that pair on the account when a link is created and, on later sign-ins, looks the pair up and ignores the email. Creating a new link to an existing account requires the person to prove control of that account first, by signing in with its own methods, as the same lesson's section on linking accounts safely describes. Linking accounts covers the cases where even a verified email claim is not enough, and walks through a safe linking flow step by step.

The attack also leaves evidence. The victim's account gains a linked identity from an issuer it never used before, followed by sign-ins through that issuer from an unfamiliar network. A notice to the owner's existing verified address whenever a new way to sign in is linked gives them a chance to react, and the link itself belongs in the account's history.

Each sign-in below arrives at the photo application. Decide what it should do.

Simulation. These sign-ins are made up, and answering sends nothing. Each one arrives at the photo application; decide what it should do.

ITEM 1 OF 4

A sign-in arrives with an email address that matches an existing account. What should the application do?
Issuer:          https://social.example.test
Subject:         58817203
Email claim:     [email protected]
email_verified:  false
Existing match:  photo account 3307 uses [email protected]
Stored links:    none for this issuer
Show the answer and why

Link only after the person signs in to account 3307 with its passkey. A new way into an existing account needs proof from someone who already controls it. The matching email can suggest the option, but not decide it.

ITEM 2 OF 4

A returning customer signs in, and the email in the token has changed since their last visit. What should the application do?
Issuer:          https://id.example.test
Subject:         7c1e90a4
Email claim:     [email protected] (was [email protected])
Stored link:     account 5120 is linked to https://id.example.test + 7c1e90a4
Show the answer and why

Sign in to account 5120: issuer and subject match the stored link. The issuer and subject identify the link, and the provider never reassigns a subject. A changed email does not change who signed in.

ITEM 3 OF 4

A business customer's account trusts its own tenant, t-4821, at a multi-tenant provider. This sign-in arrives. What should the application do?
Issuer:          https://idp.example.test/t-9930/
Subject:         u-20417
Email claim:     [email protected]
email_verified:  true
Signature:       valid, from the provider's published key set
Business account for orchard.example.test trusts:
                 https://idp.example.test/t-4821/
Show the answer and why

Refuse it, because the issuer is not the tenant the account trusts. Anyone can create a tenant at a multi-tenant provider. Only sign-ins whose issuer is the customer's own tenant should reach its accounts.

ITEM 4 OF 4

The owner of account 3307 wants to add sign-in through id.example.test. What should the application do?
Issuer:          https://id.example.test
Subject:         3f0b6d11
Email claim:     [email protected]
email_verified:  true
Before linking:  the person signed in to account 3307 with its passkey
                 and confirmed "Link this sign-in"
Show the answer and why

Link it by issuer and subject, record the change, and notify the owner. The person proved control of both sides: the provider account through the sign-in, and account 3307 through its passkey. The notice lets the owner react if the link was not theirs.

Adding a door of your own

An attacker with administrative access to an organization's identity configuration does not need to trick a provider. They can add one. Workforce identity systems let administrators trust another identity provider, accept sign-ins for a domain from an outside source, or add a signing certificate to an existing federation trust. Each is a legitimate feature for mergers, partners, and migrations. In the wrong hands, each creates a door that signs in as any user the attacker chooses, with no password or second factor from the real person.

Claim mappings offer a quieter route. A mapping decides which attribute from a provider identifies the account, or which group grants which role. Changing it so that a value the attacker controls decides who signs in, or so that a group they belong to maps to an administrator role, turns an ordinary sign-in into a privileged one without adding anything to the list of providers.

These doors survive the usual clean-up. Resetting passwords, revoking sessions, and removing an attacker's authenticator do nothing to a trusted provider the attacker runs, which is why it is a favored way to keep access, as How attackers stay in describes. In the Cedar Inc. incident, the attacker's call to the help desk for an administrator's MFA reset was refused, but had it succeeded, they would have held exactly the access that changes like these require.

Watching trust configuration

Trust configuration decides who can sign in as whom, so changing it needs the protection given to the most privileged roles. Only a few administrators should be able to add a provider, a signing certificate, or a claim mapping. Each change should require a fresh, phishing-resistant sign-in, and adding a provider can reasonably need a second administrator's approval. Protecting privileged access describes these controls.

Every change should be recorded with who made it, from where, and the values before and after. A new provider can sign in as any user it is mapped to, and it keeps working after every password in the organization has been reset, so a security team wants to hear about one within minutes, not at the next quarterly review. Because these changes are rare, an alert on each new provider, domain, certificate, or mapping change is seldom noise.

Regular review closes the loop. Compare the trusted providers and certificates with the partnerships the organization actually has, confirm that each certificate matches what the partner publishes, and look closely at sign-ins through rarely used providers, especially into administrator accounts. Recording identity activity and Reviewing identity security posture cover how to keep those records and make the checks routine.

Try it in the Lab

PUT IT INTO PRACTICE

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

0 of 2 answered correctly

Enable JavaScript to answer these questions and save progress in this browser.

QUESTION 1 OF 2The photo application links any federated sign-in to an existing account with the same email address. How can an attacker use that?
QUESTION 2 OF 2Why alert when a new identity provider is added to an organization's sign-in configuration?

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow All", you consent to optional analytics. Cookie Policy

Learn identity