Skip to content
Access control Write-up Intermediate

Interesting Privilege Escalation In an Old Private Program

A REST API endpoint that let normal users update their own profile's bio field also accepted other fields, including the display name, without checking the user's role. An attacker could change parameters on the live_profile table that only certain roles should be allowed to modify.

Zunaid Mahmud Follow

Published on ivreznap.medium.com

Bounty$900 View original

Assalamu Alaikum, I am Zunaid Mahmud from Dhaka, Bangladesh and this is my first write up about a interesting privilege escalation I found recently.

Zunaid Mahmud, on ivreznap.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. 5 min read.

Context

This is a privilege escalation story from an old private program with an unusually large surface: more than 500 user role and permission types, and more than 2,500 tables that those roles could read or modify data in. The researcher, Zunaid Mahmud from Dhaka, Bangladesh, describes it as a nightmare in terms of functionality, even though rich functionality is normally what bug hunters want.

The product had an organisation admin with all accesses and permissions, plus a large set of user roles for managing different functions. Two profile concepts existed inside the organisation:

  • The main profile, whose data comes from the sys_user table.
  • A live_profile table, which is created automatically based on the sys_user table and is used for some kind of blogging page.

A normal user could update their own bio on the profile page, but the User Name could only be changed by the organisation admin. The admin-facing request was submitted with a .do file and a urlencoded form body.

Setup

There is no tooling, version or account list in the report beyond the roles described above. The relevant preconditions are:

  1. A normal user account in the organisation, able to edit its own bio.
  2. The profile page that exposes the User Name and the bio field.
  3. A REST API endpoint, used by the same page, that updates the bio parameter of the profile table with a PUT request and a JSON body.

By the time the bug was noticed, the researcher had already been hunting on the program for 17 days and had submitted some bugs.

Finding it

The starting point was an attempt to change the user profile as a normal user, which was not possible because only the organisation admin could do it. The researcher then spent time looking for an IDOR on a particular profile page that contained the User Name and a bio. The bio was updateable by a normal user, the User Name was not. The bio was updated, the request was captured for analysis, and IDOR attempts followed, without luck.

What mattered was in the request history: a REST API request with the PUT method and a JSON body, hitting the endpoint that updated the same profile table's bio parameter. The bio parameter was immediately changed to name with a random value, to see whether the name parameter could be changed through the same endpoint. The response showed the name parameter changed.

A reload of the profile showed the name unchanged, which was the confusing part. Looking at the request again revealed the table being updated: live_profile. Searching the table name together with the company name showed that this was a different profile, used for a blogging page, not the main profile backed by sys_user.

Exploitation

Step 1: Capture the legitimate bio update

The normal user updates the bio on the profile page. The request is a PUT to the REST endpoint with a JSON body, and it updates the bio parameter of the profile table. The report does not reproduce the exact request or its fields.

Step 2: Swap the parameter name

The bio parameter in the JSON body is replaced with name and a random value. The response confirms that the name parameter was changed. The exact payload is not shown in the report.

Step 3: Understand why the profile page did not change

The reloaded profile still showed the old name because the endpoint writes to live_profile, while the main profile reads from sys_user. The live_profile table is generated automatically from sys_user, so the two are separate stores.

Step 4: Establish what a normal user is allowed to write

The researcher checked which users were permitted to write to the live_profile table. A normal user could update only the profile picture and the bio parameters of live_profile, among the other parameters in that table. Changing the name parameter should therefore have been rejected, but the system allowed the change. That was the issue. Some other parameters could also be changed without holding the required user role.

From the original on ivreznap.medium.com

Root cause

The report does not explain why the endpoint accepted the name parameter. What it shows is that a normal user was meant to write only the profile picture and bio in live_profile, yet the API accepted name and some other parameters. Because live_profile is a separate table from sys_user, the change did not show on the main profile, which is why the effect was easy to miss on reload.

Impact

A normal user could modify parameters of the live_profile table that they were not authorised to change, including the name, and some other parameters as well, without having the required user role. The report does not describe what those other parameters control or what the blogging page does with them. The main sys_user profile was not affected by this path.

Fix

A fix would need to make the endpoint reject any field a normal user is not allowed to write.

Variants to test

  1. On any REST endpoint that updates a profile, replace an allowed field with a privileged one in the JSON body and check whether the response reflects the change. A positive result is a response confirming the privileged field was written.
  2. Compare the UI restriction with the API: if the form only offers bio, send the full object with name and other fields. A positive result is any field outside the allowed set being accepted.
  3. Look for parallel tables generated from a main table, as live_profile is generated from sys_user, and test whether the generated table's endpoint has weaker checks than the main one. A positive result is a write to the generated table that the main table would refuse.
  4. Check whether the change is visible only after the generated table is refreshed or on a different page. A positive result is a stored change that appears on the blogging or secondary page rather than the main profile.

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

