Skip to content
IDOR Write-up Beginner

A Tale of Confusing IDOR

A lower-privileged 'Analyst' user could close an advertiser account by replaying the close-account request with a different account_id, even though only admins should have that ability. An attacker could close other users' advertiser accounts without authorisation.

Avi Follow

Published on quip.com

Bounty$2,500 View original

I have been bug hunting and researching web & mobile application for a while now. I used to mainly target private program either on Hackerone or Synack, but recently I’d decided to make a switch to public programs because -

Avi (@_naaash_), on quip.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. 5 min read.

Context

TikTok Business lets its users create "Advertiser Accounts". Within an advertiser account, users can be given roles, and the account owner can edit details, manage the roles of other users, or delete the advertiser account itself. The report focuses on that last action: closing an advertiser account. According to the report, closing an account was supposed to be a function available only to the admin of the advertiser account.

The researcher, Avi (@naaash), had mostly worked on private programmes on HackerOne and Synack before moving to public programmes. The report was filed against TikTok and disclosed on HackerOne on 17th May 2022.

Setup

The only precondition described is a logged-in TikTok Business user who belongs to an advertiser account. The issue involved the lower-privileged "Analyst" role, and Burp Suite was used to intercept and modify the request. The browser in the captured request was Firefox 98.0 on macOS 10.15.

Finding it

The researcher noticed that the "Close Account" button was available to the Analyst role, even though closing an advertiser account was meant to be restricted to the admin of that advertiser account. Clicking it closed the advertiser account from a lower-privileged session.

At first this looked like a privilege escalation issue. The researcher later realised it was an IDOR: the same HTTP request could be replayed with a different value of the account_id parameter, and that would close some other user's advertiser account. No prior authorisation check stood in the way of the replayed request.

Exploitation

Step 1: Log in and open an advertiser account

Go to https://business.tiktok.com/ and log in. Then go to the "Advertiser accounts" section and click on any of the available advertiser accounts.

Step 2: Trigger the close action

Click on the "Close" button. The report shows the interface at this point:

Screenshot_2022-03-18_at_3.47.14_PM.png

Step 3: Intercept the request

Intercept the resulting HTTP request using Burp Suite. The vulnerable request is:

HTTP
POST /api/v2/bm/account/close/?org_id=XXX HTTP/2
Host: business.tiktok.com
Cookie: REDACTED
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0
Accept: application/json, text/plain, /
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://business.tiktok.com/manage/account?org_id=XXX
Content-Type: application/json;charset=utf-8
X-Csrftoken: REDACTED
Content-Length: 67
Origin: https://business.tiktok.com
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

{"account_id":"YYY","org_id":"XXX"}

The endpoint is POST /api/v2/bm/account/close/, with the organisation identifier passed as the org_id query parameter. The JSON body carries two values: account_id, which identifies the advertiser account to close, and org_id, which matches the query string. The request is a same-origin CORS request from business.tiktok.com, carries the session cookie and an X-Csrftoken header, and expects a JSON response. In the report the cookie and CSRF token values are redacted, and the organisation and account identifiers are shown as XXX and YYY.

Step 4: Change the account ID

Change the value of the account_id parameter in the body to another user's advertiser account ID.

Step 5: Forward and observe the confirmation

Forward the request. The response displays a confirmation message:

Screenshot_2022-03-10_at_12.49.51_AM.png

Step 6: Confirm the account is closed

The other user's advertiser account is then closed:

Screenshot_2022-03-10_at_12.50.45_AM.png

Root cause

The close-account endpoint accepted an account_id supplied by the client and acted on it without checking that the caller was authorised for that particular advertiser account. The close action was available to the Analyst role, and the same request could be replayed with a different account_id. The report describes the issue as an IDOR precisely because no prior authorisation was needed for the replayed request.

Why the existing defences did not stop it is not described in the report.

Impact

A lower-privileged user (the Analyst role in the demonstration) could close an advertiser account, an action meant to be reserved for the admin of that advertiser account. By substituting another user's advertiser account ID, the same user could close an advertiser account belonging to someone else. The report does not describe any further effect beyond the account being closed.

The practical reach depends on knowing the target account_id. During triage the severity was reduced from 6.5 to 5.3 because the account_id value is a 19-digit non-incremental value, which makes guessing an identifier impractical.

Fix

The report does not describe the code change that resolved the issue. It records that the report was resolved on 25th April, after triage on 15th April and the severity reduction on 19th April.

