Skip to content
Access control Disclosed report Intermediate

Guest Privilege Escalation to admin group

A guest user could add themselves to the bot group, which holds the manage-own-integrations permission, and then create an integration script that adds them to the admin group. This let a guest become a server administrator.

gronke Follow

Originally disclosed on HackerOne

Critical 9.9 View original
  • Triaged in 16 days
  • Fixed in 5 months
  • Disclosed after 5.5 years

Due to improper ACLs it was found possible to escalate privileges from a guest user to admin.

As first step the guest user adds itself to the bot group that holds the manage-own-integrations permission. With this permission it is possible to create a custom Integration with a script that, if triggered, adds the user to the admin group.

The insertOrUpdateUser method improperly validates a users permissions to change its groups. Because an explicit check prevents from adding itself to the admin group directly, the privileges of the bot group need to be used to further escalate to global admin.

Releases Affected:

Steps To Reproduce (from initial installation to vulnerability):

(Add details for how we can reproduce the issue)

  1. Login Guest user
  2. Determine own users _id from browser traffic
  3. Escalate to bot group
  4. Create malicious Integration script
  5. Trigger Integration

Supporting Material/References:

Bot group privilege escalation

JSON
["{\"msg\":\"method\",\"method\":\"insertOrUpdateUser\",\"params\":[{\"_id\": \"<USER_ID>\", \"roles\": [\"user\", \"bot\"]}],\"id\":\"17\"}"]

Malicious Integrations Script

JavaScript
this.Roles.addUserRoles("9HN4Brdmo2Qc2wsiX", "admin")
class Script {
  process_incoming_request({ request }) {};
}

Suggested mitigation

  • Only allow administrators to modify user groups
  • Isolate Integration script context from server application

Impact

Guest users can become server administrator.

The original report as published on HackerOne, by gronke. Images and videos are our own copies; raw HTML is shown as text. View it 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. 5 min read.

Context

Rocket.Chat is a self-hosted team chat platform. Its permission model is built around roles and groups: a user account carries a set of roles, and roles carry permissions. Two of those roles matter here. The bot group holds the manage-own-integrations permission. An Integration is a server-side script that runs when it is triggered. The report's mitigation asks for its context to be isolated from the server application. The admin group is the target of the escalation.

The report describes an access control flaw in the way a user's group membership is changed. A guest user, the lowest-privileged account type, can move itself into the bot group, use the integration permission that comes with it to run a script, and have that script add the account to the admin group. The result is a guest account becoming a server administrator.

Setup

The only precondition stated is a guest account on an affected installation. The researcher lists one affected release, the development commit develop@5f0180d:

Text
develop@5f0180d

No specific version number, deployment configuration or additional tooling is given. The reproduction starts from an initial installation and a logged-in guest user.

Finding it

The researcher identified improper ACLs that allowed privilege escalation from a guest user to admin. The key observation is that a user can change its own groups through the insertOrUpdateUser method, and that method does not properly validate whether the caller is allowed to make that change. There is an explicit check that stops a user from adding itself directly to the admin group, so the direct route is blocked. The guest can add itself to the bot group, and it carries a permission that can be abused as a second step.

That gives a two-stage escalation: first into bot, then from bot into admin by way of an Integration script. The explicit admin check only guards the direct path, so the indirect path through bot bypasses the intent of the control.

Exploitation

The researcher's reproduction runs from initial installation to full escalation in five steps.

Step 1: Log in as a guest user

Start with a session as a guest user. This is the lowest-privileged starting point and the account that will end up as administrator.

Step 2: Determine your own user _id

The user's own _id is taken from browser traffic. The _id is needed because the group change is made against the user's own record, and the payload references it explicitly.

Step 3: Escalate to the bot group

The guest sends an insertOrUpdateUser call that sets its own roles to include bot:

JSON
["{\"msg\":\"method\",\"method\":\"insertOrUpdateUser\",\"params\":[{\"_id\": \"<USER_ID>\", \"roles\": [\"user\", \"bot\"]}],\"id\":\"17\"}"]

The important parts are the method name insertOrUpdateUser, the params object identifying the target user by _id (shown here as the placeholder <USER_ID>), and the roles array, which now contains both user and bot. Because the method does not properly validate the caller's permission to change groups, the guest's own record is updated and the account now holds the bot role. With bot comes manage-own-integrations.

Step 4: Create a malicious Integration script

Using manage-own-integrations, the user creates a custom Integration whose script adds the user to the admin group:

JavaScript
this.Roles.addUserRoles("9HN4Brdmo2Qc2wsiX", "admin")
class Script {
  process_incoming_request({ request }) {};
}

