How I was able to take over accounts in websites deal with Github as an SSO provider
The email verification link for a new GitHub account contained the six-digit code and lacked rate limiting, unlike the manual entry form. An attacker could brute-force the code to verify an account using a victim's email address, and because many sites use GitHub as an SSO provider, this could lead to account takeover on those sites.
Published on infosecwriteups.com
Hello, fellow hackers and security researchers! I’m Khaled Mohamed a Cyber security engineer at Heroic cybersecurity, Welcome to the first write-up I hope you enjoy it, let’s start.
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
GitHub lets a new user sign up with an email address and then requires that address to be verified. Verification is done with a six-digit code sent by email. The same email also carries a link for people who cannot type the code manually, and that link contains the same six-digit code rather than a separate token.
GitHub is widely used as an SSO provider. On sites that trust GitHub as their identity provider, an account on GitHub tied to a given email address is enough to be treated as that person. That is why the verification step matters: whoever controls the verification of an email address effectively controls the GitHub identity for it, and through SSO, the accounts on the sites that trust it.
Setup
No special tooling is described beyond an intercepting proxy and an intrusion tool (the report refers to "the intruder", i.e. an automated request repeater with payload positions). The researcher created a GitHub account using the victim's email address and worked through the normal sign-up and verification flow. The only precondition is that the attacker knows the victim's email address and that the victim has not already registered it on GitHub.
Finding it
After some recon that turned up nothing interesting, the researcher moved on to account creation. Signing up on GitHub is simple, and after creating the account you are asked to verify your email with a six-digit code sent to your inbox.
In the email, alongside the code, there was a link for people who cannot enter the code manually. That link contained the same six-digit code instead of a token or something similar. That was the first oddity: a link that carries the secret itself, in a form that is short and guessable, rather than an unguessable token.
The second observation came from testing the manual form. Entering the code through the form was protected by a strict rate limit, so brute forcing the code there was impossible. The link, however, behaved differently.
Exploitation
Step 1: Create an account with the victim's email
The attacker registers on GitHub using the victim's email address. This starts the normal verification flow and causes GitHub to send the six-digit code, and the link containing it, to the victim's inbox.
Step 2: Trigger a resend from the verification page
On the verification form at:
https://github.com/account_verifications
click "Resend the code". This produces the request that the next step inspects.
Step 3: Intercept the request with a proxy
With a proxy in place, capture the outgoing request to obtain the email id that GitHub uses internally for the address.
Step 4: Read the email id from the POST request
The intercepted request goes to:
/users/~username~/emails/~email-id~/request_verification
Here ~email-id~ is the internal identifier for the email address, and ~username~ is the account name. Both are visible in the request, so the attacker can substitute their own values.
Step 5: Build the confirmation URL
Update the URL with your own username and email id so that it takes this shape:
https://github.com/users/~username~/emails/~emailid~/confirm_verification/000000?via_launch_code_email=true
The last path segment before the query string is the six-digit code, shown here as 000000 as a placeholder. The URL includes the query parameter via_launch_code_email=true.
Step 6: Brute force the code
Send the request to the intruder and start brute forcing the code. There was no rate limit on this path. The researcher sent about 130,000 requests before hitting the valid code.
Root cause
The verification code is a six-digit value, so the search space is small enough to enumerate. The manual form was protected by a strict rate limit, which made guessing there impractical. The link-based confirmation path did not apply the same limit, so the same secret could be guessed without restriction. The design also put the secret itself in the link instead of an unguessable token. The existing defence, the rate limit on the form, was applied to only one of the two paths that accept the code, so it did not cover the weaker one.
Impact
Because many websites use GitHub as an SSO provider, an attacker who can verify an email address on GitHub can take over the victim's account on those sites. The flow is: create a GitHub account with the victim's email, brute force the verification code through the unlimited link endpoint, and then use that GitHub identity to sign in to the sites that trust it. This applies where the victim has no GitHub account yet; if they already have one, the address is taken and the sign-up path is not available. The timeline records it as reported and triaged on 5 August 2021, severity confirmed High on 10 August 2021, and resolved and rewarded the same day.
Fix
The report does not describe the change GitHub made. What the finding calls for is applying the same strict rate limit to the link-based confirmation path as to the manual form, and not embedding the six-digit code in the link at all: the link should carry an unguessable token, with the code kept for manual entry only.
Variants to test
- Compare every endpoint that accepts a verification code, form and link, and check whether the rate limit is enforced on each. A positive result is a path that accepts repeated guesses without throttling or lockout.
- Look for a parameter that distinguishes the emailed link from the manual form, such as
via_launch_code_email=true, and try it on the form endpoint. A positive result is the form accepting requests with that parameter and skipping its limit. - Check whether the code appears in the link at all. A positive result is a link whose secret is short and numeric rather than a long random token.
- On sites that trust an external identity provider, register with a victim's email and see whether verification can be completed without access to the inbox. A positive result is a verified identity for an address the attacker does not control, which then grants SSO access to the relying sites.
- Test resend and confirmation endpoints for identifiers that can be swapped, such as the email id in the path. A positive result is a confirmation request that succeeds for an address the attacker does not own.
What happened, in plain words
A security researcher found a way to take over accounts on websites that use GitHub as an SSO provider. The trick did not need a password and did not need access to the victim's email inbox. It only needed the victim's email address.
Here is the short version. When you create a GitHub account, GitHub sends a six-digit code to your email to prove the address is yours. You can either type that code into a form on the website, or click a link in the same email. The form was protected against guessing: if you tried too many wrong codes, GitHub stopped you. The link was not protected in the same way. Worse, the link contained the same six-digit code, so anyone who could reach the link's address could keep guessing codes as fast as they liked. The researcher sent about 130,000 requests before hitting the valid code.
Once an attacker can prove they own an email address on GitHub, they hold a GitHub identity for that address. Many websites trust GitHub to say who you are, a setup called single sign-on. So the attacker can then sign in to those websites as the victim.

The rest of this article walks through the same steps the researcher took, explaining each idea from scratch. If you have never done security work before, that is fine: you only need to know how to use a browser.
Background: what single sign-on is
Before the bug, it helps to understand the feature that made it serious.
Single sign-on (SSO) is a way for one account to log you in to many different services. Instead of remembering a separate password for every website, you have one account with a trusted company, and other websites ask that company to confirm who you are. The researcher's own description is that SSO lets users access multiple applications and services with just one set of credentials, through a pop-up widget or login page, so you do not need a dozen passwords in a day.
An everyday comparison: think of a festival wristband. You show your ID once at the gate, get a wristband, and after that every stall, stage and tent accepts the wristband without asking for your ID again. GitHub is playing the role of the gate here. Websites that use GitHub as their SSO provider trust the wristband GitHub gives out.
That is why a flaw in GitHub's sign-up matters far beyond GitHub. If someone can get GitHub to issue them a wristband for your email address, the other websites will accept it.
The setup
The researcher did not need anything exotic. Two tools are mentioned:
- An intercepting proxy. A proxy sits between your browser and the website and lets you see and edit the requests your browser sends. A comparison: it is like a postal worker who opens every letter you send, lets you read it, and lets you rewrite it before it goes out. Browsers normally hide this traffic; the proxy exposes it.
- An intrusion tool, which the report calls "the intruder". This is an automated request repeater: you mark the part of a request you want to vary, give it a list of values, and it sends the request over and over with each value in turn. It is the tool that does the guessing at scale.
The only precondition for the attack is that the attacker knows the victim's email address and that the victim has not already signed up to GitHub with it. If the address is already registered, the attacker cannot create a new account with it.
Finding the problem
The researcher started with recon, short for reconnaissance: looking around a target to see what is exposed and how it behaves, before trying anything. In this case the recon turned up nothing interesting, so the researcher moved to the next phase: creating an account.
Signing up on GitHub is simple. After you create the account, GitHub asks you to verify your email address with a six-digit code sent to your inbox. This is a common pattern: it proves that whoever created the account can read mail sent to that address.
Two things stood out.
First, the email contained a link for people who cannot type the code manually. That link contained the same six-digit code, rather than a separate, long, random value. This is the first oddity. A secret that is only six digits long is short enough to guess by trying every possibility, which security people call brute forcing. A long random value, by contrast, has so many possibilities that guessing is hopeless.
Second, the researcher tested the manual form. Typing the code into the form was protected by a strict rate limit, meaning the server refuses to answer if you make too many attempts in a short time. With that limit in place, guessing the code through the form was impossible. The link, however, behaved differently.
Exploitation, step by step
Step 1: Create an account with the victim's email
The attacker registers on GitHub using the victim's email address. This starts the normal verification flow, so GitHub sends the six-digit code, and the link containing it, to the victim's inbox. The attacker cannot read that inbox, but as we will see, they do not need to.
Step 2: Trigger a resend from the verification page
On the verification form at:
https://github.com/account_verifications
click "Resend the code". This makes GitHub send the email again, and it produces the request that the next step inspects.
Why this step: the attacker wants to see the exact request GitHub's own page sends when it deals with a verification email. Watching a legitimate request is the easiest way to learn the shape of the endpoint, including the identifiers inside it.
Step 3: Intercept the request with a proxy
With the proxy in place, capture the outgoing request to obtain the email id that GitHub uses internally for the address.
Why this step: the website does not refer to your email as "[redacted]" in every request. Internally it often uses a number or code, an identifier, to refer to it. The attacker needs that internal identifier to build the confirmation request in the next steps.
Step 4: Read the email id from the POST request
The intercepted request goes to:
/users/~username~/emails/~email-id~/request_verification
Line by line, in plain words:
/users/is the part of the site that deals with user accounts.~username~is the account name, the name the attacker chose when signing up./emails/is the part that deals with email addresses attached to the account.~email-id~is the internal identifier for the email address, the value the attacker just captured./request_verificationis the action: please send a verification message for this address.
Both the username and the email id are visible in the request, so the attacker can substitute their own values. This is a POST request, meaning the browser is sending data to the server rather than just asking for a page; the report does not describe the body of the request.
Step 5: Build the confirmation URL
Update the URL with your own username and email id so that it takes this shape:
https://github.com/users/~username~/emails/~emailid~/confirm_verification/000000?via_launch_code_email=true
Line by line:
https://github.comis the site./users/~username~/emails/~emailid~is the same path as before, with the attacker's own username and email id filled in./confirm_verification/is the action: confirm that this address is verified.000000is where the six-digit code goes. It is shown as a placeholder here; the attacker will replace it with each guess in turn.?via_launch_code_email=trueis a query parameter, a small piece of information appended to the address after the question mark. The URL includes the query parametervia_launch_code_email=true.
Why this step: the attacker is rebuilding the request that the emailed link would produce, but with a code they choose. The link path turned out to have no rate limit.
Step 6: Brute force the code
Send the request to the intruder and start brute forcing the code. There was no rate limit on this path.
Why this works: a six-digit code has a limited number of possible values, and with no limit on attempts, the intruder can simply try them one after another until one is accepted. The researcher's figure of roughly 130,000 requests shows the guessing was practical, not theoretical.
Why it worked
The verification code is a six-digit value, so the set of possible codes is small enough to enumerate. The manual form was protected by a strict rate limit, which made guessing there impractical. The link-based confirmation path did not apply the same limit, so the same secret could be guessed without restriction.
The design also put the secret itself in the link instead of an unguessable token. A token here means a long, random value that is impractical to guess; the report notes the link used the six-digit code instead of a token or something similar. That means anyone who can reach the confirmation endpoint can attack the code directly.
The existing defence, the rate limit on the form, was applied to only one of the two paths that accept the code, so it did not cover the weaker one. A comparison: a shop puts a guard on the front door but leaves the back door open, and both doors lead to the same till.
Impact
Because many websites use GitHub as an SSO provider, an attacker who can verify an email address on GitHub can take over the victim's account on those sites. The flow is: create a GitHub account with the victim's email, brute force the verification code through the unlimited link endpoint, and then use that GitHub identity to sign in to the sites that trust it.
This applies where the victim has no GitHub account yet. If they already have one, the address is taken and the sign-up path is not available.
The timeline records the severity as High. The timeline records it as reported and triaged on 5 August 2021, severity confirmed High on 10 August 2021, and resolved and rewarded the same day.
Fix
The report does not describe the change GitHub made. What the finding calls for is applying the same strict rate limit to the link-based confirmation path as to the manual form, and not embedding the six-digit code in the link at all: the link should carry an unguessable token, with the code kept for manual entry only.
Variants to test
If you want to look for similar issues yourself, these are the checks the finding suggests. Each one is a question you can ask about a website, and a positive result is what you would see if the problem is present.
- Compare every endpoint that accepts a verification code, form and link, and check whether the rate limit is enforced on each. A positive result is a path that accepts repeated guesses without throttling or lockout.
- Look for a parameter that distinguishes the emailed link from the manual form, such as
via_launch_code_email=true, and try it on the form endpoint. A positive result is the form accepting requests with that parameter and skipping its limit. - Check whether the code appears in the link at all. A positive result is a link whose secret is short and numeric rather than a long random token.
- On sites that trust an external identity provider, register with a victim's email and see whether verification can be completed without access to the inbox. A positive result is a verified identity for an address the attacker does not control, which then grants SSO access to the relying sites.
- Test resend and confirmation endpoints for identifiers that can be swapped, such as the email id in the path. A positive result is a confirmation request that succeeds for an address the attacker does not own.
Glossary
- SSO (single sign-on): a login setup where one trusted account is used to sign in to many separate websites, so you do not need a password for each one.
- Identity provider: the trusted service that confirms who you are to the other websites; in this report, GitHub.
- Relying site: a website that trusts an identity provider's confirmation and lets you in on that basis.
- Recon (reconnaissance): looking around a target to learn how it is built and behaves before trying anything.
- Verification code: a short numeric code sent to your email to prove you can read mail at that address.
- Brute force: guessing a secret by trying possible values one after another until one works.
- Rate limit: a rule that refuses or slows requests after too many attempts in a short time, which makes guessing impractical.
- Token: a long, random value that is impractical to guess, often used in links in place of a short code.
- Endpoint: a specific address on a server that performs a particular action, such as sending a verification email or confirming a code.
- Request: the message your browser sends to a server, for example asking for a page or submitting a form.
- POST request: a request that sends data to the server rather than just asking for a page.
- Proxy (intercepting proxy): a tool that sits between your browser and the website so you can see and edit the requests being sent.
- Intruder: an automated tool that repeats a request many times with different values in a chosen position, used here to guess the code.
- Query parameter: a small piece of information appended to a web address after a question mark, such as
via_launch_code_email=true. - Identifier: a value a website uses internally to refer to something, such as a number for an email address, instead of the address itself.
- Account takeover: gaining control of someone else's account without their permission.