Prevent Privilege Escalation: Add Assignment Restrictions for Roles and Permissions#24775
Open
Prevent Privilege Escalation: Add Assignment Restrictions for Roles and Permissions#24775
Conversation
1a4af07 to
cddf0ff
Compare
...p.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs
Outdated
Show resolved
Hide resolved
...p.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs
Show resolved
Hide resolved
...p.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs
Outdated
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Outdated
Show resolved
Hide resolved
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Show resolved
Hide resolved
...y/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/FakeCurrentPrincipalAccessor.cs
Outdated
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Show resolved
Hide resolved
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
Show resolved
Hide resolved
...o.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs
Show resolved
Hide resolved
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
Show resolved
Hide resolved
…t.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
EngincanV
approved these changes
Feb 4, 2026
Member
Author
|
I think the |
yagmurcelk
requested changes
Feb 9, 2026
Contributor
yagmurcelk
left a comment
There was a problem hiding this comment.
A user who doesn't currently have the admin role can give the admin role to another user.
screen-capture.93.webm
Member
Author
Please create open-source test projects to test this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve #24768
Problem Description
The system has privilege escalation vulnerabilities:
AbpIdentity.Users.Updatepermission can assign themselves or others roles they do not currently haveAbpIdentity.Users.ManagePermissionsorAbpIdentity.Roles.ManagePermissionscan grant permissions they do not possessSolution
This PR implements a unified privilege escalation prevention model based on a single security principle:
The solution consists of 3 core security mechanisms, applied uniformly to all users:
1. Role Assignment Restriction (Identity Module)
AandB, they can only assign or removeAandBfor other users2. Permission Grant / Revoke Authorization (PermissionManagement Module)
3. Incremental Permission Protection (User & Role Permissions)
IsEditable = falsewhen the user lacks authorityAdmin Role Exception
adminrole can assign any role and grant/revoke any permission.Security Rules Summary
Admin exception: users with the
adminrole can assign any role and grant/revoke any permission.Scenario Comparison
Admin exception applies to the “After” column for users with the
adminrole.Tests