Pre-hijacked accounts: An Empirical Study of Security Failures in User Account Creation on the Web
The paper identifies a class of account pre-hijacking attacks where an attacker acts before a victim creates an account, exploiting failures to verify ownership of an identifier such as an email address. An attacker who knows only the victim's email address could gain access to the victim's account after creation, and at least 35 of 75 popular services were found vulnerable.
Published on arxiv.org
Pre-hijacked accounts: An Empirical Study of Security Failures in User Account Creation on the Web Avinash Sudhodanan∗ Independent Researcher
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.
Context
User accounts are everywhere, and account hijacking is a well-studied problem. Most prior work looks at what happens after an account exists: CSRF against password change, session theft, IdP compromise. This paper turns the lens around and looks at the moment of account creation itself.
The complication is that many services now support two ways to create an account. The classic route has the user set a password directly with the service. The federated route has the user authenticate through an Identity Provider (IdP) via Single Sign-On (SSO), and the relying party (RP) creates the account from the attributes the IdP returns, typically the email address. Some services also let an existing account be linked to an IdP afterwards, so the user can sign in either way.
The authors define a class of attacks they call account pre-hijacking. The distinguishing feature is that the attacker acts before the victim creates or recovers the account. The attacker performs some preparatory step using an identifier belonging to the victim (usually the victim's email address), the victim later creates or recovers the account, and the attacker then gains access. Five concrete types are described, and none of them require compromising the victim's IdP account, unlike the earlier preemptive hijacking attack by Ghasemisharif et al.
The threat model is a web attacker who can access the target service and third-party IdPs, can create free and paid accounts at the target, has no administrative rights there, and knows the victim's email address and basic details (first and last name). Those details may come from a targeted relationship, from social media scraping, or from password database dumps. For some attacks the attacker can make the victim visit an attacker-controlled URL, and the resulting request may carry cookies within the SameSite policy of the browser and endpoint. The victim is assumed to have basic security awareness (no successful phishing), but to ignore notifications from services where they have no account, which prior work has shown to be realistic. Victims and services are assumed to keep software updated and to mitigate code injection and memory corruption.
Setup
The analysis is manual. The authors took the top 150 websites from the Alexa global rankings. Of these, 136 supported account creation, and 75 could be tested for at least one attack. The rest were excluded for the reasons in the table below.
| Reason | Occurrences |
|---|---|
| Similar website already tested | 21 |
| High-requirements | 17 |
| No authentication functionality | 13 |
| No email functionality | 12 |
| Language barrier | 10 |
| Service not reachable | 1 |
| Other service errors | 1 |
| Total |
Similar sites were skipped (amazon.com was tested, amazon.in was not, as a localised version). The authors note this is not a representative sample, but argue that the most popular sites spend significant effort on preventing hijacking, so the results are likely a lower bound on prevalence across all websites.
Because the victim's email address must not already be associated with an account at the start of each test, every test needed fresh accounts. For each site the authors created an account and documented which of the following features existed:
- Create an account via the federated route
- Use a custom IdP for federated account creation
- Associate a federated identity with an account
- Change the email address associated with an account
Across the top 150 they encountered 22 unique IdPs. Google was the most common (40 websites), then Facebook (32) and Apple (18). Where a site supported several IdPs, tests used the most popular one. For attacks involving email addresses they preferred Google's mail service, since the same account could also be used for federated authentication. Any site that looked vulnerable was retested with a fresh set of accounts to rule out false positives, and video recordings were made for the reports.
Disclosure went through the channels listed in the paper's table: HackerOne, Bugcrowd, security forms, security email addresses, and in some cases general support channels, Federacy or Twitter. Vendors had at least 90 days to remediate before publication, and the five case-study vendors gave permission to publish details.
On ethics: experiments stayed within accounts the authors created, no automated tooling was used that could load the sites, and the manual interaction was equivalent to a single legitimate user, which also avoided triggering bot detection.
Finding it
The starting observation is structural. A service that accepts an identifier from a new user, and lets that account be used before the identifier's ownership has been verified, has a window in which somebody else can claim the identifier first. Many services do send a confirmation code or URL to the supplied email address, but the vast majority let the user begin using the account before that verification completes.
An account's authentication attributes are the pieces of information used to authenticate the user. Some are persistent (username, password), some transient (active session identifiers). The paper calls the set of attributes and their values the state of the account. The example state for a service called FooApp is:
FooApp State: S
Username [redacted]
Email [redacted]
Password $ecret_pass619
IdPId FB-Id-User42h3
SessionId A2jkh2k2h55h2kn
PhNum 9886625631
The paper assumes throughout that the email address is the account username, which is common because email addresses are unique and easy to remember. The Email and PhNum attributes can be used to recover access: the service sends a secret capability (a code, or a URL with an embedded token) to the registered address or number, and the legitimate user uses it to authenticate and reset the password. The Password attribute covers the user-chosen secret and any other authentication secrets such as MFA keys; real services should store only a salted hash. The IdPId attribute records the identity as provided by a federated IdP, and can sometimes be added to an existing account after creation ("Connect with Facebook" and similar). The SessionId attribute covers all currently active sessions, and is transient.
Every attack follows the same three phases:
- Pre-hijack. The attacker performs a preparatory action, such as creating an account with the victim's identifier. This requires knowing the identifier, which is typically not secret. The victim must not already have an account with that identifier; the attacker can detect this cheaply because the service will say the account already exists, and there is no risk to the attacker if it does.
- Victim action. The victim creates or recovers their account using the same identifier. Ideally this is where the victim notices something, but the notification shown depends on the attack type, and observed services ranged from warnings that might tip off a security-conscious user to no notification at all.
- Attack. The attacker gains access. Some techniques cost the victim access to the account (low stealthiness), others let both parties use the account concurrently (high stealthiness).
Anticipating which services a victim will sign up for is the practical constraint. The authors suggest several ways an attacker could do it: knowing which services a specific victim uses and opportunistically pre-hijacking others; learning that an organisation such as a university department plans to adopt a service and pre-hijacking accounts for its publicly known addresses; or watching a service's popularity rise (video conferencing during forced remote work is the example given) and pre-hijacking addresses found by scraping.
Exploitation
The five attacks are summarised in the paper's attack trees. The starting state S1 is empty in every case, since the account does not yet exist.
Classic-Federated Merge Attack
This exploits the interaction between classic and federated account creation. The attacker creates an account via the classic route with the victim's email address; the victim later creates an account via the federated route; if the service merges the two, both parties end up with access.
Preconditions: the service supports both classic and federated creation, uses email addresses as unique identifiers, and allows a federated identity to be associated with an existing classic account ("IdP account connect"). Services typically implement the last part by checking that the email in the IdP assertion matches the email used at classic signup.
- Pre-hijack. The attacker creates an account with the victim's email address and an attacker-chosen password, using the email address the victim is expected to use for federated authentication. The service may send a confirmation email to the victim, who may ignore it because they have no account there.
- Victim action. The victim chooses the federated route. Since an account already exists for that address, a plausible design decision is to merge the two accounts, intentionally or not. The service may notify the victim that an account already existed. A victim who notices could reset the password, which succeeds because only they receive the reset email. A victim who ignores or never sees the notification starts using the account without resetting, and may complete a fresh email verification as expected.
- Attack. In state S8 the victim's IdP is correctly associated with the account, but the password is still the attacker's. The attacker signs in directly with that password while the victim uses SSO. The victim may not notice unless the service reports sign-in events, such as a notification or a last sign-in time.
Unexpired Session Attack
This exploits the failure to sign out existing sessions when a password is reset.
Preconditions: the service supports password reset by email, and allows multiple concurrent sessions.
- Pre-hijack. The attacker creates an account with the victim's email address, signs in, and keeps the session alive indefinitely, possibly with a script that periodically performs an action.
- Victim action. The victim tries to create an account, is blocked because one exists, assumes they made it earlier, cannot sign in with the attacker's password, and resets the password.
- Attack. If active sessions are not invalidated on reset, the state is S9: the password is known only to the victim, but the attacker's session is still valid and stays valid as long as it is maintained. The victim may not notice unless the service shows current active sessions.
A variant has the victim attempt federated creation instead, be blocked because an account exists for the address, and reset the password, after which the attack proceeds as above.
Trojan Identifier Attack
This combines the merge and unexpired-session ideas. The attacker creates the account with the victim's address, then associates their own IdP identity with it. When the victim resets the password, the attacker still gets in through federated authentication.
Preconditions: the service supports classic and federated authentication, but unlike the merge attack it need not support federated creation; it is enough that federated identities can be added to an existing account. The attacker needs an account at an IdP the service supports, and the service must offer password reset.
- Pre-hijack. The attacker creates the account with the victim's address and an attacker-chosen password, then associates their own federated identity so they can sign in by SSO or by password.
- Victim action. Account creation fails because the address is taken. The victim assumes they made the account, resets the password, and starts using it.
- Attack. In state S10 the attacker's federated identity (attackerIdPId) is still associated, so the attacker signs in via SSO. The victim does not lose access, so may not suspect anything.
Alternative identifier variant. Some services let users add an alternative identifier, such as a phone number or second email address, and reset the password or request a one-time sign-in link through it. During pre-hijack the attacker associates an attacker-controlled alternative identifier. Simple deception reduces the chance of the victim noticing: an address similar to theirs ([redacted] versus [redacted]), or one that looks like it belongs to the service ([redacted]). In the attack phase the attacker requests a password reset or one-time sign-in link through that identifier. A reset is noticeable because the victim loses access; a one-time sign-in link may keep the attacker undetected.
Unexpired Email Change Attack
This exploits email-change capability URLs that are not invalidated by a password reset.
Preconditions: the service allows changing the account email, verifies ownership of the new address by sending a capability (link or code), and that capability has a reasonably long validity period, such as days.
- Pre-hijack. The attacker creates the account with the victim's address, starts changing the email to the attacker's own address, and does not confirm. The account remains associated with the victim's address, state S6.
- Victim action. Account creation fails, the victim resets the password (possible because the account is still primarily on their address), and uses the account.
- Attack. Later, the attacker confirms the pending change with the capability from the pre-hijack phase, reaching state S11. They then reset the password to an attacker-chosen value. The victim loses access, which lowers stealthiness, but if the service supports one-time sign-in links by email, the attacker can use one of those instead and the victim keeps using the account.
CSRF variant. Some services sign the attacker out when the victim resets the password, and require a signed-in user to visit the email-change capability URL. In that case the attacker can forge a request to the URL by making the victim visit it while logged in to the recovered account, for example through CSRF or clickbait. If the URL requires an action such as entering a confirmation code, this variant does not work.
Non-verifying IdP Attack
This is the mirror image of the merge attack: the attacker creates the account through the federated route and the victim through the classic route. The attacker uses an IdP that does not verify ownership of an email address when creating a federated identity.
Preconditions: the service supports classic and federated creation and sign-in, and supports at least one non-verifying IdP, or lets users integrate their own custom IdPs (more common for business accounts, where an organisation's IdP is used). Cloud IdP services such as OneLogin and Okta make this easy; the authors found these IdPs did not perform email verification for test accounts, yet those accounts could still be used as federated identities at other services.
- Pre-hijack. The attacker creates a federated identity at the non-verifying IdP using the victim's email address, then uses it and the custom IdP feature to create an account at the target with the victim's address. A service that performed its own verification of addresses on federated identities would block this, but some assume the IdP did it, possibly to reduce friction.
- Victim action. The victim creates an account via the classic route. Because one already exists for the address, the service may simply combine them, as in the merge attack, and the victim uses what they think is a new account.
- Attack. In state S12 the attacker's federated identity is still associated, so the attacker signs in through the non-verifying IdP. The IdP's lack of verification may be intentional (a business decision) or not. A previously discovered and now fixed vulnerability in widely used IdPs allowed accounts to be created with victims' addresses, and similar techniques could be repurposed for pre-hijacking. The attack works equally well with a malicious IdP; Mainka et al. studied malicious IdPs but did not consider this use.
Federated-Federated variant. The victim creates the account through the federated route instead. This works only if the service allows more than one IdP on a single account. In state S13 both identities are associated, and the attacker signs in via SSO while the victim uses their own IdP.
Email Verification Trick
When a service requires verification of the supplied address, the attacker can sometimes get around it through the change-of-email feature. The attacker creates an account with an identifier they control (state S4), verifies it, then changes the primary email to the victim's address (state S7). If the service does not verify again at that point, or associates the victim's address before verification, the attacker is back in position to run any of the attacks above, for example the merge attack ending in state S14.
Root cause
The root cause is that the service or IdP fails to verify that the user actually owns the supplied identifier before allowing the account to be used. Many services do verify, by sending a confirmation code or URL, but most allow the account to be used before verification completes, which opens the window. The attacks also depend on specific design choices: merging classic and federated accounts by email address, keeping sessions alive across a password reset, keeping federated identities attached after a reset, and letting email-change capabilities outlive a password reset. The paper presents a set of defence-in-depth security requirements for account creation that would have mitigated all the vulnerabilities found.
Impact
The impact is the same as account hijacking. Depending on the service, the attacker can read or modify sensitive information (messages, billing statements, usage history) or act as the victim (send spoofed messages, make purchases with saved payment methods). The case studies give concrete examples: on Dropbox, access to private files and sign-in to other services where Dropbox is the IdP; on Instagram, access to photos and videos shared by the victim and their network, sign-in to other services where Instagram is the IdP, reading chats, and impersonation.
Across the 75 tested services, at least 35 were vulnerable to one or more attacks, including widely used cloud storage, social and professional networking, blogging, and video conferencing services. The per-attack numbers are:
| Attack | Potentially vulnerable | Vulnerable |
|---|---|---|
| Classic-Federated Merge | 54 | 13 |
| Unexpired Session | 74 | 19 |
| Trojan Identifier | 49 | 12 |
| Unexpired Email Change | 72 | 11 |
| Non-verifying IdP | 3 | 1 |
| Total |
At least 56 individual vulnerabilities were identified. The Unexpired Session attack had the most potentially vulnerable services, as expected given its minimal requirements. Some services not vulnerable to the merge attack were still vulnerable to a variant of the unexpired session attack after the former was blocked, but these were left out of the table to avoid double counting. Similar numbers of services were vulnerable to the merge, Trojan identifier, and unexpired email change attacks once the email verification trick is included, but the same service is not usually vulnerable to all three. The non-verifying IdP attack was far less prevalent because it needs user-specified IdPs, and the authors expect their figure is an under-approximation since some services may offer that only on premium plans that were not always tested. The results were conservative lower bounds at the time of testing, and the authors hope the number has fallen since disclosure.
Some attacks are noticeable to attentive users, others are completely undetectable from the victim's perspective. The paper reports that its reports have already been acknowledged as being of high severity by a major video conferencing service.
Fix
The paper does not describe specific vendor fixes. It states the root cause as failure to verify identifier ownership before allowing account use, and presents a set of defence-in-depth security requirements for account creation and management that would have mitigated all the vulnerabilities identified. It also notes that requiring verification may not be immediately practicable for all services, which is why the defence-in-depth requirements are offered alongside.
Variants to test
- Merge by email. Create a classic account with a test address, then sign in through a federated IdP returning the same address. Positive result: the two are combined and the original password still works alongside SSO.
- Session survival. Create an account, keep a session active, reset the password from another session, then reuse the first session. Positive result: the old session still accesses the account.
- Federated identity survival. Create an account, attach an IdP identity, reset the password, then sign in via the IdP. Positive result: SSO still reaches the account.
- Alternative identifier. Add a second email address or phone number to an account, reset the password, then request a one-time sign-in link to the alternative identifier. Positive result: the link arrives and signs in.
- Pending email change. Start an email change, do not confirm, reset the password, then use the confirmation capability. Positive result: the change still completes and the new address controls the account.
- Non-verifying IdP. Register a test account at a cloud IdP without verifying the address, then use it as a custom IdP at the target with an address you do not own. Positive result: the target creates or links an account for that address.
- Verification bypass by email change. Create and verify an account with an address you control, change the primary email to an address you do not control, and check whether a new verification is required. Positive result: the unverified address becomes primary or is associated before verification.
Case studies
Dropbox
Dropbox was vulnerable to a variant of the Unexpired Email Change Attack. The attacker creates an account with the victim's address; Dropbox emails the victim to confirm, and the victim may ignore it because it gives no instructions for someone who did not sign up. The attacker starts changing the email to their own address and Dropbox sends a confirmation email to the attacker (transition S2 to S6), containing a URL the attacker does not yet use. When the victim tries to create an account, it fails because the address is taken, and Dropbox asks them to sign in; the victim uses email-based recovery and sets a new password, which locks the attacker out. Alert victims might notice the pending email change in the UI and cancel it, but some will not. Later the attacker can make the victim visit the confirmation URL, for example through CSRF, which associates the attacker's address with the account. The attacker then uses email-based password reset to get in. Observant victims might notice the attacker's address shown as pending confirmation and remove it, which blocks the attack. The authors could not test the validity period of the confirmation URL, and the email did not state one; that period limits the attack window. Reported via HackerOne in June 2021.
During the same experiments the authors found a session fixation attack against Dropbox that lets an attacker sign in to an existing account by fixing the session ID. It was marked as a duplicate of a concurrent report whose details were not yet public.
Instagram was vulnerable to the Trojan Identifier Attack, alternative identifier variant. Identifier verification is mandatory at signup, but the attacker could create an account with their own phone number and associate the victim's email address, which sends a verification email the victim may ignore. When the victim tries to sign up with their address, an account already exists, which they might misread as related to the Facebook acquisition if they already have a Facebook account on that address. The victim recovers the account and uses it. The attacker then signs in by requesting a one-time sign-in link to their phone number. The attack is thwarted if the victim notices and removes the attacker's phone number. Reported in July 2021; Instagram noted that its verification emails include a link to report suspicious signups, and that users are responsible for looking for Trojan identifiers in their profile. The authors question how many victims would act, citing prior work showing user-initiated security decisions to be ineffective.
LinkedIn was potentially vulnerable to the Unexpired Session Attack and a variant of the Trojan Identifier Attack. For the session attack, LinkedIn did not by default invalidate active sessions after a password change; an option to do so was shown during the change but was not selected by default, so a victim who left it unselected stayed exposed. The attack could also be performed using the email verification trick.
What happened, in plain words
Imagine you want to open a bank account, but before you get round to it, a stranger walks in and opens one in your name. They pick the password. You have no idea. Later you turn up, the bank says "you already have an account", you reset the password, and you start using it. The stranger still has their own way in, because they set something up before you arrived.
That is the idea behind this research. The authors looked at how websites let people create accounts, and found a whole family of tricks where an attacker does something before the victim signs up. They call these account pre-hijacking attacks. "Pre" because the attacker acts first; "hijacking" because the end result is taking over someone else's account.
Most security research looks at what happens once an account exists: stealing passwords, hijacking sessions, breaking into the login provider. This paper looks at the moment of creation, which turns out to be surprisingly messy. The reason it is messy is that many websites now offer two ways to sign up:
- The classic route: you type an email address and choose a password directly with the website.
- The federated route: you click "Sign in with Google" (or Facebook, or Microsoft), and that company vouches for who you are. The website then creates your account from the details Google sends, usually your email address.
Some websites also let you attach a Google or Facebook login to an account you already made with a password, so you can sign in either way afterwards.
The attacker in this story needs to know your email address and basic details such as your first and last name. That is not secret: it is on your business card, in your social media profile, in leaked databases. With that one piece of information, the authors describe five different ways to set a trap before you sign up. None of them require breaking into your Google or Facebook account.
They then tested 75 popular websites and found that at least 35 of them were open to one or more of these tricks. Some of the tricks are visible to a careful user. Others leave no trace at all.
The people and the setup
The research is by Avinash Sudhodanan, an independent researcher, and Andrew Paverd of the Microsoft Security Response Center. Sudhodanan's work was supported by a research grant from MSRC. It was published on 20 May 2022 as a paper on arXiv, a public archive where researchers post preprints (drafts of papers before or alongside formal publication).
Before we go further, a few everyday comparisons will help.
- An Identity Provider (IdP) is like a passport office. Google, Facebook and Microsoft issue "passports" (accounts) that other places trust. When a website says "Sign in with Google", it is asking Google to confirm you are who you say you are.
- A relying party (RP) is the website that trusts the passport. It does not check your identity itself; it relies on the IdP.
- Single Sign-On (SSO) is the convenience of using one passport in many places. You log in to Google once, and dozens of websites accept that login.
- A session is what happens after you log in: the website gives your browser a small badge (a cookie) so it remembers you on the next page. If you close the browser and come back and you are still logged in, that is a session that has not expired.
- A cookie is a tiny piece of text your browser stores for a website and sends back with every request. It is how the website recognises you between pages.
- A token is a similar idea: a string of characters that proves something, like a ticket. A password reset link with a long random string in it is a token.
- CSRF (Cross-Site Request Forgery) is a trick where an attacker makes your browser send a request to a website you are logged in to, without you meaning to. It is like someone handing you a signed cheque and asking you to post it for them.
The threat model: who the attacker is
The authors are careful about what the attacker can and cannot do. This matters because a security finding is only as strong as its assumptions.
The attacker:
- can browse the target website and third-party IdPs like Google, Facebook and Microsoft;
- can create free and paid accounts at the target website, but has no admin rights there;
- can create accounts at one or more IdPs and use them with the target;
- if the target supports custom IdP integration, can pick any publicly available identity service (the paper names OneLogin as an example);
- knows the victim's email address and basic details such as first and last name. In a targeted attack they already know these; in an untargeted attack they might scrape them from social media or find them in password database dumps;
- for some attacks, can make the victim visit a URL the attacker controls, for example through clickbait. The resulting request from the victim's browser may carry cookies, within the limits of the browser's SameSite policy (a rule about when cookies are sent with cross-site requests).
The victim:
- has at least basic security awareness, so phishing will not work;
- ignores notifications from services where they do not have an account. The authors say prior work has shown this is realistic.
Both victims and services are assumed to keep software updated and to defend against code injection and memory corruption, so the attacker is not exploiting bugs in the browser or operating system.
The three phases of every attack
Every pre-hijacking attack follows the same shape. The authors lay it out as three phases.
- Pre-hijack. The attacker does something first, usually creating an account at the target website using the victim's email address. This requires knowing the email address, which is not secret. The victim must not already have an account with that address; the attacker can check cheaply because the website will say the account already exists. If it does, the attacker simply moves on. There is no risk.
- Victim action. The victim creates or recovers their account using the same email address. Ideally this is where the victim notices something is wrong, but whether they get a warning depends on the attack and the website. The authors saw everything from helpful warnings to complete silence.
- Attack. The attacker gets in. Some methods lock the victim out (the authors call this low stealthiness, meaning it is noticeable). Others let both parties use the account at the same time (high stealthiness, meaning the victim may never know).
The practical difficulty for the attacker is guessing which websites the victim will sign up for. The authors suggest several ways:
- If the attacker already knows which services a specific victim uses, they can opportunistically pre-hijack accounts at other services the victim is likely to try.
- If the attacker learns that a whole organisation, such as a university department, plans to adopt a service, they can pre-hijack accounts for every publicly known email address at that organisation.
- If a service suddenly becomes popular (the paper's example is video conferencing when people were forced to work from home), the attacker can pre-hijack accounts for email addresses found by scraping websites.
The account state: what a website remembers about you
To explain the attacks, the paper introduces a way of describing an account. An account has several authentication attributes: pieces of information the website uses to check who you are. Some are permanent (your username, your password). Some are temporary (the list of sessions that are currently logged in). The set of all these attributes and their values at a given moment is called the state of the account.
The paper's example is a fictional service called FooApp:
FooApp State: S
Username [redacted]
Email [redacted]
Password $ecret_pass619
IdPId FB-Id-User42h3
SessionId A2jkh2k2h55h2kn
PhNum 9886625631
Line by line:
FooApp State: Sgives this snapshot a name, S, so the paper can refer to it later.Username [redacted]is the name the user logs in with. The paper assumes throughout that the email address is the username, because email addresses are unique and easy to remember.Email [redacted]is the address the website uses to contact the user, and to send password reset messages.Password $ecret_pass619is the secret the user chose. Real websites should store only a scrambled version (a salted hash), not the password itself.IdPId FB-Id-User42h3records the user's identity at a federated provider, here Facebook. It is how the website knows which Facebook account belongs to this user.SessionId A2jkh2k2h55h2knis the identifier of a currently logged-in session. If the user is logged in on a phone and a laptop, there would be two of these.PhNum 9886625631is a phone number, which can also be used to recover the account.
The Email and PhNum attributes matter because they are recovery channels. If you forget your password, the website sends a secret capability (a code, or a link containing a token) to your email or phone. Whoever can read that message can reset the password. This is why an attacker who can add their own email or phone to your account has a way back in.
The IdPId attribute can sometimes be added to an existing account after it is created. That is the "Connect with Facebook" button you may have seen. The SessionId attribute is temporary: sessions end when you sign out or after a period of inactivity.
The five attacks
The paper draws attack trees showing each attack as a sequence of states. The starting state, S1, is always empty because the account does not exist yet.
1. Classic-Federated Merge Attack
This one exploits what happens when a website supports both signup routes and decides to combine accounts that share an email address.
What the website needs to allow: both classic and federated signup, email addresses as unique identifiers, and attaching a federated identity to an existing password account. Websites usually do the last part by checking that the email in the Google or Facebook assertion matches the email used at signup.
- Pre-hijack. The attacker signs up the classic way using the victim's email address and a password the attacker chooses. The website may send a confirmation email to the victim. The victim may ignore it, because they have no account there.
- Victim action. The victim later decides to sign up, and chooses "Sign in with Google". Since an account already exists for that email address, the website may merge the two, on purpose or by accident. It may tell the victim an account already existed. A careful victim could reset the password, which works because only they receive the reset email. A victim who ignores the message, or never sees one, starts using the account without resetting.
- Attack. The account now has the victim's Google identity attached, but the password is still the attacker's. The attacker signs in with that password while the victim uses Google. The victim may not notice unless the website reports sign-in events, for example by email or by showing the last sign-in time.
2. Unexpired Session Attack
This one exploits websites that do not log out existing sessions when a password is reset.
What the website needs to allow: password reset by email, and more than one session at a time.
- Pre-hijack. The attacker creates an account with the victim's email address, signs in, and keeps the session alive indefinitely. Depending on the website, this can be automated with a script that performs some action periodically, like a person tapping a button every few minutes to stay logged in.
- Victim action. The victim tries to sign up, is told an account already exists, assumes they made it earlier, cannot log in because they do not know the attacker's password, and resets the password.
- Attack. If the website does not cancel active sessions when the password is reset, the attacker's session is still valid. The password is now known only to the victim, but the attacker is still logged in and stays logged in as long as the session is kept alive. The victim may not notice unless the website shows a list of active sessions.
A variant: the victim tries the federated route instead, is blocked because an account exists for the address, resets the password, and the attack proceeds as above.
3. Trojan Identifier Attack
This one combines the merge idea with the session idea. The attacker creates the account with the victim's address, then attaches their own Google or Facebook identity to it. When the victim resets the password, the attacker still gets in through the federated route.
A Trojan identifier is the name the authors give to an identifier (an email address, a phone number, a federated identity) that the attacker has quietly attached to the account, hidden in plain sight. Like the Trojan horse, it looks harmless until it is used.
What the website needs to allow: classic and federated sign-in. Unlike the merge attack, it does not need to allow federated signup; it is enough that a federated identity can be added to an existing account. The attacker needs an account at an IdP the website supports, and the website must offer password reset.
- Pre-hijack. The attacker creates the account with the victim's address and a password of their choosing, then attaches their own federated identity. Now the attacker can sign in either by SSO or by password.
- Victim action. Signup fails because the address is taken. The victim assumes they made the account, resets the password, and starts using it.
- Attack. The attacker's federated identity is still attached, so the attacker signs in through SSO. The victim does not lose access, so they may not suspect anything.
Alternative identifier variant. Some websites let you add a second email address or a phone number, and let you reset the password or request a one-time sign-in link through it. During pre-hijack the attacker adds an identifier they control. To reduce the chance the victim notices, the attacker can choose something that looks similar: [redacted] versus [redacted] (one letter missing), or something that looks like it belongs to the website, such as [redacted]. In the attack phase the attacker requests a password reset or a one-time sign-in link through that identifier. A reset is noticeable because the victim loses access. A one-time sign-in link may keep the attacker undetected.
4. Unexpired Email Change Attack
This one exploits email-change confirmation links that stay valid after a password reset.
What the website needs to allow: changing the account email, verifying the new address by sending a link or code, and letting that link or code stay valid for a reasonably long time, such as days.
- Pre-hijack. The attacker creates the account with the victim's address, starts changing the email to the attacker's own address, and does not confirm. The account is still associated with the victim's address.
- Victim action. Signup fails, the victim resets the password (possible because the account is still on their address), and uses the account.
- Attack. Later, the attacker confirms the pending change using the link from the pre-hijack phase. The account's email is now the attacker's. The attacker then resets the password to a value they choose. The victim loses access, which makes the attack noticeable. But if the website supports one-time sign-in links by email, the attacker can use one of those instead, and the victim keeps using the account without knowing.
CSRF variant. Some websites log the attacker out when the victim resets the password, and require a logged-in user to visit the email-change confirmation link. In that case the attacker can forge a request to the link by making the victim visit it while logged in to the recovered account, for example through CSRF or clickbait. If the link requires an action such as typing a confirmation code, this variant does not work.
5. Non-verifying IdP Attack
This is the mirror image of the merge attack. The attacker creates the account through the federated route and the victim through the classic route. The attacker uses an IdP that does not check whether you own the email address you sign up with. The authors call this a non-verifying IdP.
What the website needs to allow: classic and federated signup and sign-in, and at least one non-verifying IdP, or the ability for users to plug in their own custom IdP. Custom IdPs are more common for business accounts, where an organisation's own login system is used. Cloud IdP services such as OneLogin and Okta make this easy. The paper found these IdPs did not verify email addresses for test accounts, yet those accounts could still be used as federated identities at other websites.
- Pre-hijack. The attacker creates a federated identity at the non-verifying IdP using the victim's email address, then uses it and the custom IdP feature to create an account at the target with the victim's address. A website that checked the address itself would block this, but some assume the IdP already did, possibly to reduce friction for users.
- Victim action. The victim creates an account the classic way. Because one already exists for the address, the website may simply combine them, as in the merge attack. The victim uses what they think is a new account.
- Attack. The attacker's federated identity is still attached, so the attacker signs in through the non-verifying IdP. The IdP's lack of verification may be intentional (a business decision) or not. A previously discovered and now fixed vulnerability in widely used IdPs allowed accounts to be created with victims' addresses, and similar techniques could be reused for pre-hijacking. The attack works equally well with a malicious IdP. Mainka et al. studied malicious IdPs but did not consider this use.
Federated-Federated variant. The victim creates the account through the federated route instead. This works only if the website allows more than one IdP on a single account. Both identities end up attached, and the attacker signs in via SSO while the victim uses their own IdP.
The Email Verification Trick
When a website requires you to verify your email address, the attacker can sometimes get around it using the change-of-email feature.
The attacker creates an account with an address they control, verifies it, then changes the primary email to the victim's address. If the website does not verify again at that point, or attaches the victim's address before verification, the attacker is back in position to run any of the attacks above. For example, the merge attack, ending with both identities on the account.
How the testing was done
The authors did not use automated tools. They did it by hand, like a curious user would, because that gives the most accurate picture of what an attacker would see.
They started with the top 150 websites from the Alexa global rankings (a list of the most visited sites). Of these, 136 supported account creation, and 75 could be tested for at least one attack. The rest were excluded for the reasons in the table below.
| Reason | Occurrences |
|---|---|
| Similar website already tested | 21 |
| High-requirements | 17 |
| No authentication functionality | 13 |
| No email functionality | 12 |
| Language barrier | 10 |
| Service not reachable | 1 |
| Other service errors | 1 |
| Total |
"High-requirements" means the website asked for something the authors could not easily provide, such as a phone number in a specific country. Similar sites were skipped: amazon.com was tested, amazon.in was not, because it is a localised version of the same thing.
The authors note this is not a representative sample of all websites. But they argue that the most popular sites spend significant effort on preventing hijacking, so the results are likely a lower bound on how common these problems are across the whole web.
Because the victim's email address must not already be associated with an account at the start of each test, every test needed fresh accounts. For each site the authors created an account and documented which of the following features existed:
- Create an account via the federated route
- Use a custom IdP for federated account creation
- Associate a federated identity with an account
- Change the email address associated with an account
Across the top 150 they encountered 22 unique IdPs. Google was the most common (40 websites), then Facebook (32) and Apple (18). Where a site supported several IdPs, tests used the most popular one. For attacks involving email addresses they preferred Google's mail service, since the same account could also be used for federated authentication. Any site that looked vulnerable was retested with a fresh set of accounts to rule out false positives, and video recordings were made for the reports.
Disclosure went through whatever channel each vendor offered: HackerOne, Bugcrowd, dedicated security forms, security email addresses, and in some cases general support channels or Twitter. Vendors had at least 90 days to fix the problems before publication, and the five case-study vendors gave permission to publish details.
On ethics: experiments stayed within accounts the authors created, no automated tooling was used that could load the sites, and the manual interaction was equivalent to a single legitimate user. That also avoided triggering bot detection.
What they found
At least 35 of the 75 tested websites were vulnerable to one or more attacks, including widely used cloud storage, social and professional networking, blogging, and video conferencing services. The per-attack numbers are:
| Attack | Potentially vulnerable | Vulnerable |
|---|---|---|
| Classic-Federated Merge | 54 | 13 |
| Unexpired Session | 74 | 19 |
| Trojan Identifier | 49 | 12 |
| Unexpired Email Change | 72 | 11 |
| Non-verifying IdP | 3 | 1 |
| Total |
"Potentially vulnerable" means the website had the features needed for that attack. "Vulnerable" means the attack actually worked. At least 56 individual vulnerabilities were identified across all attack types and services.
The Unexpired Session attack had the most potentially vulnerable services, as expected given its minimal requirements: it does not need federated login and applies to any website that uses sessions. Some services not vulnerable to the merge attack were still vulnerable to a variant of the unexpired session attack after the former was blocked, but these were left out of the table to avoid double counting. Similar numbers of services were vulnerable to the merge, Trojan identifier, and unexpired email change attacks once the email verification trick is included, but the same service is not usually vulnerable to all three. The non-verifying IdP attack was far less prevalent because it needs user-specified IdPs, and the authors expect their figure is an under-approximation since some services may offer that only on premium plans that were not always tested. The results were conservative lower bounds at the time of testing, and the authors hope the number has fallen since disclosure.
Some attacks are noticeable to attentive users. Others are completely undetectable from the victim's perspective. The paper reports that its reports have already been acknowledged as being of high severity by a major video conferencing service.
The root cause
The root cause is that the website or IdP fails to verify that the user actually owns the identifier before allowing the account to be used. Many websites do verify, by sending a confirmation code or link. But most allow the account to be used before verification completes, which opens the window.
The attacks also depend on specific design choices:
- merging classic and federated accounts by email address;
- keeping sessions alive across a password reset;
- keeping federated identities attached after a reset;
- letting email-change links outlive a password reset.
The paper presents a set of defence-in-depth security requirements for account creation that would have mitigated all the vulnerabilities found. Defence in depth means layering several protections so that if one fails, another still holds.
The impact
The impact is the same as account hijacking. Depending on the service, the attacker can read or modify sensitive information (messages, billing statements, usage history) or act as the victim (send spoofed messages, make purchases with saved payment methods).
The case studies give concrete examples. On Dropbox, access to private files and sign-in to other services where Dropbox is the IdP. On Instagram, access to photos and videos shared by the victim and their network, sign-in to other services where Instagram is the IdP, reading chats, and impersonation.
The case studies
Dropbox
Dropbox was vulnerable to a variant of the Unexpired Email Change Attack.
The attacker creates an account with the victim's address. Dropbox emails the victim to confirm, and the victim may ignore it because it gives no instructions for someone who did not sign up. The attacker starts changing the email to their own address, and Dropbox sends a confirmation email to the attacker, containing a link the attacker does not yet use. When the victim tries to create an account, it fails because the address is taken, and Dropbox asks them to sign in. The victim uses email-based recovery and sets a new password, which locks the attacker out. Alert victims might notice the pending email change in the interface and cancel it, but some will not. Later the attacker can make the victim visit the confirmation link, for example through CSRF, which attaches the attacker's address to the account. The attacker then uses email-based password reset to get in.
Observant victims might notice the attacker's address shown as pending confirmation and remove it, which blocks the attack. The authors could not test how long the confirmation link stays valid, and the email did not state a period. That period limits the attack window. Reported via HackerOne in June 2021.
During the same experiments the authors found a session fixation attack against Dropbox that lets an attacker sign in to an existing account by fixing the session ID. It was marked as a duplicate of a concurrent report whose details were not yet public.
Instagram was vulnerable to the Trojan Identifier Attack, alternative identifier variant.
Identifier verification is mandatory at signup, but the attacker could create an account with their own phone number and attach the victim's email address. That sends a verification email the victim may ignore. When the victim tries to sign up with their address, an account already exists, which they might misread as related to the Facebook acquisition if they already have a Facebook account on that address. The victim recovers the account and uses it. The attacker then signs in by requesting a one-time sign-in link to their phone number. The attack is thwarted if the victim notices and removes the attacker's phone number.
Reported in July 2021. Instagram noted that its verification emails include a link to report suspicious signups, and that users are responsible for looking for Trojan identifiers in their profile. The authors question how many victims would act, citing prior work showing user-initiated security decisions to be ineffective.
LinkedIn was potentially vulnerable to the Unexpired Session Attack and a variant of the Trojan Identifier Attack.
For the session attack, LinkedIn did not by default invalidate active sessions after a password change. An option to do so was shown during the change but was not selected by default, so a victim who left it unselected stayed exposed. The attack could also be performed using the email verification trick.
How to check for these problems yourself
If you run a website, or you are curious about one you use, here are the checks the authors describe. Each one is a small experiment you can do with test accounts.
- Merge by email. Create a classic account with a test address, then sign in through a federated IdP returning the same address. Positive result: the two are combined and the original password still works alongside SSO.
- Session survival. Create an account, keep a session active, reset the password from another session, then reuse the first session. Positive result: the old session still accesses the account.
- Federated identity survival. Create an account, attach an IdP identity, reset the password, then sign in via the IdP. Positive result: SSO still reaches the account.
- Alternative identifier. Add a second email address or phone number to an account, reset the password, then request a one-time sign-in link to the alternative identifier. Positive result: the link arrives and signs in.
- Pending email change. Start an email change, do not confirm, reset the password, then use the confirmation link. Positive result: the change still completes and the new address controls the account.
- Non-verifying IdP. Register a test account at a cloud IdP without verifying the address, then use it as a custom IdP at the target with an address you do not own. Positive result: the target creates or links an account for that address.
- Verification bypass by email change. Create and verify an account with an address you control, change the primary email to an address you do not control, and check whether a new verification is required. Positive result: the unverified address becomes primary or is attached before verification.
What the paper does not cover
The paper does not describe specific vendor fixes. It states the root cause as failure to verify identifier ownership before allowing account use, and presents a set of defence-in-depth security requirements for account creation and management that would have mitigated all the vulnerabilities identified. It also notes that requiring verification may not be immediately practicable for all services, which is why the defence-in-depth requirements are offered alongside.
Glossary
- Account pre-hijacking: a class of attacks where the attacker acts before the victim creates or recovers an account, so that they can get in afterwards.
- Account hijacking: gaining unauthorised access to someone else's account.
- Authentication attribute: a piece of information a website uses to check who you are, such as a password, an email address, a phone number, or a session identifier.
- State (of an account): the set of all authentication attributes and their current values at a given moment.
- Classic route: creating an account by setting a password directly with the website.
- Federated route: creating an account by signing in through an Identity Provider such as Google or Facebook.
- Identity Provider (IdP): a service that vouches for who you are, like a passport office. Google, Facebook and Microsoft are common examples.
- Relying party (RP): a website that trusts an IdP to confirm your identity.
- Single Sign-On (SSO): using one login at an IdP to sign in to many websites.
- Session: the period after you log in during which the website remembers you, usually via a cookie.
- Cookie: a small piece of text a browser stores for a website and sends back with each request, so the website can recognise you.
- Token: a string of characters that proves something, like a ticket. Password reset links often contain one.
- CSRF (Cross-Site Request Forgery): a trick where an attacker makes your browser send a request to a website you are logged in to, without you meaning to.
- SameSite policy: a browser rule about when cookies are sent with requests that come from another website.
- IdP account connect: the feature that lets you attach a federated identity to an existing password account.
- Trojan identifier: an identifier (email address, phone number, federated identity) that an attacker has quietly attached to an account, hidden in plain sight.
- Non-verifying IdP: an IdP that does not check whether you own the email address you sign up with.
- Capability URL: a link containing a secret token that grants access or confirms an action when visited.
- One-time sign-in link: a link sent by email or text that logs you in without a password, usually valid once.
- Password reset: the process of setting a new password, usually by receiving a link or code at your registered email or phone.
- Salted hash: a scrambled form of a password that websites should store instead of the password itself, so that a database leak does not reveal the passwords.
- MFA (Multi-Factor Authentication): logging in with more than one proof, such as a password plus a code from your phone.
- Session fixation: an attack where the attacker sets or knows your session identifier in advance, so they can take over the session.
- Stealthiness: how hard an attack is for the victim to notice. Low stealthiness means the victim loses access and notices; high stealthiness means both parties use the account without the victim knowing.
- Defence in depth: layering several protections so that if one fails, another still holds.
- False positive: a test result that looks like a problem but is not, often because of a mistake in the test.
- Bot detection: systems websites use to spot automated traffic and block it.
- Alexa global rankings: a list of the most visited websites, used here to pick popular targets.
- arXiv: a public archive where researchers post preprints of papers.
- HackerOne, Bugcrowd: platforms where security researchers report vulnerabilities to companies, often for a reward (a bug bounty).
- Bug bounty: a reward a company pays to someone who reports a security problem to them.
- Responsible disclosure: telling a company about a security problem privately and giving them time to fix it before making it public.
- Preprint: a version of a research paper shared before or alongside formal publication.