Skip to content
Access control Write-up Intermediate

Invalid Role Leads to Organization Lockout and Unauthorized API Access

The backend accepted an unsupported role value when an administrator changed a user's role, leaving that user with a null role. The affected account could still reach some team and user-information API endpoints, and administrators could no longer modify or remove it through the interface.

Adham Heinrich Follow

Published on medium.com

Bug Bounty

Adham Heinrich, 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. 5 min read.

Context

The target is a web application with a team and organisation management feature. Administrators can change the roles of users who belong to a team, and the application exposes this functionality through an API rather than only through the interface. Roles in the application include Owner, Admin and Developer, and each user is associated with a project or organisation.

The write-up describes a role validation flaw: the backend accepted a role value that the application does not support, which left the affected account in an inconsistent state and, in turn, exposed API endpoints to an account that had no valid role.

Setup

No product name, version or specific endpoint host is given. The testing used Burp Suite to intercept and modify requests. Three test accounts were created, one each with the Owner, Admin and Developer roles. The researcher was logged in as the Admin when performing the role change, and later logged in as the affected user to test API access.

Finding it

While testing the role management functionality, the researcher noticed that administrators could modify users' roles through an API request. Intercepting that request in Burp Suite showed how the server handled role changes. The request was sent to the following path:

HTTP
PUT /api/teams/<team_id>/users/<user_id>/roles/default

The path identifies the team and the target user whose role is being changed. The body carried the target user's ID and the new role:

JSON
{  "userId": "<target_user_id>",  "role": "5"}

The role value "5" was not a role the application supports. The interesting part is the server's answer: instead of rejecting the unsupported value, it returned:

HTTP
HTTP/2 204 No Content

A 204 means the request was accepted and processed, so the backend had taken a role value it should not have recognised.

Exploitation

Step 1: Prepare the accounts

Create test accounts with Owner, Admin and Developer roles. This gives a legitimate administrator session to send the role change and a separate account whose role will be corrupted.

Step 2: Intercept the role change

Log in as Admin and intercept a request that changes the Developer's role. The request is the PUT to /api/teams/<team_id>/users/<user_id>/roles/default shown above.

Step 3: Send an unsupported role value

Modify the role value in the body to "5":

JSON
{  "userId": "<target_user_id>",  "role": "5"}

Forward the request. The server responds with HTTP/2 204 No Content, confirming that the invalid role was accepted rather than rejected.

Step 4: Observe the corrupted state

Refresh the Owner and Admin sessions. The affected user's role is now displayed as null. The account remains associated with the project, but the organisation owner and administrators can no longer modify or remove the affected user through the interface. The user is effectively locked in place: still a member, but unmanageable through the normal UI.

Step 5: Test the affected account's API access

Log in as the affected user and send requests to the relevant team and user-information API endpoints. Although the account has no valid role, it can still access certain of these endpoints directly. The API returns information the account should not be authorised to access.

This exposed two distinct problems:

  1. The backend accepted an unsupported role value.
  2. API authorisation was not consistently enforced for the resulting null-role account.

Root cause

The backend accepted the role value without rejecting it as unsupported. The 204 No Content response shows the request was accepted, and the role was later displayed as null.

Because the account still belonged to the project but had no recognised role, the authorisation logic had no defined behaviour for it. The report shows that some team and user-information endpoints did not enforce authorisation consistently for this state, so the account retained access it should not have had. The exact code path is not shown, but the pattern is likely a missing allow-list check on input combined with authorisation checks that assume every member has a valid role.

Impact

An administrator can put a user into an invalid role state. The consequences shown in the report are:

  • The affected user's role becomes null.
  • The organisation owner and administrators can no longer modify or remove that user through the interface, which is an organisation management lockout for that account.
  • The affected account can still reach certain team and user-information API endpoints and retrieve information it should not be authorised to access.

The report does not quantify how many endpoints were affected or what specific data was returned. The impact depends on which endpoints fail to enforce authorisation for a null-role account.

Fix

