Skip to content
Access control Write-up Intermediate

Broken access control + misconfiguration = Beautiful privilege escalation

A low-privileged creator role could read organisation user details and change user statuses and roles due to missing access control checks. This allowed the attacker to escalate their own role to account manager and take over the organisation.

Hossam Mesbah Follow

Published on medium.com

Role [2] is the creator and role [1] is the account manager So I replaced the cookies to the Creator role account cookies and changed the UUID to the same creator role account UUID I get it from the broken access control above and also I was able to edit any other users’ roles due to I was able to retrieve there UUID’s

Hossam Mesbah, 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. 7 min read.

Context

This write-up describes a privilege escalation found in a multi-tenant account management product. The site has two roles:

  • Account owner (account manager): the management role, able to access the full set of account users and other functions.
  • Creator: able to create some things in the organisation, but not to access user information, UUIDs, or other organisation information and PII.

The researcher's goal was to move from the creator role to the account manager role, and the path ran through two separate weaknesses: a broken access control that leaked user data, and a misconfiguration that let a low-privileged user call a privileged write function.

Setup

Two accounts were used, one per role. The creator account is referred to as the "Few user role" account, and its cookies appear in the requests as FewRoleUserCookies and FewUserCookies. The host is shown as dontlookhere, and the Referer and Origin headers point at the same host, so the requests were made in the context of the application itself.

