CVE-2026-86322: Foreman: authorization flaw in the foreman::controller::useraware#find_user handling used by api::v2::personalaccesstokenscontroller
A flaw was found in Foreman’s Api::V2::PersonalAccessTokensController, where Foreman::Controller::UserAware#finduser resolves the target account using User.find(params[:userid]) without applying the required parent-user authorization check. An attacker with the createpersonalaccesstokens permission can therefore invoke POST /api/v2/users/:userid/personalaccesstokens with another user’s ID and create a Personal Access Token on their behalf. The resulting plaintext token is returned in the API response, while PersonalAccessToken#checkpermissionsaftersave only validates createpersonalaccesstokens on the token and does not enforce editusers authorization on the target user. The attacker can then use the forged token to authenticate as the victim, potentially resulting in complete account takeover, including administrator accounts.
Other sources
Foreman contains an authorization flaw in the Foreman::Controller::UserAware#finduser handling used by Api::V2::PersonalAccessTokensController. The controller resolves the target account directly with User.find(params[:userid]) without enforcing the parent-user authorization that normally restricts access to the target user. As a result, a user who has the createpersonalaccesstokens permission can create a Personal Access Token for another user whose account is accessible by ID within the user's taxonomy scope.
The vulnerable endpoint is POST /api/v2/users/:userid/personalaccesstokens. During token creation, the controller builds the Personal Access Token from the attacker-supplied userid and returns the plaintext token value in the API response.
The PersonalAccessToken#checkpermissionsaftersave model validation does not prevent this cross-user operation: when the token belongs to another user, it verifies the createpersonalaccesstokens permission on the token itself but does not require editusers authorization on the target user.
An attacker with the required createpersonalaccesstokens permission can therefore forge a valid PAT belonging to another user and subsequently authenticate as that user using the generated token. This can result in complete account takeover, including takeover of administrator accounts that are visible within the attacker's taxonomy scope.
— Red Hat
Affected Software
Event History
Frequently Asked Questions
What access does an attacker need to exploit this issue?
The attacker needs an account with the create_personal_access_tokens permission. No user interaction is required, and the affected API endpoint is reachable over the network.
Can an attacker create tokens for users they would not normally be allowed to manage?
Yes. The affected request does not apply the required authorization check on the target user, so an attacker can supply another user’s ID when creating a personal access token.
What is the impact after a forged token is created?
The plaintext token is returned in the API response, allowing the attacker to authenticate as the targeted user. Targeting an administrator account could result in complete administrator account takeover.