Skip to content
IDOR Write-up Beginner

How I was able to delete any users’ OAUTH connections via IDOR

The endpoint that removes a linked social login trusted an email address supplied in the request instead of checking which account owned the connection. An attacker who knew a victim's email address could remove that victim's Google OAuth connection without any interaction from them.

medium.com

Published on medium.com

Bug Bounty

Mirza Muhammad Fauzan, on medium.com

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.

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

Context

The target was a private bug bounty program. The researcher refers to the main domain as redacted.com and to the affected host as accounts.redacted.com, which handles account and social login functionality. The feature in question is the profile settings page where a user can connect social accounts such as Google, LinkedIn, Twitter and Facebook, and later remove those connections.

The vulnerability class is IDOR (Insecure Direct Object Reference), which the author defines as an access control flaw where an application or API uses an identifier for direct access to an object in an internal database without checking access control or authentication. In this case the identifier was the email address of the account whose social connection was being removed.

Setup

The researcher was hunting on a private program and chose to test the main domain because it has a large number of functionalities. Because of a full time job there was no time for reconnaissance, so the only tool used was Burp Suite. The scope was configured in Burp under Target -> Scope with the regex \.redacted\.com.

With that scope in place, Burp history collected the subdomains such as api.redacted.com and accounts.redacted.com together with their endpoints and parameters, which made it straightforward to test each URL endpoint with parameters.

Two accounts were created with different email addresses, one acting as attacker and one as victim. The author notes explicitly that the IDOR was performed only against these test accounts and not against real users' accounts.

Finding it

On the attacker account, a Google OAuth connection was made. The request that removes a connection was then intercepted in Burp, and it contained an emailAddress parameter. That parameter is the object reference: the server takes the email address from the request body and acts on the account it belongs to, rather than deriving the account from the authenticated session.

Exploitation

Step 1: Capture the remove connection request

With the attacker account connected to Google, the remove connection action was intercepted. The captured request was:

HTTP
POST /social-login/remove HTTP/2
Host: accounts.redacted.com
User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/101.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Request-With: XMLHttpRequest
Content-Length: 48
Origin: redacted.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

type=google&emailAddress=fozisimi123%40gmail.com

The body has two parameters: type, which selects the provider (google here), and emailAddress, which is the URL-encoded address of the account whose connection is being removed. The request is sent as form-encoded data, with Origin: redacted.com and Sec-Fetch-Site: same-origin.

Step 2: Swap the email address for the victim's

The only change made was to replace the email address in the body with the address of the second (victim) account. The request was then sent while still authenticated as the attacker.

Step 3: Observe the result

The Google connection was removed from the victim account successfully, with no interaction from the victim. The attacker only needs the victim's email address to remove any social account connection from that user's account.

Root cause

The endpoint trusts a client-supplied identifier, emailAddress, to decide which account's social connection to delete. It does not bind that identifier to the authenticated session, so any authenticated user can name another user's address and have the action applied to that account. The author's framing is that the application uses the identifier for direct access to an object without checking access control or authentication for that object.

Impact

An attacker who is authenticated and who knows a victim's email address can remove the victim's Google connection without the victim's involvement; the settings page lists Google, LinkedIn, Twitter and Facebook. The action is destructive to the victim's account configuration and requires no interaction from them. The precondition is knowledge of the victim's email address.

Fix

The report does not describe any fix or remediation.

Variants to test

  1. Remove or disconnect endpoints for other providers: change type to linkedin, twitter or facebook while keeping the victim's emailAddress, and check whether the connection is removed. A positive result is a success response and the connection gone from the victim account.
  2. Other account settings actions that take an identifier in the body: look for parameters such as email, user id or username on endpoints that change account state, and substitute a second test account's value. A positive result is the change appearing on the second account.
  3. Identifier formats: try the victim's numeric user id or username in place of the email address where the endpoint accepts them. A positive result is the same unauthorised action succeeding.
  4. Method and content type variations: replay the same body as JSON or as query parameters, and try PUT or DELETE on the same path. A positive result is the action still being applied to the named account.
  5. Session binding check: send the request with the attacker's session but the victim's identifier, then confirm from the victim's own session that the state changed. A positive result is a state change visible to the victim without any action by them.

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

