Mattermost Privilege Escalation — A Business Acceptable Ris
A user with the System Manager role or the sysconsole_write_user_management_permissions permission can modify the system_user role to add permissions, escalating their own privileges. This could lead to remote command execution on self-hosted instances where plugin uploads are enabled.
Published on medium.com
I discovered a broken access control vulnerability in Mattermost that allows privilege escalation. A user with the System Manager role, or one manually granted the sysconsolewriteusermanagementpermissions permission, can elevate their privileges and access functionalities meant only for System Administrator users.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the endpoint for patching roles checks only for the sysconsole_write_user_management_permissions permission instead of the manage_system permission, allowing a lower-privileged role to modify other roles.
Impact
A System Manager can escalate privileges to gain access to functionalities meant for System Administrators, and on self-hosted instances with plugin uploads enabled, this could lead to remote command execution.
What the attacker needed
A user with the System Manager role; self-hosted instance with plugin uploads enabled
How it was found
- Log in as a user with the System Manager role.
- Retrieve the ID of the system_user role via the /api/v4/roles/names endpoint.
- Send a PATCH request to /api/v4/roles/{role_id}/patch with a list of permissions to add to the system_user role.
- The system_user role now has the added permissions, escalating privileges for all users with that role.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In Mattermost, roles control what users can do. The System Manager role is meant to have limited admin powers, but the report shows it can edit the basic user role to give itself extra powers, like uploading plugins, which can lead to running code on the server.
What is Access control?
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.