Summary
Bonsai contains an authorization flaw in which the admin-page handler accepts both Administrator and Editor roles. An authenticated Editor may therefore reach administrative functions that can reset administrator passwords, promote accounts, or change global settings, potentially enabling instance takeover.
Affected context
The issue affects Bonsai deployments where administrative page access is handled by AdminAuthHandler and Editor users are accepted alongside Administrators. The described administrative operations are exposed through UsersController and DynamicConfigController; risk depends on whether an authenticated Editor can reach and invoke those functions.
Exploit preconditions
- Attack surface: Bonsai administrative pages and controller actions
- Required access: An authenticated account with the Editor role
- Trigger point: Access to administrative functions in
UsersControllerorDynamicConfigController - Why exploitation is possible: The authorization handler accepts the Editor role for pages intended for administrators, allowing actions beyond the user's intended privileges
Why this happens
The authorization check grants access to administrative functionality to a role that should not have that privilege. This is an incorrect authorization flaw mapped to CWE-863: Incorrect Authorization: the application does not enforce the intended role boundary when deciding whether a user may perform a sensitive action.
Potential impact
- An Editor could reset administrator passwords
- An Editor could promote accounts to Administrator
- An Editor could change global settings
- These actions could enable administrative account takeover or broader compromise of the Bonsai instance
General mitigation guidance
Mitigation generally involves enforcing authorization at each sensitive action, not only at the page or handler level.
Common defensive patterns include:
- Apply explicit, deny-by-default role checks for administrative operations
- Separate Editor and Administrator capabilities and grant only the minimum required permissions
- Recheck authorization within controllers before performing sensitive changes
- Require appropriate safeguards for password resets, role changes, and global configuration updates
- Review role mappings and authorization policies whenever administrative functionality changes
How teams detect issues like this
Useful detection approaches include:
- Review authorization checks for handlers and controllers that accept multiple roles
- Use static analysis or code review rules to flag sensitive actions without explicit permission checks
- Test role boundaries to verify that Editor accounts cannot perform administrator-only operations
- Monitor audit logs for password resets, role promotions, and global setting changes initiated by non-administrator accounts
- Enforce policy checks in CI for authorization coverage on sensitive routes and actions

