Account takeover using IDOR and the misleading case of error 403.
A Facebook login endpoint accepted a user ID and token without any signature, allowing an attacker to swap the ID for another user's and link their own Facebook account to the victim's account. The attacker could then log in as the victim via Facebook, taking over the account without the victim being notified.
{{media:0}}
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 story about a public bug bounty program with more than 100 resolved reports, where a simple account takeover had been sitting unnoticed for a long time. The researcher found it in under 45 minutes. The lesson the author draws from it is blunt: never trust status codes.

The application itself was unremarkable. Users could interact with other accounts, post comments and rate things. Nothing fancy, which made it a good target for a light session. The feature that mattered was the ability to link a Facebook account. The connect button was loaded separately inside an iframe, and the request behind that iframe is where the whole story starts.

Setup
The researcher created an account and immediately went to the profile page to understand how the app worked, asking the basic questions:
- Does the app fetch information from an API, and where is it located (a subdomain, a path on the root domain)?
- What kind of authentication is in place and how does it work?
- Is there any ID to identify the current user?
- Is this ID disclosed anywhere publicly?
Two accounts were used for the exploitation, referred to here as account A and account B. The proxy was kept on and every request was forwarded manually while refreshing the page, which is how the interesting request was spotted. No specific tool versions are given in the report.
Finding it
While forwarding requests by hand, the researcher noticed the request that loads the Facebook connect button inside the iframe. It was a GET request that looked like this:
https://www.redacted.com/connect/facebook_login?id=(ID)&[redacted]
The request carried no signature and no hash. The response contained the Facebook redirect link with all the information needed to start the OAuth flow, including the account ID. That raised the obvious question: if the iframe response can be controlled, can the account be taken over?
Exploitation
Step 1: collect the ID from account A
The ID is not a secret. It can be obtained simply by visiting the victim's profile. The researcher grabbed the ID belonging to account A.
Step 2: modify the iframe request on account B
Logged in as account B, the researcher modified the iframe request to use account A's ID and forwarded it, then clicked the connect Facebook button on account B. Everything went as planned up to the redirect from Facebook, after which the response was error 403.
Step 3: do not trust the 403
After the 403, the page was refreshed on both accounts and the connect button still showed up. Rather than accepting the error as a failure, the researcher tried a different sequence: log out of account A, then click connect with Facebook. It worked. The session ended up inside account A, with the Facebook account of account B linked to it.
That is the account takeover. The victim is not notified, and in this case the victim did not even know a Facebook account had been connected, because the connect button kept showing up regardless.
Root cause
The facebook_login endpoint accepts an id parameter that identifies which account the OAuth flow is being started for, and it does so without any signature or hash protecting the value. The ID is public, since it is exposed on the victim's profile, so an attacker can substitute their own ID with the victim's. The server then completes the OAuth flow and links the attacker's Facebook identity to the victim's account, as the researcher observed.
The 403 is the misleading part. The error was returned after the Facebook redirect, yet the attack still worked, so the status code did not reflect the outcome of the operation. The report does not describe the server-side code, so the exact reason the 403 was returned is not stated; what is clear is that the response was not a reliable signal of whether the attack succeeded.
Impact
An attacker who knows a victim's ID, which is available from the victim's public profile, can link their own Facebook account to the victim's account and take it over. The victim receives no notification. The attack also works against victims who already have Facebook connected: the existing link can be overwritten using this method. The report does not state whether the program paid a bounty or what severity was assigned.
Fix
Based on the mechanism, the endpoint should not accept an account ID supplied by the client for starting the OAuth flow; the account should be derived from the authenticated session, and any identifier passed through the flow should be bound to that session with a signature or equivalent integrity check. The server should also return a status code that reflects whether the link was actually created.
Variants to test
- Look for OAuth or social-login start endpoints that take an
idor similar account identifier as a parameter. A positive result is a response containing a redirect URL for the flow that belongs to a different account than the one you are logged in as. - Check whether the identifier is exposed on public profiles or other unauthenticated pages. If you can read a victim's ID without authentication, the parameter is usable as an attack input.
- Replay the flow with a swapped ID and watch the final state rather than the status code. A positive result is the victim's account showing your social identity linked, even if an error page was returned along the way.
- Try the same swap against an account that already has the provider linked. A positive result is the existing link being replaced by yours.
- After any error response in a multi-step flow, log out and re-enter the flow to see which account you land in. A positive result is being placed inside the other account despite the earlier error.
What happened, in plain words
A security researcher found a way to take over someone else's account on a public bug bounty program. The program had already received more than 100 reports, so many people had looked at it, yet this simple flaw had been sitting there unnoticed for a long time. The researcher found it in under 45 minutes. The main lesson: never trust an error code to tell you whether an attack worked.

