The endpoint issues a token for the user and partner named in the URL. It confirms your role and never confirms those values belong to you.
What goes wrong
A token-issuing endpoint reads two values out of the URL path: whose token to make and which partner it is for. Both are attacker-controlled, because both are just path segments the caller types. The controller checks that the caller holds a role and then generates the token.
What is missing is the check that binds those path values to the authenticated caller. There is no confirmation that the user identifier is the caller's own, and no confirmation that the caller is allowed to act for that partner. So a valid, low-privilege user can walk other users' identifiers and other partners' codes and mint tokens across the boundary.
This is textbook IDOR. The identifier of the thing you are acting on comes from the request, and authorization stops at 'are you logged in with the right role' instead of 'is this yours'.
The pattern
@RequireRole('partner')
def generateToken(userId, partnerCode): # both from the URL
token = tokens.issue(userId, partnerCode)
return { 'token': token }
# nothing checks userId or partnerCode against the caller@RequireRole('partner')
def generateToken(userId, partnerCode):
if userId != caller.userId:
deny() # act only on yourself
if partnerCode not in caller.allowedPartners:
deny() # or an entitlement check
return { 'token': tokens.issue(userId, partnerCode) }Grounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.
Why it matters to you
Cross-identity token generation is a foothold, not a dead end. A token for another user is impersonation. A token for another partner crosses a tenant line you probably sell as a hard boundary. The fact that the caller needed a valid account first does not save you, because valid accounts are exactly what attackers acquire.
Every identifier in a path or query is caller input. If acting on it affects data that is not the caller's, you owe an object-level check, and it has to compare the requested identifier against the authenticated principal rather than against a role.
Check your own code
- Flag path or query identifiers that select someone else's data
- Compare requested user or tenant ids against the authenticated caller
- Do not treat a role as permission to act on an arbitrary identifier
- Add tests that request another account's id and expect a denial