Beta

Create a tenant

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

Abusing federation and account linking

Every identity provider a service trusts is another way in, and the service believes whatever it says about who signed in. This lesson looks at how that trust is abused: a provider asserting someone else's email, an account linked on the wrong attribute, and an administrator adding a provider of their own, and then at how to match accounts safely and watch trust configuration.

Trusting the wrong sign-in

The expense service at expenses.example, which Cedar and many other organizations use, lets people 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 that freelancers and small businesses use, a smaller social site at social.example.test, and, for organizations like Cedar, their own identity provider. Each provider the service accepts is a door into it. Whatever a trusted provider asserts about who signed in, the service believes, as Trust across systems explained. The service can check that a message is genuine and meant for it. It cannot check whether the provider told the truth.

That makes the service 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 service'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 treated 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 a service lets a provider's statement decide which of its 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 expense account, and the service treats the person as that account's owner. Here is how an attacker uses that. They sign up at a provider the service trusts, set their profile email to Riley's address, [email protected], and sign in to the expense service through that provider. The provider asserts the address because the attacker typed it. The service finds Riley's account with the same address, links the new sign-in to it, and opens Riley's expense claims and the bank details they are paid to.

The provider's message is genuine. The only false thing in it is the email address, and a service 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 service 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 points out. Linking accounts covered the cases where even a verified email claim is not enough, and walked through a safe linking flow step by step.

The attack also leaves evidence. Riley'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 expense service. Decide what it should do.

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

A sign-in arrives with an email address that matches an existing account. What should the service do? 1 of 4
Issuer:          https://social.example.test
Subject:         58817203
Email claim:     [email protected]
email_verified:  false
Existing match:  expense 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.

A returning freelancer signs in, and the email in the token has changed since their last visit. What should the service do? 2 of 4
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.

Suppose Cedar signs in through its own tenant, t-4821, at a provider that hosts many organizations, and Cedar's business account at the expense service trusts that tenant. This sign-in arrives. What should the service do? 3 of 4
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 cedar.example 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 provider that hosts many organizations. Only sign-ins whose issuer is Cedar's own tenant should reach Cedar's accounts.

Riley, who owns account 3307, wants to add sign-in through Cedar's identity provider. What should the service do? 4 of 4
Issuer:          https://login.cedar.example
Subject:         usr_4182
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. Riley proved control of both sides: the Cedar account through the sign-in, and account 3307 through its passkey. The notice lets Riley react if the link was not theirs.

Adding a door through configuration

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. MITRE ATT&CK catalogues this as T1484.002, Domain or Tenant Policy Modification: Trust Modification. Adding a signing certificate to an existing trust is the administrative route to the same result as stealing the provider's own key, the Golden SAML attack in Forged tokens and stolen signing keys.

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; How attackers stay in returns to it. In Cedar's incident, the attacker's call to the help desk for an administrator's MFA reset was refused. 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 goes further into 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 take up how to keep those records and make the checks routine.

Check your understanding

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

The expense service links any federated sign-in to an existing account with the same email address. How can an attacker use that against Riley? 1 of 3
Why alert when a new identity provider is added to an organization's sign-in configuration? 2 of 3

Choose one answer.

A freelancer linked their expense account to id.example.test last year. They have since changed their email address at that provider. What should happen at their next sign-in? 3 of 3

Try it in the Lab

Try a Capture the Flag challenge

Apply this lesson against an isolated, intentionally vulnerable application. Capture a flag, explain the mistake, then repair and retest it.

  1. Trust Me, I Am Admin Difficulty 3 of 5 · About 45 minutes · API target
  2. Same Email, Different Identity Difficulty 4 of 5 · About 45 minutes · API target

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