What happened, in plain words

A security researcher found a way for an ordinary user of a website to change information they were not supposed to be able to change. The website had a very complicated system of user roles: more than 500 different role and permission types, and more than 2,500 tables (think of tables as big spreadsheets where the site stores its data). Each role was meant to be allowed to touch only certain things.

On a profile page, a normal user could edit their own bio (a short description about themselves) but not their User Name. Only the organisation admin was supposed to be able to change the User Name. While looking at the requests the page made behind the scenes, the researcher noticed a second, hidden way the page saved the bio: a request to an API (a way for the page to talk to the server without reloading) that sent the data in a structured format called JSON. By swapping the word bio for name in that request, the researcher found the server would happily change the name too, even though the normal user was not allowed to do that. That is a privilege escalation: doing something that should require a higher level of permission than you have.

The change did not appear on the main profile page, which was confusing at first. The reason was that the request was writing to a different table, live_profile, which is a separate copy used for a blogging page, while the main profile reads from a table called sys_user. The researcher then confirmed that a normal user was only supposed to be able to write the profile picture and bio fields in live_profile, yet the system accepted the name field and some other fields as well.

The background

The program was old but had a huge amount of functionality. The researcher calls this a nightmare in terms of functionality, even though bug hunters usually love features, because more features mean more places for mistakes. There were more than 500 user role and permission types and more than 2,500 tables that those roles could read or modify data in.

A user role is a label attached to an account that says what that account is allowed to do. Think of a hotel: a guest can open their own room, a cleaner can open many rooms but not the manager's office, and the manager can open everything. A permission is one specific thing a role is allowed to do, such as "edit bio" or "change name".

The site had an organisation admin with all accesses and permissions, plus a large set of user roles for managing different functions. There were two kinds of profile inside the organisation:

  • The main profile, whose data comes from the sys_user table.
  • A live_profile table, which is created automatically based on the sys_user table and is used for some kind of blogging page.

A table here is a store of data on the server, like one sheet in a spreadsheet, with named columns such as name, bio and profile picture. sys_user is the main sheet of users; live_profile is a second sheet generated from it for the blogging feature.

A normal user could update their own bio on the profile page, but the User Name could only be changed by the organisation admin. The admin-facing request was submitted with a .do file and a urlencoded form body. A .do file here is the kind of address the site's server software uses for its pages and actions; it is part of the URL, not something you download. A urlencoded form body is how a plain HTML form sends its fields: pairs like field=value joined with &, with special characters escaped. It is the format you see in the address bar after submitting a search form.

Before the finding

There is no tooling, version or account list in the report beyond the roles described above. The relevant preconditions are:

  1. A normal user account in the organisation, able to edit its own bio.
  2. The profile page that exposes the User Name and the bio field.
  3. A REST API endpoint, used by the same page, that updates the bio parameter of the profile table with a PUT request and a JSON body.

A REST API endpoint is a specific address on the server that accepts a particular kind of request and does one job, such as "update this profile". PUT is one of the standard request methods (verbs) used on the web; it means "replace or update this thing". JSON is a text format for structured data, made of names and values in curly braces, like {"bio": "hello"}. A parameter is one named field inside that data, such as bio or name.

By the time the bug was noticed, the researcher had already been hunting on the program for 17 days and had submitted some bugs.

Finding it

The starting point was an attempt to change the user profile as a normal user, which was not possible because only the organisation admin could do it. The researcher then spent time looking for an IDOR on a particular profile page that contained the User Name and a bio.

IDOR stands for Insecure Direct Object Reference. It means the site lets you reach someone else's data just by changing an identifier in a request, for example changing a number that points at your own record to a number that points at another person's record, without checking that the record belongs to you. A simple comparison: a cloakroom that hands out coats based on the ticket number you say, without checking the ticket is really yours.

The bio was updateable by a normal user, the User Name was not. The bio was updated, the request was captured for analysis, and IDOR attempts followed, without luck. Capturing a request means recording what the browser sent to the server, usually with the browser's developer tools or a proxy, so you can read it and later resend a modified copy.

What mattered was in the request history: a REST API request with the PUT method and a JSON body, hitting the endpoint that updated the same profile table's bio parameter. The request history is the list of everything the browser has sent. The bio parameter was immediately changed to name with a random value, to see whether the name parameter could be changed through the same endpoint. The response showed the name parameter changed. The response is what the server sends back; here it was a confirmation that the name field had been written.

A reload of the profile showed the name unchanged, which was the confusing part. Looking at the request again revealed the table being updated: live_profile. Searching the table name together with the company name showed that this was a different profile, used for a blogging page, not the main profile backed by sys_user.

Exploitation

Step 1: Capture the legitimate bio update

The normal user updates the bio on the profile page. The request is a PUT to the REST endpoint with a JSON body, and it updates the bio parameter of the profile table. The report does not reproduce the exact request or its fields.

