Skip to content
Account takeover Disclosed report Advanced

Ability to DOS any organization's SSO and open up the door to account takeovers

An attacker could create a SAML identity provider entity ID that matches a victim's entity ID but with a trailing space, causing the application to prioritise the attacker's organisation when provisioning users. This allowed denial of service against the victim's SSO and, after the victim user was removed, provisioning into the attacker's organisation, potentially leading to account takeover.

cache-money Follow

Originally disclosed on HackerOne

Bounty$10,500 High View original
  • Triaged in 7 hours
  • Fixed in 25 hours
  • Paid in 7 hours
  • Disclosed after 7 months

Summary by the program

The vulnerability was fixed before SSO became available to Grammarly customers.

The report

Summary: There's an interesting issue I've spent quite a few days trying to escalate but can't figure out. The impact at this point is that I can DOS any SSO integration making it so nobody in that organization can login. I can also get users to inadvertently SSO into my attacker organization, and then take over their account from there. For existing accounts this would require a victim to click "join", however I think that's likely given the fact that they are SSOing for the first time expecting to join an organization.

The strange behavior and why I think it might be possible to escalate further, is that I can have you authenticate against one SSO instance, but have you get added to a completely separate one. So that means there is some sketchy logic which can potentially allow an attacker to authenticate against their own SSO instance, and get added to someone else's organization. I'm not sure if it's possible to get this with zero user interaction, but I will keep trying and update the report if I figure out a way.

The bug stems from the fact that you can create an entityId identical to that of another organization except with a space at the end. The application logic then prioritizes that new entityId to add the user to after authenticating against the correct one. So if you have myentity as the legitimate entity, and an attacker sets their entity to myentity[SPACE] (with a space at the end); users attempting to authenticate into the legitimate myentity will technically authenticate against it, but then the application attempts to log them into the attacker's organization. The result of this is a DOS since legitimate users can no longer access their organization. The interesting part of the bug is that if the user is deleted from their original organization (or a new user attempts to SSO), they will then be authenticating against their original organization, but get added into the attacker's organization. So it seems the SAML Response is checked against a trim(issuer), but when trying to place the user into an organization, the entity with the space is always prioritized.

The steps below will demonstrate this behavior:

Steps To Reproduce:

  1. Setup SSO and confirm you can login.
  2. Create a new Grammarly business account and use the same entityId (Identity Provider Issuer) you used in step 1, except add a space to the end of it. Use a different keypair for this organization as well.
  3. Wait 2 minutes for the change to propagate, then try logging into the same account from step 1, and notice you now get an error.
  4. At this point the victim organization is DOS'd. To confirm the strange behavior discussed above, you can delete that user from the victim organization and attempt to login again. Notice you will now end up getting provisioned to the attacker's organization, even though you signed the SAML Response with the victim organization's private key.
  5. Once you are provisioned into the attacker's organization, the attacker can then change their entityId to something brand new, and login to the victim's account using the keypair they own. If this was a converted personal account, you can then access that user's personal documents.

Impact

  • Ability to effectively disable SSO for any organization.
  • Ability to get users provisioned into an attacker's account, which they can then takeover.

Thanks, -- Tanner

The original report as published on HackerOne, by cache-money. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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. 7 min read.

Context

Grammarly (the program is listed here as Superhuman, formerly Grammarly) offered SAML-based single sign-on for business accounts on www.grammarly.com. An organisation configures its identity provider and supplies an entityId (the Identity Provider Issuer) that identifies that IdP in the SAML Response. Grammarly matches the incoming assertion against the organisation's configuration and provisions the user into the matching organisation.

The report describes a flaw in that matching logic: an attacker could register an entityId that differed from a victim's only by a trailing space, and the application would then prefer the attacker's organisation when placing the authenticated user. The program notes that the vulnerability was fixed before SSO became available to Grammarly customers.

Setup

To reproduce, the researcher needed:

  1. A working SSO configuration on a Grammarly business account, with a known entityId and keypair, confirmed to log in successfully.
  2. The ability to create a second, new Grammarly business account and configure its own SSO with a different keypair.
  3. Patience for configuration changes to propagate: the steps specify waiting two minutes after changing the entityId.

No special tooling is described beyond the ability to sign SAML Responses with a chosen private key.

Finding it

The researcher spent several days trying to escalate the issue and describes the impact he could confirm as a denial of service against any SSO integration, plus a route to provision users into an attacker-controlled organisation and take over their accounts. What made the behaviour look wrong was the mismatch between the organisation a user authenticated against and the organisation they ended up in: it was possible to have a user authenticate against one SSO instance and be added to a completely separate one.

The researcher was explicit that he could not find a zero-interaction escalation. For existing accounts, the takeover required the victim to click "join", which he judged likely because the user is SSOing for the first time and expects to join an organisation.

The core observation is that an entityId can be created that is identical to another organisation's except for a trailing space. The application logic then prioritises that new entityId when deciding where to add the user after authenticating against the correct one. With myentity as the legitimate entity and an attacker entity of myentity[SPACE], users attempting to authenticate into the legitimate myentity do authenticate against it, but the application then attempts to log them into the attacker's organisation. That alone produces the denial of service, since legitimate users can no longer access their organisation.

The more interesting case is a user who is deleted from their original organisation, or a brand new user attempting SSO: they authenticate against their original organisation but get added into the attacker's organisation. The researcher's reading is that the SAML Response is checked against a trim(issuer), while the step that places the user into an organisation always prioritises the entity with the space.

Exploitation

Step 1: establish a working SSO configuration

Set up SSO and confirm you can log in. This gives the baseline entityId and keypair that the later steps abuse.

Step 2: register the near-identical entityId

Create a new Grammarly business account and use the same entityId (Identity Provider Issuer) as in step 1, except with a space appended to the end. Use a different keypair for this organisation as well.

The two configurations now differ only by the trailing space, and the attacker holds the private key for the second one.

Step 3: wait, then log in as the victim

Wait two minutes for the change to propagate, then try logging into the same account from step 1. The login now fails with an error.

At this point the victim organisation is effectively locked out: its users authenticate correctly but are routed to the attacker's organisation.

Step 4: delete the user and log in again

Delete that user from the victim organisation and attempt to log in again. The user is now provisioned to the attacker's organisation, even though the SAML Response was signed with the victim organisation's private key.

This is the confirmation of the split behaviour: the assertion is validated against the victim's configuration, but the provisioning step resolves to the attacker's organisation.

Step 5: take over the account

Once the user is provisioned into the attacker's organisation, the attacker changes their entityId to something brand new and logs in to the victim's account using the keypair they own. If the account was a converted personal account, the attacker can then access that user's personal documents.

Root cause

The bug is a normalisation mismatch between two pieces of logic that should agree on identity. The SAML Response is validated against a trimmed issuer, so myentity and myentity[SPACE] both satisfy the check for the legitimate organisation. The provisioning step, however, does not trim, and it prioritises the entity with the trailing space, so the user is placed into the attacker's organisation.

Because the two lookups use different comparison rules, an attacker can register a configuration that is distinct to the provisioning logic but equivalent to the validation logic. The SAML Response is checked against a trimmed issuer, so the assertion is accepted for the legitimate organisation. The report does not describe any uniqueness constraint on entityId that would have rejected the space-suffixed value.

Impact

  • Any organisation using SSO can be disabled: its users authenticate but cannot reach their organisation.
  • Users can be provisioned into an attacker's organisation and then taken over. For existing accounts this requires the victim to click "join", which the researcher considered likely because the user is SSOing for the first time and expects to join an organisation. For deleted users and brand new users, the provisioning happens without that step.
  • If the victim account was a converted personal account, the attacker can access that user's personal documents.

The researcher could not establish a zero-interaction path and said he would keep trying and update the report if he found one.

Fix

The program states that the vulnerability was fixed before SSO became available to Grammarly customers. The report itself does not describe the code change.