The first line calls this.Roles.addUserRoles with a user identifier and the role admin, which is the actual escalation. The Script class defines a process_incoming_request handler with an empty body.

Step 5: Trigger the Integration

Trigger the Integration. When the script executes, the addUserRoles call adds the user to the admin group. The guest account is now a server administrator.

Root cause

The flaw is in insertOrUpdateUser, which improperly validates a user's permission to change its groups. A user should not be able to assign itself roles it was not granted, but the method allows the change. The one explicit defence, a check that prevents a user from adding itself directly to the admin group, only covers the direct case. It does not prevent the user from joining bot, and it does not prevent a script running with the privileges of bot from calling addUserRoles to grant admin. The escalation therefore works by chaining a weakly guarded role change with a powerful permission attached to an intermediate role.

The second contributing factor is that Integration scripts are not isolated from the server application. A script created by a user holding manage-own-integrations can call this.Roles.addUserRoles.

Impact

A guest user can become a server administrator. The report states this plainly and without further qualification: the starting point is a guest account, and the end state is the admin group. The platform rates the issue as critical with a CVSS score of 9.9.

Fix

The report proposes two mitigations:

  1. Only allow administrators to modify user groups. This would stop a guest from adding itself to bot through insertOrUpdateUser.
  2. Isolate the Integration script context from the server application. This would isolate Integration script context from the server application.

The report does not describe a specific patch or commit that was applied.

Variants to test

  • Try assigning other privileged groups through the same user-update method, not just bot. A positive result is the account's roles changing to include a group it was not granted.
  • Look for other roles that carry permissions able to reach server-side APIs, in the way bot carries manage-own-integrations. A positive result is a role whose permission lets a low-privileged user execute code or call privileged methods.
  • Test whether the explicit admin check can be bypassed by other indirect routes, such as a second intermediate role or a different update path. A positive result is reaching admin without ever naming it in a direct self-assignment.
  • Check whether Integration scripts can call other server-side APIs beyond role management. A positive result is a script reaching data or functions outside the user's own scope.

Hunting notes

This kind of bug hides in user-profile and role-management endpoints where the server trusts the client to send its own record, including fields such as roles or groups. The signal during recon is a method that accepts a user object with a roles array and does not visibly restrict which roles can be set. A second signal is any role that bundles a permission capable of executing code or calling privileged server APIs, because such a role turns a small role-assignment gap into full escalation.

The researcher demonstrated impact by carrying the chain from a guest login to the admin group, with the request and script used. Showing the complete path, rather than a single improper role assignment, is what establishes that a guest can become a server administrator.

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

Rocket.Chat is a chat program that a company or group can run on its own server, rather than using someone else's hosted service. People log in, join channels and send messages, much like a workplace version of a group chat app. Every account has a set of permissions that decide what it is allowed to do.

This report describes a way for the least powerful kind of account, a guest, to give itself the highest level of power, the administrator role. It does this in two moves rather than one. The guest first joins a middle group called bot, which comes with a permission to create small scripts that run on the server. Then it uses that permission to run a script that adds the account to the admin group. The platform rated the issue critical, with a CVSS score of 9.9.

To follow the report you only need a few ideas:

  • Role: a label attached to an account that says what it may do. Think of a staff badge that opens certain doors.
  • Group: in Rocket.Chat, roles are organised into groups, and a group carries permissions. Joining a group is like being handed a badge.
  • Permission: a specific allowed action, such as "may create integrations".
  • API: the set of messages a program can send to a server to ask it to do things. When your browser loads a page and then quietly fetches more data, it is talking to the API. Think of it as a service counter: you hand over a written request, the clerk acts on it and hands back a result.
  • Method: one named request in that API, for example insertOrUpdateUser, which means "insert or update a user record".
  • Access control: the rules that decide who is allowed to do what. When those rules are wrong, security people call it an access control flaw, or say the ACLs (access control lists) are improper. An ACL is simply a list of who is allowed to do what.
  • Privilege escalation: gaining more power than you were given. Doing it sideways, by borrowing another role's power, is what happens here.
  • Integration: a small script stored on the server that runs when something triggers it. It is like leaving a note for a member of staff that says "when the bell rings, do this".
  • Server-side: running on the server itself, with the server's own powers, rather than inside your browser where you are limited.

Context

Rocket.Chat's permission model is built around roles and groups: a user account carries a set of roles, and roles carry permissions. Two roles matter here.

The bot group holds the manage-own-integrations permission. An Integration is a server-side script that runs when it is triggered. The report's mitigation asks for its context to be isolated from the server application. The admin group is the target of the escalation.