The captured requests show Firefox 106.0 on macOS in the first request and Firefox 107.0 in the later one. The application speaks JSON: Accept: application/json, text/plain, */* on reads and Content-Type: application/json;charset=utf-8 on writes.

Finding it

The researcher tried most endpoints with the low-privileged account looking for broken access control. Most of them returned 403 Forbidden. One endpoint did not: it returned the organisation's user information and PII to a user who should not have been able to see it.

That leak alone is a vulnerability, but it was not yet privilege escalation. The write functions behaved as expected: add user, delete user and the other write operations returned 403. Only one function executed and returned 200 on the low-privileged account, and that is where the escalation came from.

Exploitation

Step 1: read the organisation's users with a low-privileged account

The endpoint below let the unauthorised user access organisation information and PII:

HTTP
GET /v1/account/customer/users?includeDetails=true HTTP/1.1
Host: dontlookhere
Cookie: FewRoleUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close

The request carries the query parameter includeDetails=true. With the creator's cookies, the response contained the organisation's user information: email addresses, phone numbers, UUIDs, addresses and more. Those UUIDs are the key material for the next step, because the write endpoints address users by UUID.

Step 2: confirm which write function is reachable

Most write functions returned 403 for the creator account. One function returned 200, so the researcher built a request against it. One write tested was the status change:

HTTP
PUT /v1/myaccountapi/account/customers/users/UUID-bd796c52dca7/status HTTP/1.1
Host: dontlookhere
Cookie: FewUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Content-Type: application/json;charset=utf-8
X-Csrf-Token:
X-Xsrf-Token:
Content-Length: 69
Origin: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close

{"status":"DISABLED","userId":"UUID–886f-bd796c52dca7"}

The user is selected in the path (/users/UUID-bd796c52dca7/status) and again in the JSON body (userId), and the body sets status to DISABLED. The request was accepted without a 403: the target user was moved to the deactivated status, and could be reactivated the same way. The X-Csrf-Token and X-Xsrf-Token headers are present but empty in the captured request.

Step 3: change a role

The second write function was the role change, and this is the one that produced the escalation:

HTTP
PUT /v1/myaccountapi/billing/customers/users/UUID-553486df4683/roles HTTP/2
Host: dontlookhere
Cookie: FewUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Content-Type: application/json;charset=utf-8
X-Csrf-Token:
Content-Length: 3
Origin: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

[1]

The body is [1]; role [2] is the creator and role [1] is the account manager. Role [2] is the creator and role [1] is the account manager, so sending [1] asks the API to make the addressed user an account manager. The request was sent with the creator account's cookies, and the UUID in the path was the creator account's own UUID, taken from the user listing in step 1. Because the same listing exposed every other user's UUID, the same request could be aimed at any other user's roles as well.

The request executed successfully. The account role changed to account manager, which in practice made the researcher the admin of the organisation.

Root cause

Two mistakes combine here.

  1. Missing authorisation check on the read endpoint. GET /v1/account/customer/users?includeDetails=true returned the full user list, including PII and UUIDs, to a creator. The role model says a creator must not see user information or UUIDs, so the endpoint was not enforcing the role boundary that the rest of the API enforced with 403.
  2. Missing authorisation check on the role-change endpoint. PUT /v1/myaccountapi/billing/customers/users/{uuid}/roles accepted a role array from a creator and applied it. The function was reachable and returned 200 where the other write functions returned 403, which points to a per-endpoint authorisation gap rather than a global one: the checks existed, but this route was not covered by them.

The two together turn a read leak into full takeover: the read supplies the UUIDs, and the write accepts them from the same low-privileged session. The CSRF token headers are present but empty in the captured requests; the report does not analyse them.

Impact

A creator, the lowest privileged role in the organisation, could:

  • read the organisation's user information and PII: email addresses, phone numbers, UUIDs, addresses and more;
  • activate and deactivate users;
  • change their own role and other users' roles, up to the account owner role, and thereby become the admin of the organisation.

The role change worked on the researcher's own account, and because every user's UUID was available from the read, the researcher states other users' roles could be edited too. The write functions other than status and roles (add user, delete user and the rest) returned 403 for the creator.

Fix

The report gives no fix. A reasonable remediation would be to apply a role check to these routes:

  • GET /v1/account/customer/users should require the account manager role, and should not return PII or UUIDs to a creator.
  • PUT /v1/myaccountapi/billing/customers/users/{uuid}/roles should require the account manager role, and should reject a role array that grants a role equal to or higher than the caller's own.
  • PUT /v1/myaccountapi/account/customers/users/{uuid}/status should likewise be restricted to the account manager role.

A server-side check on the role identifiers in the body, not just on the route, prevents a low-privileged caller from naming a privileged role. The report does not state which of these changes was actually made.

Variants to test

  • Per-endpoint authorisation gaps. Enumerate every route with the lowest-privileged account and look for the one that returns 200 where its siblings return 403. A positive result is a write that changes state for a user who should not be allowed to make it.
  • Detail flags on read endpoints. Try parameters such as includeDetails=true on user and organisation listings with a low-privileged session. A positive result is PII or identifiers in the response that the role should not see.
  • Identifier reuse across endpoints. Take UUIDs from a read endpoint and feed them into write endpoints that address users by UUID. A positive result is a write that succeeds against a user outside the caller's scope.
  • Role arrays in request bodies. Send role identifiers the caller does not hold, including the highest role, and check whether the server validates them against the caller's own role. A positive result is a role change to a level above the caller's.
  • Status toggles. Try activating or deactivating other users from a low-privileged session. A positive result is a state change on an account the caller does not manage.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store From the original on medium.com
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

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

What happened, in plain words

Imagine a shared office building. Most doors need a key card, and the building manager's card opens everything. A junior employee's card opens only their own desk drawer. One day the junior employee notices that a storage room door is unlocked: inside are files listing every tenant's name, phone number and address. That is bad, but it is only information. Then they notice that a second door, the one that controls who is allowed to be a manager, is also unlocked. They walk through it, change their own job title to manager, and now their card opens the whole building.

That is exactly what this report describes, in software. A website had two kinds of user accounts. One kind, the account owner (also called the account manager), is the boss: it can see every user in the organisation and use every function. The other kind, the creator, is a limited user: it can create some things, but it is not supposed to see other users' information, their identifiers, or any other private details about the organisation.

The researcher's goal was to start as a creator and end up as the account manager. The path ran through two separate mistakes in the website:

  1. One page that should have been locked returned private user data to the creator anyway. Security people call this broken access control: the website has a rule about who may see what, but one part of it does not enforce the rule.
  2. One action that should have been reserved for managers accepted a command from the creator anyway. This is a misconfiguration: a setting or check that was left out on one specific route while it was present on the others.

Neither mistake alone gives full control. The first gives you the keys (the identifiers of every user). The second lets you use those keys to promote yourself. Together they are a privilege escalation: moving from a low level of permission to a high one without being given it.

A few words you will meet constantly below, explained once here:

  • An API (Application Programming Interface) is the set of addresses a website's own pages use to talk to its server behind the scenes. When you click a button, your browser sends a small message to one of these addresses and the server answers, usually with data in a format called JSON (plain text structured with curly braces, like {"status":"DISABLED"}).
  • A request is that message from your browser to the server. It has a method (a verb such as GET to read or PUT to change), a path (the address), headers (extra labelled lines with details such as who you are), and sometimes a body (the data you are sending).
  • A cookie is a small piece of text your browser stores after you log in and sends back with every request so the server recognises your session. If someone else has your cookie, they are, as far as the server is concerned, you. In this report the cookies are shown as placeholders such as FewRoleUserCookies and FewUserCookies.
  • A UUID is a long, unique identifier string, like a serial number for a user. Many APIs address a specific user by putting their UUID in the address.
  • A role is a label attached to an account that says what it is allowed to do. Here there are two: creator and account manager.
  • PII stands for Personally Identifiable Information: data that identifies a real person, such as an email address, phone number or home address.
  • An HTTP status code is a three-digit number the server sends back. 200 means it worked. 403 means forbidden: the server understood you but refused. Seeing 403 everywhere except one place is a strong hint that the one place is missing a check.

Setting up

The researcher used two accounts, one for each role. The creator account is called the "Few user role" account in the report, and its cookies appear in the requests under the names FewRoleUserCookies and FewUserCookies. The website's address is shown as dontlookhere, a placeholder, and the Referer and Origin headers (which tell the server which page the request came from) point at the same host, meaning the requests were made as if from inside the application itself.

The captured requests show Firefox 106.0 on macOS for the first request and Firefox 107.0 for the later one. A proxy sits between your browser and the server and lets you pause a request, read it, edit it and send it on. It is how you turn a request the website made into one you wrote yourself. The application exchanges JSON: reads ask for Accept: application/json, text/plain, */* and writes declare Content-Type: application/json;charset=utf-8.