Variants to test

  1. Whitespace and Unicode variants of identifiers. Register an identifier that differs from a victim's only by a trailing space, a leading space, a tab, a newline, or a Unicode space such as a non-breaking space. A positive result is that both configurations can coexist and the provisioning step resolves to the attacker's.
  2. Case differences. Try an identifier that differs only in case where the validation step is case-insensitive but the lookup is not. A positive result is a successful login against the victim's configuration that lands the user in the attacker's organisation.
  3. Other SAML fields used for routing. Test whether the same mismatch exists for fields other than the issuer, for example the audience or the assertion subject, wherever one component trims and another does not.
  4. Deleted or new users. For any tenant-routing bug, check the path for users who do not yet exist in the target organisation. A positive result is automatic provisioning into the attacker's organisation without a "join" click.
  5. Re-registration after provisioning. After a user lands in the attacker's organisation, change the attacker's identifier to a fresh value and log in with the attacker's keypair. A positive result is access to the victim's account and, for converted personal accounts, their personal documents.

Hunting notes

This class of bug hides in multi-tenant SaaS features where an identifier supplied by the customer is used both to validate an incoming assertion and to select a tenant. The signal during recon is a configuration field that the product treats as a name rather than a key: if you can save two values that a human would read as the same, the comparison rules on the two code paths are worth comparing.

SSO and domain-verification features are good hunting grounds because they combine customer-controlled identifiers with automatic provisioning. Test the flows for users who do not yet exist, since those paths often skip confirmation steps that mask the bug for existing users.

The report describes both outcomes: a login that fails after the attacker's configuration is added, and a login signed with the victim's keypair that provisions the user into the attacker's organisation. The report notes that existing accounts required a "join" click and that no zero-interaction path had been found.

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. 10 min read.

What happened, in plain words

Grammarly (the program is listed here as Superhuman, formerly Grammarly) offered a login feature called single sign-on, or SSO, for business accounts on www.grammarly.com. SSO lets a company manage its employees' logins through its own identity system instead of through Grammarly directly. The report describes a flaw in how Grammarly decided which company a logging-in user belonged to. An attacker could set up a company name that looked identical to a victim's except for one invisible space at the end, and Grammarly would then send the victim's users into the attacker's company instead of their own. That locked the victim's users out (a denial of service) and, in some cases, let the attacker take over their accounts. The program notes that the vulnerability was fixed before SSO became available to Grammarly customers.

Background concepts, from zero

Before the steps make sense, a few ideas need explaining.

Single sign-on (SSO). Imagine a building where one badge opens every door. With SSO, an employee logs in once with their company credentials and that single login is accepted by many separate services. The company runs the login system; the service (here, Grammarly) trusts it.

Identity provider (IdP). This is the company's login system, the thing that checks the username and password and then tells Grammarly "yes, this person is who they say they are". Think of it as the security desk at the building entrance.

SAML. This is the language the identity provider and Grammarly use to talk to each other. When a user logs in, the identity provider sends Grammarly a signed message called a SAML Response. It is like a stamped letter of introduction: the stamp (the signature) proves the letter really came from that identity provider and was not forged.

entityId (Identity Provider Issuer). This is a name that identifies the identity provider. It is a text label the company chooses and gives to Grammarly so Grammarly knows which company's messages to expect. Think of it as the name printed on the security desk's letterhead.

Keypair. A pair of mathematically linked keys: a private key that only the owner has, and a public key that everyone can see. Signing with the private key produces a signature that anyone can check with the public key. It is like a wax seal that only one person owns the stamp for.

Provisioning. This means creating or placing a user account in the right place. When someone logs in through SSO for the first time, Grammarly creates their account and puts it in the correct company. Think of it as the receptionist writing your name into the right company's visitor book.

Denial of service (DoS). Making a service unusable for the people who should be able to use it. Here it means locking a company's users out of their own accounts.

Account takeover. Gaining control of someone else's account and being able to use it as if you were them.

trim. A common programming operation that removes spaces (and similar invisible characters) from the beginning and end of a piece of text. trim("myentity ") becomes "myentity". The report uses the term trim(issuer) to describe a check that ignores a trailing space.