The report does not describe a fix or a vendor response. Based on the finding, the backend should validate the role value against the supported roles and reject anything else with an error rather than a 204. Authorisation checks should also handle accounts with no valid role explicitly, denying access rather than falling through to an allowed state.

Variants to test

  1. Send other unsupported values in the same role field, such as "0", "-1", "999", an empty string, null, or a role name from a different product tier. A positive result is a 2xx response and a role that renders as null or otherwise breaks the UI.
  2. Try type confusion: send the role as a number instead of a string, as an array, or as an object. A positive result is acceptance of a value the UI never produces.
  3. Repeat the role change on other role slots or scopes, for example a different roles/<slot> path segment or a different team. A positive result is the same 204 and the same unmanageable member state.
  4. After creating a null-role account, enumerate team and user-information endpoints with that session and compare the responses with those of a Developer account. A positive result is data returned to the null-role account that the Developer account cannot see.
  5. Test whether the lockout can be reversed by another administrator through a different API path, or whether the affected user can change their own role. A positive result is either a way to restore management or a self-service escalation from the null state.

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

A web application lets teams of people work together on projects. Each person in a team has a role, such as Owner, Admin or Developer, and that role decides what they are allowed to do. An administrator can change someone's role. The application does this through an API, which is the behind-the-scenes channel the website's own pages use to talk to the server.

The researcher found that the server accepted a role value the application does not actually support. Instead of saying "no, that is not a valid role", the server said "done". The affected user's role then showed up as null, meaning empty or missing. That user stayed in the team, but the Owner and the Admins could no longer change or remove them through the normal screens. On top of that, the affected account could still reach some team and user-information API endpoints and get back information it should not have been allowed to see.

So one bad value in one request produced two problems: a member nobody could manage, and an account with no proper role that still had access.

The pieces you need to know first

Before walking through the steps, here are the ideas the report relies on, explained from scratch.

  • Web application: a program you use through your browser. The pages you see are drawn by your browser, but the real work happens on a server somewhere else.
  • Server and backend: the server is the computer that stores the data and makes the decisions. "Backend" means the part you never see, as opposed to the "frontend", the pages in your browser. A useful comparison: the frontend is the shop counter, the backend is the stockroom and the manager's office.
  • API: an Application Programming Interface. In web terms it is a set of addresses on the server that accept requests and return data, usually in a compact text format rather than a full web page. When you click a button on a modern site, the page often sends an API request in the background and then redraws itself with the answer. Think of it as the service hatch at a restaurant: the dining room (the interface) and the kitchen (the server) exchange orders through it.
  • Endpoint: one specific API address, for example the one that changes a user's role. Each endpoint does one job.
  • HTTP request and response: your browser sends a request ("please do this") and the server sends back a response ("here is the result, and here is a status code saying how it went").
  • HTTP method: the verb at the start of a request. GET asks for data, POST creates something, PUT replaces or updates something, DELETE removes something.
  • Status code: a three-digit number in the response. 200 and 204 mean success, 400 means your request was malformed, 401 means you are not logged in, 403 means you are logged in but not allowed, 404 means not found, 500 means the server broke. 204 No Content specifically means "done, and there is nothing to send back".
  • Role: a label attached to a user account that says what that account may do. Owner is usually the highest, Admin next, Developer lower. The server is supposed to check the role before allowing an action.
  • Authorisation versus authentication: authentication is proving who you are (logging in). Authorisation is deciding what you, once identified, are allowed to do. A bug in authorisation means a logged-in person can do things they should not.
  • Validation: checking that incoming data makes sense before using it. If a form asks for a colour and you send "purple elephant", good validation rejects it. This report is about missing validation on a role value.
  • Burp Suite: a tool used by security testers that sits between your browser and the server. It can pause a request on its way out, let you edit it, and then send it on. This is called intercepting. The everyday comparison is a postal worker who opens your letter, lets you rewrite a line, and then delivers it.
  • Intercepting proxy: the general name for that kind of tool.
  • null: a programming value meaning "nothing here" or "no value set". It is not the same as the text "null"; it is the absence of a value. When a page shows null, it usually means the program tried to display something that was never properly set.
  • Lockout: a situation where the people who should be in control can no longer manage something. Here it means the Owner and Admins cannot modify or remove a particular member.
  • Reproduction steps: a numbered recipe that lets someone else trigger the same bug.