Variants to test

  1. Role-gated actions in business or advertising consoles. Create a low-privilege role, look for actions the UI hides from it, and replay the underlying request directly. A positive result is the action succeeding from the low-privilege session.
  2. Identifier substitution on state-changing endpoints. Take any request whose body or query carries an object identifier and swap it for an identifier belonging to a second account you control. A positive result is the action applying to the second account while authenticated as the first.
  3. Destructive actions on shared resources. Test close, delete, transfer and remove-member operations across tenants. A positive result is the resource being closed or removed for an account you do not administer.
  4. A positive result is obtaining another tenant's identifier from a place your role can reach.

Timeline

Date Event
10th March Bug reported to TikTok
15th March Clarified that it is an IDOR rather than privilege escalation
15th March to 14th April Assisted HackerOne's triager, since the "Close" button was not available on their end
15th April Triaged
19th April Severity reduced from 6.5 to 5.3 because the account_id is a 19-digit non-incremental value
25th April Resolved
27th April Bounty awarded
3rd May Disclosure requested
17th May Report disclosed 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. 12 min read.

What happened, in plain words

TikTok Business is a website where companies manage their advertising on TikTok. Inside it, a company can create what the report calls an "Advertiser Account": a container that holds the advertising settings and the people who work on them. Users can edit details, manage roles of other users, or delete the advertiser account.

Closing an advertiser account was meant to be something only the admin of that account could do. The researcher, Avi (@naaash), found that a user with a much weaker role, called "Analyst", could also close the account. At first this looked like one user getting more power than they should have. Later the researcher realised the deeper problem: the request that closes an account contains the account's identifier (a number that names the account), and the server never checked that the person sending the request was allowed to touch that particular account. So anyone could send the same request again with a different account number and close somebody else's advertiser account.

That kind of bug is called an IDOR, short for Insecure Direct Object Reference. The name sounds complicated, but the idea is simple: the server takes an identifier straight from the user and acts on it without asking "are you allowed to use this one?". A everyday comparison: imagine a hotel where the receptionist hands you a key card with your room number on it, and the door lock only checks that the card is valid, not that it belongs to that room. Any valid card would open any door. Here the "card" is your login session, and the "room number" is the account_id.

The report was filed against TikTok and disclosed on HackerOne on 17th May 2022.

Background

The researcher explains that they had been hunting bugs and researching web and mobile applications for a while. Before this, they mostly targeted private programmes on HackerOne or Synack. A private programme is a bug bounty programme that only invited researchers can take part in; a public programme is open to anyone. They decided to switch to public programmes for three reasons, as they list them:

  • They pay waaayyy more than private programmes.
  • It is more challenging to come across a bug since the same application is tested at least a million times.
  • It helps them make content about the bugs they come across so they can give something back to the community.

A bug bounty programme is a scheme where a company invites people to look for security problems in its systems and pays for valid reports. HackerOne and Synack are platforms that host such programmes.

Description

TikTok Business allows its users to create "Advertiser Accounts". The user can then edit, manage roles of other users, or delete that particular advertiser account as per their needs. The deleting functionality was surprisingly available to the "Analyst" role (a lower-privileged user) as well. All the lower-privileged user had to do was click the "Close Account" button, and the advertiser account would be closed, even though this functionality was only available to the admin of the advertiser account.

A role is a label attached to a user account that says what that user is allowed to do. An admin is the role that could close the account; an Analyst is a lower-privileged role. The point of the finding is that the button was visible and working for a role that should not have had it.

The researcher much later realised that this is an IDOR, since no prior authorisation was needed: the same HTTP request could be replayed with a different value of the account_id parameter, and that would close some other user's advertiser account.

Two ideas need unpacking here. An HTTP request is the message your browser sends to a website's server when you do something, for example when you click a button. It has a method (such as POST, meaning "please create or change something"), a path (which part of the site you are talking to), headers (extra information about the request) and often a body (the data you are sending). To "replay" a request means to send that same message again, possibly with small changes, without going through the website's buttons at all. A parameter is simply a named value inside a request; account_id is a parameter whose value is the identifier of an advertiser account.

The vulnerable HTTP request

The report shows the request that the "Close" button produces:

HTTP
POST /api/v2/bm/account/close/?org_id=XXX HTTP/2
Host: business.tiktok.com
Cookie: REDACTED
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0
Accept: application/json, text/plain, /
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://business.tiktok.com/manage/account?org_id=XXX
Content-Type: application/json;charset=utf-8
X-Csrftoken: REDACTED
Content-Length: 67
Origin: https://business.tiktok.com
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

