Skip to content

[Security]Users with low privileges can reset the password of any user. #902

@v9d0g

Description

@v9d0g

Affected Component

me/zhengjie/modules/system/rest/UserController.java

Description

A vulnerability stemming from a combination of missing permissions and a hard-coded password: The PUT /api/users/resetPwd endpoint lacks the @PreAuthorize annotation (other endpoints in the same controller, such as createUser and deleteUser, have permission checks), and uses the hard-coded weak password "123456" as the reset password. Any authenticated user can send any user ID to batch reset passwords, including administrator accounts, and then use the known password "123456" to log in to the target account and take over the account. Attack path: PUT /api/users/resetPwd, Body: [List of target user IDs] → Password reset to "123456" → Log in to the target account using "123456".

Affected Code Path

me.zhengjie.modules.system.rest.UserController.resetPwd(java.util.Set)
->org.springframework.security.crypto.password.PasswordEncoder.encode(java.lang.CharSequence)

Security Impact

Users with any privileges can reset any user's password.

POC

User IDs are monotonically increasing numbers, which can be observed when the admin user accesses the /api/users interface.

Image

To reset the password to 123456, use a user with low privileges to access PUT /api/users/resetPwd and pass in another user ID.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions