[Case Study] OAuth Misconfiguration leads to Account Takeover
When linking a Facebook account, the application trusted a user-supplied ownerBid parameter to decide which profile the social account was attached to. By swapping that value for another user's identifier, an attacker could bind their own Facebook login to the victim's account and then sign in as the victim.
Published on medium.com
{{media:1}}
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
This is a case study from a bug bounty program in which the target website offered sign-in through Google and Facebook OAuth. The application also had a Linked Accounts section on the user profile, where an already signed-in user could connect a Facebook account to their profile by signing into the Facebook app. The report does not name the target or the program.
The researcher's conclusion is that the vulnerability sat in the integration layer: third-party OAuth providers are often left misconfigured, and here the misconfiguration was serious enough to allow access to any user's account.
Setup
The researcher used two test accounts, deliberately, so that the proof of concept would not touch a real user:
- gaurang (Victim), registered and logged in through Google sign-in.
- Attacker, registered with a different email address.
The report recommends always using two test accounts when testing OAuth misconfiguration, because accidentally landing in another user's account is not something that user would appreciate.
No tools or versions are mentioned.
Finding it
The victim profile page showed a Linked Accounts section in which the Google account was linked to the profile and Facebook was not.

The attacker profile was created the same way, with a separate email address.

In the Linked Accounts section, clicking the Connect button for Facebook starts the linking flow. The request generated by that click is where the researcher found the problem: while linking a Facebook account, the application sends the ownerBid of the user who is requesting the link. The request carries the ownerBid of the user requesting the link.

Exploitation
Step 1: capture the linking request
As the attacker, the researcher clicked Connect for Facebook and inspected the resulting request. The report shows the request in the image above but does not reproduce it as text, so the exact endpoint, method, headers and parameters other than ownerBid are not given here.
Step 2: swap ownerBid for the victim's value
The attacker replaced the OwnerBid parameter with the victim's ownerBid (gaurang). The question the researcher asked was simply: what happens if this value belongs to someone else?
Step 3: observe the result
The attacker's Facebook profile was linked to the victim's profile account.

Step 4: sign in as the victim
With the attacker's Facebook identity now attached to the victim's profile, the attacker can sign in using Facebook and gets access to the victim's account.
Root cause
The linking flow trusted a client-supplied ownerBid to decide which profile the Facebook identity should be attached to. The server accepted the swapped ownerBid, so the value was not tied to the requesting user. The report does not describe the server-side code, so the exact check that was missing is inferred from behaviour rather than shown.
The OwnerBid and user_bid were the same value, and profiles were public. Reading the source code of a public profile was enough to obtain the OwnerBid needed for the takeover.
Impact
The impact was high. Because profiles were public and the identifier was exposed in the page source, an attacker could obtain any user's OwnerBid, so access to any user's profile was possible. The researcher notes that many celebrities had accounts on the website and that the screenshot above contains the OwnerBid/user_bid of a known celebrity, so access to any user's profile was possible.
Fix
The fix implied by the flaw is to stop trusting the client-supplied ownerBid when linking an account: derive the profile from the authenticated session instead, and reject or ignore any identifier that does not match it.
Variants to test
- Identifier swap in account linking. Intercept the request that connects a third-party identity and replace the user identifier with a second test account's value. A positive result is the second account's profile showing the first account's provider as linked.
- Identifier swap in OAuth callback. Look for user identifiers passed as parameters during the callback and substitute another account's value. A positive result is being logged in as the other account.
- Public identifier harvesting. Check whether the identifier used in linking appears in public profile pages or their source. A positive result is a stable, guessable or enumerable value that maps to a user.
- Cross-provider linking. Repeat the swap with each configured provider (here Google and Facebook). A positive result is the same unauthorised link being created through a different provider.
- Unlinking and re-linking. Try removing a provider link and re-adding it with a swapped identifier. A positive result is a link created on an account that never authorised it.
What happened, in plain words
A website let people sign in with their Google or Facebook account instead of creating a separate username and password. Once signed in, you could also connect your Facebook account to your profile from a "Linked Accounts" section. The researcher found that when you clicked the button to connect Facebook, the website asked the browser to say which profile the Facebook account should be attached to. The browser sent a number called ownerBid that identified the profile. The website accepted the number from the browser, and changing it to another user's number worked.
By changing that number to another user's number, the researcher could attach their own Facebook account to the other person's profile. After that, signing in with Facebook gave access to the other person's account. This is called account takeover: one person ends up controlling another person's account.
The researcher also found that the same number was visible to anyone who looked at the source code of a public profile page, so an attacker did not even need to guess it. The report does not name the website or the bug bounty program.
The pieces you need to know
Before following the steps, here are the ideas the report relies on, explained from scratch.
- Sign-in with Google or Facebook (OAuth). OAuth is a way for one website to let another company confirm who you are. Instead of the website storing your password, it sends you to Google or Facebook, you sign in there, and Google or Facebook tells the website "yes, this is the person". The website never sees your Google or Facebook password. Think of it like a club that accepts a passport: the club does not issue the passport, it just checks one issued by a trusted authority.
- Third-party integration. The website is not built by Google or Facebook. It has to connect to their sign-in services itself, and that connection code is written by the website's developers. Mistakes in that connection code are what the report calls a misconfiguration.
- Profile and Linked Accounts section. A profile is the page that represents you on the website. The Linked Accounts section lists which outside accounts (Google, Facebook) are connected to your profile. Connecting one is often called linking.
- Identifier (ownerBid, user_bid). An identifier is a label the website uses internally to tell users apart, like a customer number on a bank statement. Here the label is called ownerBid, and the report says OwnerBid and user_bid were the same value. You do not need to know what the letters stand for; what matters is that it is a value that points at one specific profile.
- Request and parameter. When you click a button, your browser sends a request to the website's server. A request is a message like "please do this for me". It can carry extra pieces of information called parameters, for example
ownerBid=gaurang. The server reads those parameters and acts on them. - Client-supplied value. Anything your browser sends can be changed by you before it reaches the server. A value that comes from the browser is called client-supplied. If the server trusts it without checking, an attacker can put in a different value. This is the heart of the bug.
- Source code of a page. Every web page your browser shows is built from text (HTML) that your browser downloads. You can view that text with your browser's "View source" option. If a value appears in that text, anyone can read it.
- Account takeover. When an attacker gains control of someone else's account, that is account takeover. It is serious because the attacker can then read or change whatever the real owner could.
Setting up two test accounts
The researcher used two accounts on purpose, so that testing would not disturb a real person:
- gaurang (Victim), registered and logged in through Google sign-in.
- Attacker, registered with a different email address.
The report recommends always using two test accounts when testing this kind of sign-in feature, because accidentally ending up inside another user's account is not something that user would appreciate. The report does not mention any tools or software versions.
Finding the problem
The victim profile page had a Linked Accounts section. The Google account was linked to the profile, and Facebook was not.