The application was ordinary. People could interact with other accounts, post comments and rate things. Nothing fancy, which made it a good target for a light session. The feature that mattered was the ability to link a Facebook account. The connect button was loaded separately inside an iframe, and the request behind that iframe is where the whole story starts.

Background ideas you need
Before the steps, a few everyday ideas. You can skip this section if you already know the words, but each one comes back later.
- Bug bounty program: a company invites outside people to look for security problems in its systems and report them, often for a reward. The company publishes rules and a list of reports it has already handled.
- Account takeover: someone else gains control of your account, for example by linking their own login method to it, so they can act as you.
- API: a way for one piece of software to ask another for data or actions, usually over the web. Think of it as a waiter: you ask for something, the kitchen (the server) prepares it, and the waiter brings it back. The address you ask at is called an endpoint.
- Endpoint: a specific address on a website or API that does one job, such as
/connect/facebook_login. - GET request: the most common kind of web request, used to ask a server for something. Its details often appear in the address bar, which is why they are easy to see and change.
- Parameter: a named value attached to a request, such as
idortokenin an address. Think of a form field: the name is the label, the value is what you write. - ID: a number or string that identifies a particular thing, here a user account. It is like a locker number: it tells the system which locker to open.
- Token: a value that acts as proof of identity or permission, like a wristband at an event. If someone else gets your wristband, they can go where you can.
- Signature or hash: a short value computed from the request contents with a secret, so the server can check the request was not altered. Think of a wax seal on an envelope: if the seal is broken or missing, you know someone tampered with it. No signature means the server cannot tell whether a value was changed.
- OAuth flow: the standard dance where a website sends you to another service (here Facebook) to confirm who you are, and that service sends you back with proof. Think of a bank sending you to a notary to confirm your identity, then the notary handing you a sealed letter to take back.
- Redirect: the server telling your browser to go to another address automatically.
- iframe: a small window inside a web page that loads another page or request separately. Think of a picture-in-picture box on a TV.
- Proxy: a tool that sits between your browser and the website and lets you see and change every request and response. Think of a mail room where you can open, read and rewrite letters before they are delivered.
- Session: the server's memory of you being logged in, usually kept via a cookie. A cookie is a small note your browser stores and shows to the site on each visit, like a cloakroom ticket.
- Status code: a three-digit number a server returns with each response.
200usually means success,403means forbidden. It is like a shop assistant saying "no" without checking whether the order was actually placed. - IDOR (Insecure Direct Object Reference): a flaw where the system lets you name an object (here an account ID) directly in a request and does not check that you are allowed to use that object. Think of a hotel where you can ask for any room key by number, and the desk hands it over without checking that the room is yours.
Setup
The researcher created an account and immediately went to the profile page to understand how the app worked, asking the basic questions:
- Does the app fetch information from an API, and where is it located (a subdomain, a path on the root domain)?
- What kind of authentication is in place and how does it work?
- Is there any ID to identify the current user?
- Is this ID disclosed anywhere publicly?
Why these questions? Knowing where the API lives tells you where to look. Knowing how login works tells you what proof the server expects. Knowing whether an ID exists and whether it is public tells you whether you could use someone else's ID as input. The last question is the key one for this story: if the ID is public, an attacker can collect it without any special access.
Two accounts were used for the exploitation, called account A and account B. The proxy was kept on and every request was forwarded manually while refreshing the page, which is how the interesting request was spotted. No specific tool versions are given in the report.
Finding it
While forwarding requests by hand, the researcher noticed the request that loads the Facebook connect button inside the iframe. It was a GET request that looked like this:
https://www.redacted.com/connect/facebook_login?id=(ID)&[redacted]
Line by line:
https://www.redacted.comis the site's address. The real name is hidden here./connect/facebook_loginis the endpoint: the specific job of starting the Facebook connection.?starts the list of parameters.id=(ID)is the account identifier. The brackets are placeholders for a real value.&separates parameters.- `[redacted] is another value sent along, also a placeholder here.
The request carried no signature and no hash. That matters because without them the server has no way to tell whether the id value was changed by someone before it arrived. The response contained the Facebook redirect link with all the information needed to start the OAuth flow, including the account ID. That raised the obvious question: if the iframe response can be controlled, can the account be taken over?
Exploitation
Step 1: collect the ID from account A
The ID is not a secret. It can be obtained simply by visiting the victim's profile. The researcher grabbed the ID belonging to account A. This is the IDOR part: the system uses a raw account ID in a request, and that ID is visible to anyone who looks at the profile.
Step 2: modify the iframe request on account B
Logged in as account B, the researcher modified the iframe request to use account A's ID and forwarded it, then clicked the connect Facebook button on account B. Everything went as planned up to the redirect from Facebook, after which the response was error 403.
Why do this? The idea was that if the iframe response could be controlled, it might be possible to take over the account.
Step 3: do not trust the 403
After the 403, the page was refreshed on both accounts and the connect button still showed up. A 403 normally means "forbidden", so most people would assume the attempt failed and move on. Instead, the researcher tried a different sequence: log out of account A, then click connect with Facebook. It worked. The session ended up inside account A, with the Facebook account of account B linked to it.
That is the account takeover. The victim is not notified, and in this case the victim did not even know a Facebook account had been connected, because the connect button kept showing up regardless.
Why did logging out of A help? The report does not explain the server's reasoning. What it shows is that the attack still worked despite the 403, so the error code did not reflect the outcome. The lesson is to check the actual state, not just the number.
Root cause
The facebook_login endpoint accepts an id parameter that identifies which account the OAuth flow is being started for, and it does so without any signature or hash protecting the value. The ID is public, since it is exposed on the victim's profile, so an attacker can substitute their own ID with the victim's. The server then completes the OAuth flow and links the attacker's Facebook identity to the victim's account, as the researcher observed.
The 403 is the misleading part. The error was returned after the Facebook redirect, yet the state change had already happened, so the status code did not reflect the outcome of the operation. The report does not describe the server-side code, so the exact reason the 403 was returned is not stated; what is clear is that the response was not a reliable signal of whether the attack succeeded.
Impact
An attacker who knows a victim's ID, which is available from the victim's public profile, can link their own Facebook account to the victim's account and take it over. The victim receives no notification. The attack also works against victims who already have Facebook connected: the existing link can be overwritten using this method.
Fix
Based on the mechanism, the endpoint should not accept an account ID supplied by the client for starting the OAuth flow; the account should be derived from the authenticated session, and any identifier passed through the flow should be bound to that session with a signature or equivalent integrity check. The server should also return a status code that reflects whether the link was actually created.
Variants to test
- Look for OAuth or social-login start endpoints that take an
idor similar account identifier as a parameter. A positive result is a response containing a redirect URL for the flow that belongs to a different account than the one you are logged in as. - Check whether the identifier is exposed on public profiles or other unauthenticated pages. If you can read a victim's ID without authentication, the parameter is usable as an attack input.
- Replay the flow with a swapped ID and watch the final state rather than the status code. A positive result is the victim's account showing your social identity linked, even if an error page was returned along the way.
- Try the same swap against an account that already has the provider linked. A positive result is the existing link being replaced by yours.
- After any error response in a multi-step flow, log out and re-enter the flow to see which account you land in. A positive result is being placed inside the other account despite the earlier error.
Glossary
- Account takeover: gaining control of someone else's account, for example by linking your own login method to it.
- API: a way for software to ask another system for data or actions over the web.
- Bug bounty program: a company's invitation to outside researchers to find and report security problems, often for a reward.
- Cookie: a small piece of data your browser stores and sends back to a site, often used to keep you logged in.
- Endpoint: a specific address on a website or API that performs one job.
- GET request: a web request used to ask a server for something, with details often visible in the address.
- Hash: a short value computed from data, used to detect changes; with a secret it can act as a signature.
- ID: a value that identifies a particular object, here a user account.
- IDOR (Insecure Direct Object Reference): a flaw where a request names an object directly and the server does not check that you are allowed to use it.
- iframe: a small window inside a page that loads another page or request separately.
- OAuth flow: the standard process where a site sends you to another service to confirm identity and receives proof back.
- Parameter: a named value attached to a request, such as
idortoken. - Proxy: a tool between your browser and a site that lets you see and change requests and responses.
- Redirect: an instruction from the server for your browser to go to another address.
- Session: the server's memory of you being logged in, usually maintained with a cookie.
- Signature: a value computed with a secret so the server can check a request was not altered.
- Status code: a three-digit number returned with a response, such as 200 for success or 403 for forbidden.
- Token: a value that acts as proof of identity or permission.