Setup

To reproduce the issue, the researcher needed three things:

  1. A working SSO configuration on a Grammarly business account, with a known entityId and keypair, confirmed to log in successfully. This is the "victim" setup, the baseline that later steps abuse.
  2. The ability to create a second, new Grammarly business account and configure its own SSO with a different keypair. This is the "attacker" setup.
  3. Patience for configuration changes to propagate: the steps specify waiting two minutes after changing the entityId. Configuration changes are not always instant; the system needs time to pick them up.

No special tooling is described beyond the ability to sign SAML Responses with a chosen private key.

Finding it

The researcher spent several days trying to escalate the issue. The impact he could confirm was a denial of service against any SSO integration, plus a route to provision users into an attacker-controlled organisation and take over their accounts.

What made the behaviour look wrong was the mismatch between the organisation a user authenticated against and the organisation they ended up in. It was possible to have a user authenticate against one SSO instance and be added to a completely separate one. In everyday terms: the security desk checked your badge correctly, but the receptionist wrote your name into a different company's visitor book.

The researcher was explicit that he could not find a zero-interaction escalation. For existing accounts, the takeover required the victim to click "join". He judged that likely because the user is SSOing for the first time and expects to join an organisation, so clicking "join" is the natural thing to do.

The core observation is that an entityId can be created that is identical to another organisation's except for a trailing space. The application logic then prioritises that new entityId when deciding where to add the user after authenticating against the correct one. With myentity as the legitimate entity and an attacker entity of myentity[SPACE], users attempting to authenticate into the legitimate myentity do authenticate against it, but the application then attempts to log them into the attacker's organisation. That alone produces the denial of service, since legitimate users can no longer access their organisation.

The more interesting case is a user who is deleted from their original organisation, or a brand new user attempting SSO: they authenticate against their original organisation but get added into the attacker's organisation. The researcher's reading is that the SAML Response is checked against a trim(issuer), while the step that places the user into an organisation always prioritises the entity with the space. In other words, one part of the code ignores the trailing space and the other part does not, so the two parts disagree about which company the user belongs to.

Exploitation

Step 1: establish a working SSO configuration

Set up SSO and confirm you can log in. This gives the baseline entityId and keypair that the later steps abuse. Without a known-good setup, you cannot tell whether a later failure is the bug or a mistake in your configuration.

Step 2: register the near-identical entityId

Create a new Grammarly business account and use the same entityId (Identity Provider Issuer) as in step 1, except with a space appended to the end. Use a different keypair for this organisation as well.

The two configurations now differ only by the trailing space, and the attacker holds the private key for the second one. To a human reading the screen, the two names look the same; to the computer, they are different strings.

Step 3: wait, then log in as the victim

Wait two minutes for the change to propagate, then try logging into the same account from step 1. The login now fails with an error.

At this point the victim organisation is effectively locked out: its users authenticate correctly but are routed to the attacker's organisation. This is the denial of service.

Step 4: delete the user and log in again

Delete that user from the victim organisation and attempt to log in again. The user is now provisioned to the attacker's organisation, even though the SAML Response was signed with the victim organisation's private key.

This is the confirmation of the split behaviour: the assertion is validated against the victim's configuration, but the provisioning step resolves to the attacker's organisation. The signature check passed, so the message really came from the victim's identity provider, yet the user still landed in the wrong place.

Step 5: take over the account

Once the user is provisioned into the attacker's organisation, the attacker changes their entityId to something brand new and logs in to the victim's account using the keypair they own. If the account was a converted personal account, the attacker can then access that user's personal documents.

Root cause

The bug is a normalisation mismatch between two pieces of logic that should agree on identity. Normalisation means reducing different-looking text to one standard form, the way trim removes surrounding spaces. The SAML Response is validated against a trimmed issuer, so myentity and myentity[SPACE] both satisfy the check for the legitimate organisation. The provisioning step, however, does not trim, and it prioritises the entity with the trailing space, so the user is placed into the attacker's organisation.