The image shows the victim's profile page with the Linked Accounts section, where Google is connected and Facebook is not.
The attacker profile was created the same way, using a separate email address.

The image shows the attacker's profile page, created with a different email address.
In the Linked Accounts section, clicking the Connect button for Facebook starts the linking process. That click is where the researcher found the problem: while linking a Facebook account, the application sends the ownerBid of the user who is requesting the link. The request carries the ownerBid of the user requesting the link.

The image shows the request that the Connect button generates, with the ownerBid parameter visible in it.
Exploiting it
Step 1: capture the linking request
As the attacker, the researcher clicked Connect for Facebook and looked at the request the browser sent. The report shows that request in the image above but does not reproduce it as text, so the exact address, method, headers and other parameters are not given here. The point of this step is to see exactly what the browser tells the server, because anything the browser sends can be changed.
Step 2: swap ownerBid for the victim's value
The attacker replaced the OwnerBid parameter with the victim's ownerBid (gaurang). The question was simple: what happens if this value belongs to someone else? The reason to try it is that the server has to decide which profile to attach the Facebook account to, and if it simply believes the number in the request, it will attach it to whichever profile that number names.
Step 3: observe the result
The attacker's Facebook profile was linked to the victim's profile account.

The image shows the victim's profile with the attacker's Facebook account now listed as linked.
Step 4: sign in as the victim
With the attacker's Facebook identity now attached to the victim's profile, the attacker can sign in using Facebook and gets access to the victim's account. In plain terms: the website now believes that the Facebook account belongs to the victim, so when that Facebook account signs in, the website opens the victim's profile.
Why it worked
The linking flow trusted a value sent by the browser (ownerBid) to decide which profile the Facebook identity should be attached to. The server accepted the swapped ownerBid, so the value was not tied to the requesting user.
The OwnerBid and user_bid were the same value, and profiles were public. Reading the source code of a public profile was enough to obtain the OwnerBid needed for the takeover. In everyday terms, the key to the front door was printed on the door.
The image shows the source code of a public profile page, where the OwnerBid/user_bid value can be read.
Impact
The impact was high. Because profiles were public and the identifier was exposed in the page source, an attacker could obtain any user's OwnerBid, so access to any user's profile was possible. The researcher notes that many celebrities had accounts on the website and that the screenshot above contains the OwnerBid/user_bid of a known celebrity, so access to any user's profile was possible.
Fix
The fix implied by the flaw is to stop trusting the browser-supplied ownerBid when linking an account: work out the profile from the signed-in session instead, and reject or ignore any identifier that does not match it.
Variants to test
- Identifier swap in account linking. Intercept the request that connects a third-party identity and replace the user identifier with a second test account's value. A positive result is the second account's profile showing the first account's provider as linked.
- Identifier swap in the sign-in callback. Look for user identifiers passed as parameters during the callback and substitute another account's value. A positive result is being logged in as the other account.
- Public identifier harvesting. Check whether the identifier used in linking appears in public profile pages or their source. A positive result is a stable, guessable or enumerable value that maps to a user.
- Cross-provider linking. Repeat the swap with each configured provider (here Google and Facebook). A positive result is the same unauthorised link being created through a different provider.
- Unlinking and re-linking. Try removing a provider link and re-adding it with a swapped identifier. A positive result is a link created on an account that never authorised it.
Glossary
- OAuth: a way for a website to let another company (such as Google or Facebook) confirm who you are, without the website handling your password.
- Third-party integration: code a website writes to connect to an outside service, such as a sign-in provider.
- Misconfiguration: a setting or piece of code that was set up incorrectly, leaving a gap an attacker can use.
- Profile: the page on a website that represents one user.
- Linked Accounts: the section of a profile that lists which outside accounts are connected to it.
- Linking: connecting an outside account, such as Facebook, to your profile on the website.
- Identifier: a value the website uses internally to point at one specific user or profile.
- ownerBid / user_bid: the identifier used in this report; the report says the two were the same value.
- Request: the message your browser sends to a website's server when you click something or load a page.
- Parameter: an extra piece of information carried inside a request, such as
ownerBid=gaurang. - Client-supplied value: any value that comes from your browser, which you can change before it reaches the server.
- Server: the computer that runs the website and answers the browser's requests.
- Session: the website's record that you are currently signed in, so it does not ask for your password on every click.
- Source code (of a page): the text your browser downloads to build a page, which anyone can view.
- Account takeover: when an attacker gains control of another person's account.
- Bug bounty program: a scheme where a company pays researchers for reporting security flaws to it.
- Proof of concept: a demonstration that a flaw is real, usually done with test accounts.