Fix: Priviledge Escalation#52
Merged
Merged
Conversation
Profile edit methods accepted an unvalidated id parameter from the request body, allowing any authenticated user to edit any other user's profile, password, photo, or role. This adds ownership-or-admin gates to postProfileInfoEdit, postProfilePasswordEdit, and postProfilePictureEdit, and an admin-only gate to postAdminEdit. The role update in postAdminEdit is also changed from mass assignment to direct assignment in preparation for removing role from $fillable.
The edit() method passed $request->post() directly to User::update() after unsetting only a few keys. This denylist approach allowed injection of sensitive fields like role and api_token. Switching to $request->only() ensures only explicitly listed profile fields can be mass-assigned through this endpoint.
These sensitive fields were mass-assignable, enabling privilege escalation if any controller passed unfiltered request data to User::update() or User::create(). All call sites that previously set role via mass assignment now use direct property assignment.
Eight tests covering the C1 (IDOR), C2 (mass assignment), and M1 (sensitive fillable fields) vulnerabilities. Includes both negative cases verifying non-admin users are blocked and positive cases confirming administrators retain access.
Collaborator
Author
|
QA 👍 Confirmed we are now getting 403 responses |
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.
Description
Patches three security vulnerabilities identified in the audit and already fixed upstream in TheRestartProject#843.
QA Notes
We will need to validate this in the test cluster.