{"account_id":"YYY","org_id":"XXX"}

Line by line, in plain words:

  • POST /api/v2/bm/account/close/?org_id=XXX HTTP/2: this is the first line of the request. POST is the method, used when something is being changed on the server. /api/v2/bm/account/close/ is the address of the piece of software on the server that handles closing an account; such an address is often called an endpoint. An API (Application Programming Interface) is the set of endpoints a website's own pages talk to behind the scenes; here the browser's page calls the API to do the closing. ?org_id=XXX is a value attached to the address itself, called a query parameter; org_id identifies the organisation, and XXX stands in for the real value. HTTP/2 is the version of the language used to send the request.
  • Host: business.tiktok.com: which website the request is addressed to.
  • Cookie: REDACTED: a cookie is a small piece of data the website stored in your browser when you logged in, and the browser sends it back with every request so the server knows who you are. The real value is hidden here because it would let anyone act as the researcher.
  • User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0: tells the server which browser and operating system were used. Here it was Firefox 98.0 on macOS 10.15.
  • Accept: application/json, text/plain, /: which kinds of response the browser is willing to accept. JSON is a text format for structured data, made of names and values in curly braces.
  • Accept-Language: en-US,en;q=0.5: the language the browser prefers.
  • Accept-Encoding: gzip, deflate: the browser can accept compressed responses to save bandwidth.
  • Referer: https://business.tiktok.com/manage/account?org_id=XXX: the page the request was sent from.
  • Content-Type: application/json;charset=utf-8: says that the body of the request is JSON text.
  • X-Csrftoken: REDACTED: a CSRF token is a secret value that the website puts into its pages and expects back with requests that change something. Its purpose is to prove the request came from the site's own pages and not from a malicious page pretending to be you. CSRF stands for Cross-Site Request Forgery. The real value is hidden here.
  • Content-Length: 67: the size of the body in bytes.
  • Origin: https://business.tiktok.com: which site the request originates from.
  • Dnt: 1: a request that the user prefers not to be tracked.
  • Sec-Fetch-Dest: empty, Sec-Fetch-Mode: cors, Sec-Fetch-Site: same-origin: modern browser headers that describe the context of the request. same-origin means the request comes from the same site it is going to. CORS is a set of rules browsers use to decide whether a page from one site may talk to another site.
  • Te: trailers: a header about how the connection is handled.
  • The blank line separates the headers from the body.
  • {"account_id":"YYY","org_id":"XXX"}: the body. It is JSON with two names and values. account_id names the advertiser account to close, shown as YYY. org_id names the organisation, shown as XXX, and matches the value in the address above.

The important part for the bug is the account_id in the body: it is supplied by the browser, and the server acts on whatever value it receives.

Steps to reproduce

  1. Go to https://business.tiktok.com/ and log in to your account. You need to be logged in because the server uses your cookie to know who you are.
  2. Go to the "Advertiser accounts" section and click on any of the available advertiser accounts. This opens the account you are about to act on.
  3. Click on the "Close" button. The report shows the interface at this point:

Screenshot_2022-03-18_at_3.47.14_PM.png

  1. Intercept the vulnerable HTTP request using Burp Suite. Burp Suite is a tool that sits between your browser and the website and lets you pause a request, look at it, change it, and then send it on. Intercepting is how you get to see and edit the request that a button click produces.
  2. Change the value of the account_id parameter to another user's advertiser account ID. This is the actual attack: the request is otherwise the same, but it now names a different account.
  3. Forward the request. The response will display a confirmation message. Forwarding means letting the paused request continue to the server. The report shows the confirmation:

Screenshot_2022-03-10_at_12.49.51_AM.png

  1. The other user's advertiser account will then be closed. The report shows the result:

Screenshot_2022-03-10_at_12.50.45_AM.png

Why it worked

The close-account endpoint accepted an account_id supplied by the client and acted on it without checking that the caller was authorised for that particular advertiser account. The close action was available to the Analyst role, and the request itself could be replayed with a different account_id. The report describes the issue as an IDOR precisely because no prior authorisation was needed for the replayed request.

Why the existing defences did not stop it is not described in the report.

Impact

A lower-privileged user (the Analyst role in the demonstration) could close an advertiser account, an action meant to be reserved for the admin of that advertiser account. By substituting another user's advertiser account ID, the same user could close an advertiser account belonging to someone else. The report does not describe any further effect beyond the account being closed.