What happened, in plain words

A security researcher was testing a website that lets people sign in and manage their account. That website had a feature where you could link your account to social networks such as Google, LinkedIn, Twitter and Facebook, and later unlink them. The researcher found that when you asked the site to unlink a social account, the request told the site which account to act on by putting an email address in the request. The site trusted that email address without checking that it belonged to the person making the request. So the researcher could put someone else's email address in the request and unlink that person's social accounts, without that person doing anything.

This kind of mistake is called an IDOR, short for Insecure Direct Object Reference. The name sounds complicated, but the idea is simple. Imagine a cloakroom where you hand in your coat and get a ticket with a number. If the attendant hands back whatever coat matches the number you say, without checking that the ticket is really yours, you could say someone else's number and walk away with their coat. An IDOR is the same: the application takes an identifier (a number, a username, an email address) and uses it to find a thing in its database, but never checks that you are allowed to touch that thing.

The researcher did all of this on two accounts they created themselves, one playing the attacker and one playing the victim. They did not touch real users' accounts.

The target and the feature

The work happened on a private bug bounty program. A bug bounty program is a scheme where a company invites outside researchers to look for security problems in its systems and report them, often for a reward. A private program means only invited researchers can take part.

The researcher calls the company's main domain redacted.com, and the specific server involved accounts.redacted.com. A domain is the part of a web address after the https://, like example.com. A subdomain is a prefix in front of it, like accounts.example.com. Companies often split their services across subdomains: one for the main website, one for the API, one for accounts and login, and so on.

The server accounts.redacted.com handles account and social login functionality. The feature in question is the profile settings page where a user can connect social accounts such as Google, LinkedIn, Twitter and Facebook, and later remove those connections. Connecting an account means telling the site "this Google account is mine, please use it to identify me". Removing the connection undoes that.

What an API is, and why it matters here

An API (Application Programming Interface) is the set of addresses and rules a website's own pages use to talk to its servers. When you click a button on a web page, your browser usually does not load a whole new page. Instead, a small script running in the page sends a request to the server in the background, the server replies with data, and the page updates. Those background requests are the API.

A useful comparison: a restaurant menu. The menu lists what you can order and how to order it. You do not walk into the kitchen yourself; you tell the waiter, and the waiter passes the order on. The API is the menu plus the waiter. The kitchen is the server and its database.

Because the API is what actually does the work, it is where access control has to be enforced. A web page can hide a button from you, but that is only cosmetic. If the API behind the button does not check who you are, hiding the button achieves nothing.

Setting up: Burp Suite and scope

The researcher was hunting on a private program and chose to test the main domain because a main domain has a large number of functionalities, which means more places for something to go wrong. Because of a full time job there was no time for reconnaissance, so the only tool used was Burp Suite.

Burp Suite is a program that sits between your browser and the websites you visit. You configure your browser to send its traffic through Burp, and Burp shows you every request and response, lets you pause them, edit them and resend them. Think of it as a transparent mail sorting office: every letter your browser sends and every reply it gets passes through, and you can open, read and rewrite any of them.

Reconnaissance (often shortened to recon) is the information-gathering phase: finding out which subdomains, pages and features exist before you start testing them. Skipping it and relying on Burp means the researcher let normal browsing do the discovery instead.

The scope was configured in Burp under Target -> Scope with the regex \.redacted\.com. A regex (regular expression) is a pattern used to match text. This particular pattern matches anything containing .redacted.com, so Burp only records and shows traffic to that company's domains and ignores everything else. Setting a scope keeps the history readable and keeps the researcher inside the rules of the program.

With that scope in place, Burp history collected the subdomains such as api.redacted.com and accounts.redacted.com together with their endpoints and parameters, which made it straightforward to test each URL endpoint with parameters.

An endpoint is a specific address on a server that does a specific job, for example /social-login/remove. A parameter is a named value sent along with a request, like type=google. The history gave the researcher a list of endpoints and the parameters each one expects, which is exactly the raw material for access control testing.

Two test accounts

Two accounts were created with different email addresses, one acting as attacker and one as victim. The author notes explicitly that the IDOR was performed only against these test accounts and not against real users' accounts.