Finding it

The researcher tried most of the website's addresses (endpoints) while logged in as the low-privileged creator, looking for broken access control. Most of them answered 403 Forbidden, which is the correct behaviour: the server knew who was asking and said no. One endpoint did not. It handed back the organisation's user information and PII to a user who should never have seen it.

That leak on its own is a vulnerability, but it is not yet privilege escalation: reading data is not the same as gaining power. The write actions behaved properly too: adding a user, deleting a user and the other write operations all returned 403. Only one function ran and returned 200 for the low-privileged account, and that is where the escalation came from.

Exploitation

Step 1: read the organisation's users with a low-privileged account

The endpoint below let the unauthorised user access organisation information and PII:

HTTP
GET /v1/account/customer/users?includeDetails=true HTTP/1.1
Host: dontlookhere
Cookie: FewRoleUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close

Line by line:

  • GET /v1/account/customer/users?includeDetails=true HTTP/1.1 is the request line. GET means "read something". The path /v1/account/customer/users is the address of the user list. Everything after the ? is the query string, extra instructions attached to the address; here includeDetails=true is a query parameter attached to the address. HTTP/1.1 is the version of the language the browser and server speak.
  • Host: dontlookhere names the website being asked.
  • Cookie: FewRoleUserCookies is the placeholder for the creator account's session cookie. This is the whole point of the test: the request is made as the low-privileged user.
  • User-Agent says which browser and operating system sent the request. It is normal browser information, not an attack.
  • Accept: application/json, text/plain, */* says "I would like JSON back, plain text is fine too, and anything else as a last resort".
  • Accept-Language, Accept-Encoding and Dnt are ordinary browser preferences: language, whether compressed replies are acceptable, and a "do not track" hint.
  • Referer: https://dontlookhere says which page the request came from.
  • Sec-Fetch-Dest, Sec-Fetch-Mode and Sec-Fetch-Site are modern browser headers that describe the context of the request (what kind of resource it is for, whether it is cross-site, and so on).
  • Te: trailers and Connection: close are low-level transport details: the client can accept trailing headers, and the connection should be closed after the reply.

Why this step was taken: the researcher wanted to know whether the creator could see the user list at all. The answer was yes. The response contained the organisation's user information: email addresses, phone numbers, UUIDs, addresses and more. Those UUIDs matter enormously for the next step, because the write endpoints address a user by UUID. Without the UUIDs you cannot point a write at anyone; with them, you can point it at anyone.

Step 2: confirm which write function is reachable

Most write functions returned 403 for the creator account. One returned 200, so the researcher built a request against it. One write tested was the status change:

HTTP
PUT /v1/myaccountapi/account/customers/users/UUID-bd796c52dca7/status HTTP/1.1
Host: dontlookhere
Cookie: FewUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Content-Type: application/json;charset=utf-8
X-Csrf-Token:
X-Xsrf-Token:
Content-Length: 69
Origin: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close

{"status":"DISABLED","userId":"UUID–886f-bd796c52dca7"}

Line by line:

  • PUT ... /status HTTP/1.1 uses the PUT method, which means "change something". The path ends in /users/UUID-bd796c52dca7/status, so the target user is named in the address itself, and the thing being changed is their status.
  • Cookie: FewUserCookies again carries the creator's session. The request is being made by the low-privileged user.
  • Content-Type: application/json;charset=utf-8 announces that the body is JSON text.
  • X-Csrf-Token: and X-Xsrf-Token: are headers meant to carry a CSRF token, a secret value the site gives your page so the server can tell a genuine action from a forged one. Here both are present but empty in the captured request.
  • Content-Length: 69 says the body is 69 bytes long.
  • Origin: https://dontlookhere tells the server which site the request was sent from.
  • The blank line separates headers from body.
  • The body {"status":"DISABLED","userId":"UUID–886f-bd796c52dca7"} is JSON. It sets status to DISABLED and names the user again with userId. Notice the user is identified twice: once in the address and once in the body.

Why this step was taken: the researcher had found one function that answered 200 instead of 403, and wanted to see what it actually did. The request was accepted without a 403: the user was moved to the deactivated status, and could be reactivated the same way.

Step 3: change a role

The second write function was the role change, and this is the one that produced the escalation:

HTTP
PUT /v1/myaccountapi/billing/customers/users/UUID-553486df4683/roles HTTP/2
Host: dontlookhere
Cookie: FewUserCookies
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://dontlookhere
Content-Type: application/json;charset=utf-8
X-Csrf-Token:
Content-Length: 3
Origin: https://dontlookhere
Dnt: 1
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers

[1]

Line by line:

  • PUT ... /users/UUID-553486df4683/roles HTTP/2 targets the roles of one specific user, named by UUID in the address. This time the connection uses HTTP/2, a newer version of the same protocol.
  • Cookie: FewUserCookies is still the creator's session. The low-privileged user is asking for a role change.
  • Content-Type: application/json;charset=utf-8 says the body is JSON.
  • X-Csrf-Token: is again present and empty.
  • Content-Length: 3 says the body is three bytes long, which matches [1].
  • The body [1] is a JSON array; role [2] is the creator and role [1] is the account manager. Role [2] is the creator and role [1] is the account manager, so sending [1] asks the API to make the addressed user an account manager.

Why this step was taken: the researcher wanted to see whether the role-change function would accept a role the caller does not hold. The request was sent with the creator account's cookies, and the UUID in the path was the creator account's own UUID, taken from the user listing in step 1. Because that same listing exposed every other user's UUID, the identical request could be aimed at any other user's roles as well.

The request executed successfully. The account role changed to account manager, which in practice made the researcher the admin of the organisation.

Root cause

Two mistakes combine here.

  1. Missing authorisation check on the read endpoint. GET /v1/account/customer/users?includeDetails=true returned the full user list, including PII and UUIDs, to a creator. The role model says a creator must not see user information or UUIDs, so the endpoint was not enforcing the role boundary that the rest of the API enforced with 403.
  2. Missing authorisation check on the role-change endpoint. PUT /v1/myaccountapi/billing/customers/users/{uuid}/roles accepted a role array from a creator and applied it. The function was reachable and returned 200 where the other write functions returned 403, which points to a per-endpoint authorisation gap rather than a global one: the checks existed, but this route was not covered by them.

The two together turn a read leak into full takeover: the read supplies the UUIDs, and the write accepts them from the same low-privileged session. The CSRF token headers are present but empty in the captured requests; the report does not analyse them.

Impact

A creator, the lowest privileged role in the organisation, could:

  • read the organisation's user information and PII: email addresses, phone numbers, UUIDs, addresses and more;
  • activate and deactivate users;
  • change their own role and other users' roles, up to the account owner role, and thereby become the admin of the organisation.

The role change worked on the researcher's own account, and because every user's UUID was available from the read, the researcher states other users' roles could be edited too. The write functions other than status and roles (add user, delete user and the rest) returned 403 for the creator.

Fix

The report gives no fix. A reasonable remediation would be to apply a role check to these routes:

  • GET /v1/account/customer/users should require the account manager role, and should not return PII or UUIDs to a creator.
  • PUT /v1/myaccountapi/billing/customers/users/{uuid}/roles should require the account manager role, and should reject a role array that grants a role equal to or higher than the caller's own.
  • PUT /v1/myaccountapi/account/customers/users/{uuid}/status should likewise be restricted to the account manager role.

A server-side check on the role identifiers in the body, not just on the route, prevents a low-privileged caller from naming a privileged role. The report does not state which of these changes was actually made.

Variants to test

  • Per-endpoint authorisation gaps. Enumerate every route with the lowest-privileged account and look for the one that returns 200 where its siblings return 403. A positive result is a write that changes state for a user who should not be allowed to make it.
  • Detail flags on read endpoints. Try parameters such as includeDetails=true on user and organisation listings with a low-privileged session. A positive result is PII or identifiers in the response that the role should not see.
  • Identifier reuse across endpoints. Take UUIDs from a read endpoint and feed them into write endpoints that address users by UUID. A positive result is a write that succeeds against a user outside the caller's scope.
  • Role arrays in request bodies. Send role identifiers the caller does not hold, including the highest role, and check whether the server validates them against the caller's own role. A positive result is a role change to a level above the caller's.
  • Status toggles. Try activating or deactivating other users from a low-privileged session. A positive result is a state change on an account the caller does not manage.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store From the original on medium.com
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Glossary

  • API: the set of addresses a website's own pages use to talk to its server behind the scenes, usually exchanging structured data.
  • Account manager / account owner: the management role in this product, able to see all users and use all functions.
  • Broken access control: a flaw where the website has a rule about who may do what, but one part of it fails to enforce that rule.
  • Cookie: a small piece of text stored by your browser after login and sent with each request so the server recognises your session.
  • Creator: the limited role in this product, able to create some things but not to see user information or identifiers.
  • CSRF token: a secret value embedded in a page so the server can tell a genuine action from one forged by another site.
  • Endpoint: one specific address (route) on a server that performs one specific job.
  • GET: the HTTP method meaning "read something".
  • Header: an extra labelled line in a request or response carrying details such as cookies, content type or origin.
  • HTTP status code: a three-digit number in the reply; 200 means success, 403 means forbidden.
  • Intercepting proxy: a tool that sits between browser and server so you can pause, read and edit requests before they are sent.
  • JSON: a plain-text data format using curly braces and square brackets, used to send structured information between browser and server.
  • Misconfiguration: a setting or check that was left out or set wrongly, leaving a feature less protected than intended.
  • PII: Personally Identifiable Information, data that identifies a real person, such as an email address, phone number or address.
  • Privilege escalation: moving from a lower level of permission to a higher one without being granted it.
  • PUT: the HTTP method meaning "change something".
  • Query string: the part of an address after the ?, carrying extra instructions such as includeDetails=true.
  • Request: the message a browser sends to a server, made of a method, a path, headers and sometimes a body.
  • Role: a label on an account that determines what it is allowed to do.
  • UUID: a long, unique identifier string used to refer to a specific user or object.

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.