Discovery: how the researcher found it

The researcher was testing the application's role management feature, the part where an administrator changes what another user is allowed to do. They noticed that this change is not only possible through the visible interface: it is carried out by an API request. That matters because an API request can be paused and edited with a tool, while a button click cannot.

They used Burp Suite to intercept the request and look at exactly what the browser sends and what the server answers. The request went to this path:

HTTP
PUT /api/teams/<team_id>/users/<user_id>/roles/default

Line by line:

  • PUT is the method. It tells the server "update or replace this thing".
  • /api/ marks this as an API address rather than a normal web page.
  • teams/<team_id> points at one particular team. The angle brackets are placeholders: in a real request they are replaced by the team's actual identifier, a string or number the server uses to tell teams apart.
  • users/<user_id> points at one particular user inside that team, again by identifier.
  • roles/default points at the role slot being changed. "default" here is the name of that slot.

So the whole line reads: "update the default role of this user in this team".

The body of the request, the part that carries the data, contained the target user's identifier and the new role:

JSON
{  "userId": "<target_user_id>",  "role": "5"}

Line by line:

  • The outer curly braces { } mark a JSON object, a simple way of writing labelled values. JSON is the common text format APIs use for data.
  • "userId": "<target_user_id>" says which user is being changed. The placeholder stands for the real identifier.
  • "role": "5" says the new role is the text 5. This is the key line: the application's roles are named things like Owner, Admin and Developer, so 5 is not a role it supports.

A well-behaved server would look at "5", see that it is not one of its known roles, and refuse. Instead, the server answered:

HTTP
HTTP/2 204 No Content

Line by line:

  • HTTP/2 is the version of the web protocol used for this exchange. It is simply the language version the browser and server agreed on.
  • 204 is the status code. It means the request succeeded and there is no content to return.
  • No Content is the human-readable name for that code.

In other words, the server accepted the unsupported role instead of refusing it. That is the bug: a missing check on the value before it is saved.

Testing the impact: what the bad value actually did

Finding that a strange value is accepted is only interesting if it causes harm. So the researcher looked at what changed.

After refreshing the application, the affected user's role was displayed as null. The page was trying to show a role, found nothing it recognised, and showed the empty value instead. The account was still a member of the project, but the Owner and the administrators could no longer modify or remove that user through the interface. The member was stuck: present, but unmanageable. That is the lockout in the title.

Next, the researcher logged in as the affected account and tried the application's API directly. Even though the account had no valid role, it could still reach certain team and user-information endpoints and receive data. Those endpoints were supposed to check the caller's role before answering, and for this odd null state the check did not do its job.

That gave two separate problems:

  • The backend accepted an unsupported role value.
  • API authorisation was not consistently enforced for the resulting null-role account.

Why does the second problem follow from the first? Because authorisation code is usually written assuming every member has one of the known roles. When the role is null, the code has no rule for that case. Depending on how it is written, it may fall through to "allow" instead of "deny". The safe default is always to deny when the situation is unclear.

Steps to reproduce

These are the recipe steps, with the reason for each.

  1. Create test accounts with Owner, Admin, and Developer roles. You need a real administrator account to send the change, and a separate account whose role you are willing to break. Using your own accounts keeps the test controlled.
  2. Log in as Admin and intercept a request that changes the Developer's role. Logging in as Admin gives you a legitimate session, so the server believes the request comes from someone allowed to change roles. Intercepting lets you see and edit the request before it reaches the server.
  3. Modify the role value to "5". This is the actual test: send a value the application does not support and see whether the server rejects it.
  4. Forward the request and observe the 204 No Content response. Forwarding means letting the edited request continue to the server. A 204 tells you the server accepted and processed it.
  5. Refresh the Owner and Admin sessions. Refreshing reloads the pages so you see the current state of the data, not an old cached view.
  6. Verify that the affected user's role is now null and that the user cannot be removed through the interface. This confirms the damage: the role is broken and the normal management screens no longer work for that member.
  7. Log in as the affected user and send requests to the relevant team or user-information API endpoints. Now you test the second half: does an account with no valid role still get answers it should not get?
  8. Verify that the API returns information the account should not be authorised to access. If it does, authorisation is not being enforced for this state.