The practical reach depends on knowing the target account_id. During triage the severity was reduced from 6.5 to 5.3 because the account_id value is a 19-digit non-incremental value, which makes guessing an identifier impractical. Severity is a score used by bounty platforms to express how serious a bug is; a higher number means more serious. Non-incremental means the numbers do not simply go up by one (1, 2, 3...), so you cannot find a neighbour's account by adding one to your own.

Fix

The report does not describe the code change that resolved the issue. It records that the report was resolved on 25th April, after triage on 15th April and the severity reduction on 19th April. In other words, the server, not the page, must decide who may close what.

Variants to test

  1. Role-gated actions in business or advertising consoles. Create a low-privilege role, look for actions the UI hides from it, and replay the underlying request directly. A positive result is the action succeeding from the low-privilege session.
  2. Identifier substitution on state-changing endpoints. Take any request whose body or query carries an object identifier and swap it for an identifier belonging to a second account you control. A positive result is the action applying to the second account while authenticated as the first.
  3. Destructive actions on shared resources. Test close, delete, transfer and remove-member operations across tenants. A tenant is one customer's separate space inside a shared service. A positive result is the resource being closed or removed for an account you do not administer.
  4. Entropy here means how hard a value is to guess. A positive result is obtaining another tenant's identifier from a place your role can reach.

Timeline

Date Event
10th March Bug reported to TikTok
15th March Clarified that it is an IDOR rather than privilege escalation
15th March to 14th April Assisted HackerOne's triager, since the "Close" button was not available on their end
15th April Triaged
19th April Severity reduced from 6.5 to 5.3 because the account_id is a 19-digit non-incremental value
25th April Resolved
27th April Bounty awarded
3rd May Disclosure requested
17th May Report disclosed on HackerOne

A triager is the person at the bounty platform who first checks a report, asks questions and decides whether it is valid. Privilege escalation is a different kind of bug where a user gains powers they were not given; the researcher clarified that this was not that, but an IDOR.

Glossary

  • Advertiser Account: a container inside TikTok Business that holds a company's advertising settings and the people who work on them.
  • Admin: the role that could close the advertiser account.
  • Analyst: a lower-privileged role in the report.
  • API: the set of endpoints a website's own pages talk to behind the scenes to read and change data.
  • Authorisation: the check of whether a logged-in user is allowed to perform a particular action on a particular thing.
  • Body: the part of an HTTP request that carries the data being sent, here a JSON object.
  • Bug bounty programme: a scheme where a company pays researchers for valid security reports.
  • Burp Suite: a tool that sits between browser and website so requests can be paused, inspected and modified.
  • Cookie: a small piece of data stored by a website in your browser and sent back with each request, used here to identify your session.
  • CORS: browser rules that decide whether a page from one site may talk to another site.
  • CSRF token: a secret value placed in a site's pages and expected back with state-changing requests, to prove the request came from the site itself.
  • Endpoint: the address of a specific piece of server software that handles a particular action.
  • Entropy: how hard a value is to guess.
  • Header: extra information attached to an HTTP request, such as the cookie or the browser type.
  • HTTP request: the message a browser sends to a server when you do something on a website.
  • IDOR (Insecure Direct Object Reference): a bug where the server takes an identifier from the user and acts on it without checking the user is allowed to use that identifier.
  • JSON: a text format for structured data, made of names and values in curly braces.
  • Method: the word at the start of an HTTP request (such as POST) saying what kind of action is wanted.
  • Non-incremental: a numbering scheme where values do not simply go up by one, so neighbours cannot be guessed.
  • Parameter: a named value inside a request, such as account_id.
  • Privilege escalation: a bug where a user gains powers they were not given.
  • Private programme: a bug bounty programme open only to invited researchers.
  • Public programme: a bug bounty programme open to anyone.
  • Query parameter: a value attached to the address of a request after a question mark, such as org_id=XXX.
  • Replay: to send a captured request again, possibly with small changes, without using the website's buttons.
  • Role: a label on a user account saying what that user is allowed to do.
  • Severity: a score expressing how serious a bug is; a higher number means more serious.
  • Tenant: one customer's separate space inside a shared service.
  • Triager: the person at a bounty platform who first checks a report and decides whether it is valid.
  • User-Agent: a header telling the server which browser and operating system were used.

More from TikTok

View all

The newest disclosed reports for this program.

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.