Why this step: before you can bend a request, you need to see the normal, allowed version of it. The allowed action is the doorway; the question is whether the same doorway also opens other doors.

Step 2: Swap the parameter name

The bio parameter in the JSON body is replaced with name and a random value. The response confirms that the name parameter was changed. The exact payload is not shown in the report.

Why this step: the page only offers a box for bio, but the server may not check which field names arrive. Sending name instead of bio tests whether the server trusts the field name from the browser. A random value is used so that, if the change works, it is obvious and harmless.

Step 3: Understand why the profile page did not change

The reloaded profile still showed the old name because the endpoint writes to live_profile, while the main profile reads from sys_user. The live_profile table is generated automatically from sys_user, so the two are separate stores.

Why this step: a change that does not show up can look like a failure. Here it was a success in a place the researcher was not looking at. Understanding which table the request writes to explains the gap between the response and the page.

Step 4: Establish what a normal user is allowed to write

The researcher checked which users were permitted to write to the live_profile table. A normal user could update only the profile picture and the bio parameters of live_profile, among the other parameters in that table. Changing the name parameter should therefore have been rejected, but the system allowed the change. That was the issue. Some other parameters could also be changed without holding the required user role.

Why this step: to prove it is a real security problem, you have to show what the rules were supposed to be. If everyone is allowed to change the name, there is no bug. The check showed the rule was "profile picture and bio only", and the server broke that rule.

From the original on ivreznap.medium.com

Triage is the stage where the program's team reviews a report, confirms it and decides how serious it is.

Root cause

The report does not explain why the endpoint accepted the name parameter. What it shows is that a normal user was meant to write only the profile picture and bio in live_profile, yet the API accepted name and some other parameters. Because live_profile is a separate table from sys_user, the change did not show on the main profile, which is why the effect was easy to miss on reload.

UI means user interface: the buttons, boxes and pages you see in the browser. The lesson is that hiding or disabling a box in the page does not stop anyone, because the browser can send anything to the server. The server has to check every field itself.

Impact

A normal user could modify parameters of the live_profile table that they were not authorised to change, including the name, and some other parameters as well, without having the required user role. The report does not describe what those other parameters control or what the blogging page does with them. The main sys_user profile was not affected by this path.

Fix

A fix would need to make the endpoint reject any field a normal user is not allowed to write.

Variants to test

  1. On any REST endpoint that updates a profile, replace an allowed field with a privileged one in the JSON body and check whether the response reflects the change. A positive result is a response confirming the privileged field was written.
  2. Compare the UI restriction with the API: if the form only offers bio, send the full object with name and other fields. A positive result is any field outside the allowed set being accepted.
  3. Look for parallel tables generated from a main table, as live_profile is generated from sys_user, and test whether the generated table's endpoint has weaker checks than the main one. A positive result is a write to the generated table that the main table would refuse.
  4. Check whether the change is visible only after the generated table is refreshed or on a different page. A positive result is a stored change that appears on the blogging or secondary page rather than the main profile.

Glossary

  • API: a way for one piece of software, such as a web page, to ask a server to do something, usually by sending data to a specific address and getting data back.
  • Bio: a short free-text description a user writes about themselves on their profile.
  • Capturing a request: recording the exact data the browser sends to the server so it can be read and resent with changes.
  • Endpoint: a specific address on a server that accepts a particular kind of request and performs one job.
  • IDOR (Insecure Direct Object Reference): a flaw where changing an identifier in a request lets you reach another person's data because the server does not check that it belongs to you.
  • JSON: a text format for structured data made of names and values, such as {"bio": "hello"}.
  • live_profile: a table in this product, generated automatically from sys_user, used for a blogging page.
  • Parameter: one named field in a request or in a piece of data, such as bio or name.
  • Permission: one specific action an account is allowed to perform.
  • Privilege escalation: doing something that should require a higher level of permission than your account has.
  • PUT: a standard web request method meaning "update or replace this thing".
  • Request history: the list of requests the browser has sent, visible in its developer tools.
  • Response: the data the server sends back after a request.
  • REST API: a style of API where each address represents a thing, and standard methods such as PUT are used to act on it.
  • Role: a label on an account that groups together the permissions it has.
  • sys_user: the main table holding user data in this product.
  • Table: a store of data on the server, like one sheet in a spreadsheet, with named columns.
  • Triage: the stage where a bug bounty program reviews a report, confirms it and decides how serious it is.
  • UI (user interface): the pages, buttons and boxes you see and use in the browser.
  • Urlencoded form body: the format a plain HTML form uses to send fields, as field=value pairs joined with &.
  • User Name: the name shown for a user on their profile, which in this product only the organisation admin could change.
  • .do file: the kind of address used by this site's server software for its pages and actions.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.