Because the two lookups use different comparison rules, an attacker can register a configuration that is distinct to the provisioning logic but equivalent to the validation logic. The SAML Response is checked against a trimmed issuer, so the assertion is accepted for the legitimate organisation. The report does not describe any uniqueness constraint on entityId that would have rejected the space-suffixed value.

Impact

  • Any organisation using SSO can be disabled: its users authenticate but cannot reach their organisation.
  • Users can be provisioned into an attacker's organisation and then taken over. For existing accounts this requires the victim to click "join", which the researcher considered likely because the user is SSOing for the first time and expects to join an organisation. For deleted users and brand new users, the provisioning happens without that step.
  • If the victim account was a converted personal account, the attacker can access that user's personal documents.

The researcher could not establish a zero-interaction path and said he would keep trying and update the report if he found one.

Fix

The program states that the vulnerability was fixed before SSO became available to Grammarly customers. The report itself does not describe the code change.

Variants to test

  1. Whitespace and Unicode variants of identifiers. Register an identifier that differs from a victim's only by a trailing space, a leading space, a tab, a newline, or a Unicode space such as a non-breaking space. A positive result is that both configurations can coexist and the provisioning step resolves to the attacker's.
  2. Case differences. Try an identifier that differs only in case where the validation step is case-insensitive but the lookup is not. A positive result is a successful login against the victim's configuration that lands the user in the attacker's organisation.
  3. Other SAML fields used for routing. Test whether the same mismatch exists for fields other than the issuer, for example the audience or the assertion subject, wherever one component trims and another does not.
  4. Deleted or new users. For any tenant-routing bug, check the path for users who do not yet exist in the target organisation. A positive result is automatic provisioning into the attacker's organisation without a "join" click.
  5. Re-registration after provisioning. After a user lands in the attacker's organisation, change the attacker's identifier to a fresh value and log in with the attacker's keypair. A positive result is access to the victim's account and, for converted personal accounts, their personal documents.

Hunting notes

This class of bug hides in multi-tenant SaaS features where an identifier supplied by the customer is used both to validate an incoming assertion and to select a tenant. Multi-tenant means one product serves many separate companies, each with its own space. The signal during recon is a configuration field that the product treats as a name rather than a key: if you can save two values that a human would read as the same, the comparison rules on the two code paths are worth comparing.

SSO and domain-verification features are good hunting grounds because they combine customer-controlled identifiers with automatic provisioning. Test the flows for users who do not yet exist, since those paths often skip confirmation steps that mask the bug for existing users.

The report describes both outcomes: a login that fails after the attacker's configuration is added, and a login signed with the victim's keypair that provisions the user into the attacker's organisation. The report notes that existing accounts required a "join" click and that no zero-interaction path had been found.

Glossary

  • SSO (single sign-on): a login system where one set of credentials is accepted by many separate services.
  • Identity provider (IdP): the company's own login system that confirms a user's identity to another service.
  • SAML: the message format identity providers and services use to exchange signed login assertions.
  • SAML Response: the signed message an identity provider sends to a service to say who a user is.
  • entityId (Identity Provider Issuer): the text name that identifies an identity provider to the service.
  • Keypair: a private key and its matching public key, used to sign and verify messages.
  • Private key: the secret half of a keypair, used to create signatures.
  • Signature: proof, created with a private key, that a message came from its owner and was not altered.
  • Provisioning: creating or placing a user account in the correct organisation.
  • Account takeover: gaining control of another person's account.
  • trim: a programming operation that removes spaces and similar invisible characters from the start and end of text.
  • Normalisation: reducing different-looking text to one standard form so comparisons behave consistently.
  • Multi-tenant: one product serving many separate organisations, each with its own isolated space.
  • Zero-interaction: an attack that needs no action at all from the victim.
  • Recon: the information-gathering phase before an attack, looking for weak spots.
  • Tenant: one customer organisation inside a multi-tenant product.

More by cache-money

View all

3 more disclosed reports, best first.

More from Superhuman (formerly Grammarly)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.