This is standard practice and also an ethical requirement. To prove that one user can affect another user's data, you need two users you control. Using real people's accounts would be unauthorised access, even on a program that invites testing.

Finding it

On the attacker account, a Google OAuth connection was made. OAuth is a standard way for one website to let another website confirm who you are, without sharing your password. When you click "Sign in with Google", Google asks you to approve, then hands the website a confirmation. The website stores a link between your account on its side and your Google identity. That stored link is the "connection".

The request that removes a connection was then intercepted in Burp, and it contained an emailAddress parameter. Intercepting means telling Burp to pause a request before it reaches the server, so you can read and change it.

That parameter is the object reference. The server takes the email address from the request body and acts on the account it belongs to, rather than deriving the account from the authenticated session. The session is how the server knows who you are: after you log in, your browser holds a cookie or token, and the server uses it to recognise you on each later request. If the server had used the session to decide whose connection to remove, the attack would not work. Instead it used the email address typed into the request, which the attacker controls.

Exploitation

Step 1: Capture the remove connection request

With the attacker account connected to Google, the remove connection action was intercepted. The captured request was:

HTTP
POST /social-login/remove HTTP/2
Host: accounts.redacted.com
User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/101.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Request-With: XMLHttpRequest
Content-Length: 48
Origin: redacted.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

type=google&emailAddress=fozisimi123%40gmail.com

Line by line, in plain words:

  • POST /social-login/remove HTTP/2: this is the request line. POST is the method, meaning "I am sending data and asking you to do something with it". /social-login/remove is the endpoint, the specific address on the server. HTTP/2 is the version of the language the browser and server use to talk.
  • Host: accounts.redacted.com: which server the request is for. One server can host many sites, so the host name tells it which one.
  • User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/101.0: the browser identifying itself. Servers sometimes use this to decide what to send back.
  • Accept: */*: what kinds of reply the browser will accept. */* means anything.
  • Accept-Language: en-US,en;q=0.5: the preferred languages, here US English first, then generic English.
  • Accept-Encoding: gzip, deflate: the browser can accept compressed replies to save bandwidth.
  • Content-Type: application/x-www-form-urlencoded; charset=UTF-8: how the data in the body is formatted. Form-encoded means it looks like name=value&name=value, the same format a plain HTML form uses. The charset says the text is UTF-8.
  • X-Request-With: XMLHttpRequest: a header the page's script adds to mark the request as coming from JavaScript rather than a normal page load. (The usual spelling is X-Requested-With; this is how it appears in the captured request.)
  • Content-Length: 48: the size of the body in bytes, so the server knows where the body ends.
  • Origin: redacted.com: which site the request came from. Browsers add this automatically and servers use it for cross-origin checks.
  • Sec-Fetch-Dest: empty, Sec-Fetch-Mode: cors, Sec-Fetch-Site: same-origin: browser-added hints about the request. same-origin means the page and the server are considered the same site, which is why the request is allowed at all.
  • Te: trailers: tells the server the client can handle trailing headers. Rarely relevant to the bug.
  • The blank line separates the headers from the body.
  • type=google&emailAddress=fozisimi123%40gmail.com: the body. type selects the provider, here Google. emailAddress is the address of the account whose connection is being removed. %40 is the URL encoding of the @ sign, because @ has a special meaning in URLs and has to be escaped.

The request is sent as form-encoded data, with Origin: redacted.com and Sec-Fetch-Site: same-origin.

Step 2: Swap the email address for the victim's

The only change made was to replace the email address in the body with the address of the second (victim) account. The request was then sent while still authenticated as the attacker.

This is the whole attack. No clever payload, no special tooling. The researcher kept their own session, so the server still believed the request came from the attacker, but changed the one value that told the server whose connection to remove. The reason for doing it this way is to isolate the variable: if the request succeeds with only the email changed, the email is the thing the server is trusting.

Step 3: Observe the result

The Google connection was removed from the victim account successfully, with no interaction from the victim. The attacker only needs the victim's email address to remove any social account connection from that user's account.

Root cause