The report describes an access control flaw in the way a user's group membership is changed. A guest user, the lowest-privileged account type, can move itself into the bot group, use the integration permission that comes with it to run a script, and have that script add the account to the admin group. The result is a guest account becoming a server administrator.

Setup

The only precondition stated is a guest account on an affected installation. The researcher lists one affected release, the development commit develop@5f0180d:

Text
develop@5f0180d

A commit is a saved snapshot of the program's code, identified by a long code. This line names the snapshot the researcher tested against. No specific version number, deployment configuration or additional tooling is given. The reproduction starts from an initial installation and a logged-in guest user.

Finding it

The researcher identified improper ACLs that allowed privilege escalation from a guest user to admin. The key observation is that a user can change its own groups through the insertOrUpdateUser method, and that method does not properly validate whether the caller is allowed to make that change. There is an explicit check that stops a user from adding itself directly to the admin group, so the direct route is blocked. The guest can add itself to the bot group, and it carries a permission that can be abused as a second step.

That gives a two-stage escalation: first into bot, then from bot into admin by way of an Integration script. The explicit admin check only guards the direct path, so the indirect path through bot bypasses the intent of the control. A useful comparison is a building where the front door to the manager's office is locked, but the key to the stationery cupboard also happens to open a side door into that office.

Exploitation

The researcher's reproduction runs from initial installation to full escalation in five steps.

Step 1: Log in as a guest user

Start with a session as a guest user. This is the lowest-privileged starting point and the account that will end up as administrator. A session is simply the state of being logged in: the server remembers who you are between requests, usually by handing your browser a small piece of data that it sends back each time.

Step 2: Determine your own user _id

The user's own _id is taken from browser traffic. The _id is needed because the group change is made against the user's own record, and the payload references it explicitly. An _id is the unique identifier the server uses for an account, a string of letters and digits that names exactly one user. Browser traffic means the requests your browser sends and receives; you can watch them with the developer tools built into every browser, on the network tab.

Step 3: Escalate to the bot group

The guest sends an insertOrUpdateUser call that sets its own roles to include bot:

JSON
["{\"msg\":\"method\",\"method\":\"insertOrUpdateUser\",\"params\":[{\"_id\": \"<USER_ID>\", \"roles\": [\"user\", \"bot\"]}],\"id\":\"17\"}"]

Line by line, in plain words:

  • The whole thing is wrapped in square brackets, [ ... ], which in JSON means a list. Here the list holds a single item.
  • That single item is a string, shown by the outer double quotes. Inside it, every double quote is written as \", which is how you put a quote inside a string without ending it. So the string contains a JSON message that has itself been turned into text.
  • "msg":"method" says the message is a method call, a request to run one named action.
  • "method":"insertOrUpdateUser" names the action: insert or update a user record.
  • "params":[{...}] carries the arguments for that action, again as a list containing one object.
  • "_id": "<USER_ID>" identifies which user record to change. The placeholder <USER_ID> stands for the real identifier found in step 2.
  • "roles": ["user", "bot"] is the new list of roles for that record: the ordinary user role plus bot.
  • "id":"17" is a label for this particular request, so the reply can be matched to it. It is like a ticket number at a counter.

The important parts are the method name insertOrUpdateUser, the params object identifying the target user by _id (shown here as the placeholder <USER_ID>), and the roles array, which now contains both user and bot. Because the method does not properly validate the caller's permission to change groups, the guest's own record is updated and the account now holds the bot role. With bot comes manage-own-integrations.

Why this step matters: the server should have refused this request, because a guest is not allowed to hand itself a new role. It accepted it, so the guest now holds a permission it was never granted.

Step 4: Create a malicious Integration script

Using manage-own-integrations, the user creates a custom Integration whose script adds the user to the admin group:

JavaScript
this.Roles.addUserRoles("9HN4Brdmo2Qc2wsiX", "admin")
class Script {
  process_incoming_request({ request }) {};
}

Line by line, in plain words:

  • this.Roles.addUserRoles("9HN4Brdmo2Qc2wsiX", "admin") calls a function that adds a role to a user. The first value is the user identifier, the second is the role to add, here admin. This single line is the actual escalation.
  • class Script { begins the definition of the script object the Integration expects. A class is a template for an object, a way of grouping related code under one name.
  • process_incoming_request({ request }) {}; defines the entry point, the function the server calls when the Integration is triggered by an incoming request. The braces {} are empty, so the function does nothing when called.
  • } closes the class definition.

The first line calls this.Roles.addUserRoles with a user identifier and the role admin, which is the actual escalation. The Script class defines a process_incoming_request handler with an empty body.

Step 5: Trigger the Integration