Why it works: the root cause

The backend accepted a role value it does not support. The 204 No Content response shows the request was accepted. The role was then displayed as null, meaning the application had no value it recognised.

Because the account still belonged to the project but had no recognised role, the authorisation logic had no defined behaviour for it. Some team and user-information endpoints did not enforce authorisation consistently for that state, so the account kept access it should not have had.

The report does not show the exact code. The likely pattern is a missing allow-list check on the input, combined with authorisation checks that assume every member has a valid role. An allow-list means: accept only these known values, reject everything else. It is the opposite of a block-list, which tries to name every bad value and always misses one.

Impact: what an attacker could do

An administrator can put a user into an invalid role state. The consequences shown in the report are:

  • The affected user's role becomes null.
  • The organisation owner and administrators can no longer modify or remove that user through the interface, which is an organisation management lockout for that account.
  • The affected account can still reach certain team and user-information API endpoints and retrieve information it should not be authorised to access.

The report does not say how many endpoints were affected or what specific data was returned. The real impact depends on which endpoints fail to enforce authorisation for a null-role account.

Fix

Based on the finding, the backend should validate the role value against the supported roles and reject anything else with an error rather than a 204. Authorisation checks should also handle accounts with no valid role explicitly, denying access rather than falling through to an allowed state.

Variants to test

Once you understand a bug like this, it is worth trying nearby variations. Each one below is a question you can ask the same application.

  1. Send other unsupported values in the same role field, such as "0", "-1", "999", an empty string, null, or a role name from a different product tier. A positive result is a 2xx response and a role that renders as null or otherwise breaks the UI.
  2. Try type confusion: send the role as a number instead of a string, as an array, or as an object. A positive result is acceptance of a value the UI never produces.
  3. Repeat the role change on other role slots or scopes, for example a different roles/<slot> path segment or a different team. A positive result is the same 204 and the same unmanageable member state.
  4. After creating a null-role account, enumerate team and user-information endpoints with that session and compare the responses with those of a Developer account. A positive result is data returned to the null-role account that the Developer account cannot see.
  5. Test whether the lockout can be reversed by another administrator through a different API path, or whether the affected user can change their own role. A positive result is either a way to restore management or a self-service escalation from the null state.

Glossary

  • API: a set of addresses on a server that accept requests and return data, used by the website's own pages and by anyone who can send the same requests.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: deciding what an identified user is allowed to do.
  • Allow-list: a rule that accepts only a known set of values and rejects everything else.
  • Backend: the server-side part of an application that stores data and makes decisions, as opposed to the pages you see.
  • Burp Suite: a tool that sits between browser and server, letting a tester pause, inspect and edit requests.
  • Endpoint: one specific API address that performs one job.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • HTTP method: the verb at the start of a request, such as GET, POST, PUT or DELETE.
  • Intercept: to pause a request in transit so it can be inspected or changed before it is delivered.
  • JSON: a simple text format for labelled data, used by most APIs.
  • Lockout: a state where the people who should be in control can no longer manage something.
  • null: a programming value meaning "no value set", distinct from the text "null".
  • Reproduction steps: a numbered recipe for triggering a bug reliably.
  • Role: a label on a user account that determines what that account may do.
  • Status code: a three-digit number in a response saying how the request went, such as 204 for success with no content.
  • Type confusion: sending data in a different form than expected, such as a number where text is expected, to see whether the server mishandles it.
  • Validation: checking incoming data against what is expected before using or storing it.
  • Web application: a program used through a browser, whose real work happens on a server.

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.