Insecure permission: A normal user can escalate his/her role to admin
- Dominant language
- Java
- Stars
- 400
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
### Overview
There exists an **insecure permission** in BRCC from version **1.0.1** to latest. A normal user can escalate his/her role to admin via a POST request.
**The affected interface** is **/console/admin/updateAdmin/{userId}**.
This interface allows normal users to arbitrarily modify their own roles.
### Details
**Affected Function**: com.baidu.brcc.controller.AdminController#updateAdmin

The validation logic in the interface implementation:
1. Whether the user is in an available state.
2. Whether the user is an administrator; if not, it only needs to be verified whether they are modifying their own data.
The interface implementation did not validate whether non-administrator users could modify their own roles, thus allowing normal users to change their roles to administrator without any restrictions.
### Exploit

**test001** is a normal user, the code of role is 0.
**rcc-token** in the header of request is the token of **test001**.

It's successful. **test001** has become an administrator.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at com.baidu.brcc.controller.AdminController#updateAdmin and reproduce the POST request to /console/admin/updateAdmin/{userId} with a normal user's token. Trace the role-update validation and verify that a normal user cannot change their own role, while the intended administrator behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authorization, backend, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100