Trigger the Integration. When the script executes, the addUserRoles call adds the user to the admin group. The guest account is now a server administrator. Triggering means causing the script to run.

Root cause

The flaw is in insertOrUpdateUser, which improperly validates a user's permission to change its groups. A user should not be able to assign itself roles it was not granted, but the method allows the change. The one explicit defence, a check that prevents a user from adding itself directly to the admin group, only covers the direct case. It does not prevent the user from joining bot, and it does not prevent a script running with the privileges of bot from calling addUserRoles to grant admin. The escalation therefore works by chaining a weakly guarded role change with a powerful permission attached to an intermediate role.

The second contributing factor is that Integration scripts are not isolated from the server application. A script created by a user holding manage-own-integrations can call this.Roles.addUserRoles. The comparison is a visitor who is allowed to leave a note for the staff, but the note is then read out and obeyed by the manager with the manager's authority.

Impact

A guest user can become a server administrator. The report states this plainly and without further qualification: the starting point is a guest account, and the end state is the admin group. The platform rates the issue as critical with a CVSS score of 9.9. CVSS is a standard scoring system for the severity of a security flaw, where higher numbers mean more serious.

Fix

The report proposes two mitigations:

  1. Only allow administrators to modify user groups. This would stop a guest from adding itself to bot through insertOrUpdateUser.
  2. Isolate the Integration script context from the server application. This would isolate Integration script context from the server application.

The report does not describe a specific patch or commit that was applied.

Variants to test

  • Try assigning other privileged groups through the same user-update method, not just bot. A positive result is the account's roles changing to include a group it was not granted.
  • Look for other roles that carry permissions able to reach server-side APIs, in the way bot carries manage-own-integrations. A positive result is a role whose permission lets a low-privileged user execute code or call privileged methods.
  • Test whether the explicit admin check can be bypassed by other indirect routes, such as a second intermediate role or a different update path. A positive result is reaching admin without ever naming it in a direct self-assignment.
  • Check whether Integration scripts can call other server-side APIs beyond role management. A positive result is a script reaching data or functions outside the user's own scope.

Hunting notes

This kind of bug hides in user-profile and role-management endpoints where the server trusts the client to send its own record, including fields such as roles or groups. An endpoint is one address in the API, the place a particular request is sent. The signal during recon is a method that accepts a user object with a roles array and does not visibly restrict which roles can be set. Recon means the early looking-around phase, watching what the browser sends and noting anything interesting. A second signal is any role that bundles a permission capable of executing code or calling privileged server APIs, because such a role turns a small role-assignment gap into full escalation.

The researcher demonstrated impact by carrying the chain from a guest login to the admin group, with the request and script used. Showing the complete path, rather than a single improper role assignment, is what establishes that a guest can become a server administrator.

Glossary

  • Access control: the rules that decide who may do what; when they are wrong, the flaw is called an access control flaw.
  • ACL (access control list): a list recording who is allowed to perform which actions.
  • Admin: the global administrator role, the highest level of power on the server.
  • API: the set of named requests a program can send to a server to make it do things.
  • Bot group: a role in Rocket.Chat that carries the manage-own-integrations permission.
  • Browser traffic: the requests and replies your browser exchanges with a server, visible in the browser's developer tools.
  • Class: a template in code that groups related data and functions under one name.
  • Commit: a saved snapshot of a program's code, identified by a long code.
  • CVSS: a standard scoring system for the severity of a security flaw; higher is more serious.
  • Endpoint: one address in an API where a particular request is sent.
  • Escalation (privilege escalation): gaining more power than you were given.
  • Group: in Rocket.Chat, a collection of roles that carries permissions.
  • _id: the unique identifier the server uses for a user account.
  • Integration: a small script stored on the server that runs when triggered.
  • JSON: a text format for structured data, built from lists in square brackets and objects in curly braces with name and value pairs.
  • Method: one named request in an API, such as insertOrUpdateUser.
  • manage-own-integrations: the permission that lets a user create custom Integrations.
  • Params: the arguments sent with a method call, telling it what to act on.
  • Payload: the data carried inside a request.
  • Permission: a specific allowed action.
  • Recon: the early looking-around phase of security testing, watching what the browser sends and noting anything interesting.
  • Role: a label on an account that says what it may do.
  • Server-side: running on the server itself, with the server's own powers.
  • Session: the state of being logged in, remembered by the server between requests.
  • Trigger: the event that causes an Integration script to run.
  • Validation: checking that a request is allowed and well formed before acting on it.

More by gronke

View all

27 more disclosed reports, best first.

More from Rocket.Chat

View all

The newest disclosed reports for this program.

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.