The endpoint trusts a client-supplied identifier, emailAddress, to decide which account's social connection to delete. It does not bind that identifier to the authenticated session, so any authenticated user can name another user's address and have the action applied to that account. The author's framing is that the application uses the identifier for direct access to an object without checking access control or authentication for that object.

In the cloakroom comparison: the attendant looks only at the number you say, never at whether the ticket in your hand matches it.

Impact

An attacker who is authenticated and who knows a victim's email address can remove any of the victim's connected social accounts (Google, LinkedIn, Twitter, Facebook, per the settings page) without the victim's involvement. The action is destructive to the victim's account configuration and requires no interaction from them. The precondition is knowledge of the victim's email address.

Fix

The report does not describe any fix or remediation.

In plain terms: the server should look at the ticket in your hand, not at the number you say out loud.

Variants to test

These are follow-up checks in the same pattern.

  1. Remove or disconnect endpoints for other providers: change type to linkedin, twitter or facebook while keeping the victim's emailAddress, and check whether the connection is removed. A positive result is a success response and the connection gone from the victim account.
  2. Other account settings actions that take an identifier in the body: look for parameters such as email, user id or username on endpoints that change account state, and substitute a second test account's value. A positive result is the change appearing on the second account.
  3. Identifier formats: try the victim's numeric user id or username in place of the email address where the endpoint accepts them. A positive result is the same unauthorised action succeeding.
  4. Method and content type variations: replay the same body as JSON or as query parameters, and try PUT or DELETE on the same path. A positive result is the action still being applied to the named account.
  5. Session binding check: send the request with the attacker's session but the victim's identifier, then confirm from the victim's own session that the state changed. A positive result is a state change visible to the victim without any action by them.

Glossary

  • API: the set of addresses and rules a website's own pages use to talk to its servers in the background.
  • Authentication: proving who you are, usually by logging in.
  • Access control: deciding what an authenticated (or anonymous) user is allowed to do.
  • Bug bounty program: a scheme where a company invites outside researchers to find and report security problems, often for a reward.
  • Private program: a bug bounty program open only to invited researchers.
  • Burp Suite: a tool that sits between your browser and websites, letting you view, pause, edit and resend requests.
  • Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests.
  • Token: a value, similar in purpose to a cookie, that proves your session to the server.
  • Session: the server's record of your logged-in state, tied to a cookie or token.
  • Domain: the main part of a web address, such as example.com.
  • Subdomain: a prefix on a domain, such as accounts.example.com.
  • Endpoint: a specific address on a server that performs a specific job, such as /social-login/remove.
  • Parameter: a named value sent with a request, such as type=google.
  • Request: a message your browser sends to a server asking it to do something.
  • Response: the server's reply to a request.
  • Header: a labelled line in a request or response carrying metadata, such as Host or Content-Type.
  • Body: the part of a request carrying the actual data, after the blank line.
  • Method: the verb of a request, such as GET, POST, PUT or DELETE.
  • POST: a method used to send data and ask the server to act on it.
  • XHR (XMLHttpRequest): the mechanism JavaScript uses to send background requests.
  • Form-encoded: a body format like name=value&name=value.
  • URL encoding: replacing characters with % codes so they can travel safely in a URL, for example @ becomes %40.
  • Origin: the combination of scheme, host and port a request comes from, used by browsers for security checks.
  • Same-origin: a request where the page and the server are considered the same site.
  • Regex (regular expression): a text pattern used to match strings, here used to limit Burp's scope.
  • Scope: the set of targets a tool or a program allows you to work on.
  • Reconnaissance (recon): the information-gathering phase before testing, finding subdomains, pages and features.
  • OAuth: a standard that lets one website confirm your identity through another, such as "Sign in with Google", without sharing your password.
  • IDOR (Insecure Direct Object Reference): an access control flaw where an application uses an identifier from the user to reach an object in its database without checking that the user is allowed to access it.
  • Object reference: the identifier used to point at a specific record, here the email address.
  • Root cause: the underlying reason a vulnerability exists, as opposed to its symptoms.
  • Impact: the harm an attacker can cause by exploiting a vulnerability.
  • Remediation / fix: the change that removes the root cause.
  • Variant: a related place where the same mistake might also exist.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.