T05 · Unauthorized Access and Privilege Escalation
- Location
tools.ts:389- Finding
Caller-Controlled User Identifier Enables Unscoped Cross-Profile Access
- Content
View full analysis
service.getProfile(userId), updateProfile: ({ userId, patch }: ToolInputWithProfilePatch) => service.updateProfile(userId, patch), syncSteamSnapshot: ({ userId, snapshot }: ToolInputWithSteamSnapshot) => service.syncSteamSnapshot(userId, snapshot), addFavoriteGame: ({ userId, game }: ToolInputWithGame) => service.addFavoriteGame(userId, game), removeFavoriteGame: ({ userId, game }: ToolInputWithGameIdentifier) => service.removeFavoriteGame(userId, game), addOwnedGame: ({ userId, game }: ToolInputWithGame) => service.addOwnedGame(userId, game), removeOwnedGame: ({ userId, game }: ToolInputWithGameIdentifier) => service.removeOwnedGame(userId, game), addWishlistGame: ({ userId, item }: ToolInputWithWishlistItem) => service.a ...[truncated 4457 chars]- Remediation
View remediation
; save(principalId: string, profile: SteamProfile): Promise; ``` - Store records under a composite tenant/profile key and enforce the tenant boundary at the persistence layer. 4. **Centralize enforcement** - Implement authorization in a common wrapper or service guard so newly added tools cannot accidentally bypass it. - Apply the guard to both direct profile operations and all context builders that call `getProfile`. 5. **Prevent enumeration** - Use non-predictable internal profile identifiers. - Return indistinguishable responses for nonexistent and unauthorized profiles where appropriate. - Add rate limiting and audit logging for failed cross-profile access attempts. 6. **Add security tests** - Create two distinct principals and profiles. - Verify that each principal can read and modify only its own profile. - Test every exported read and mutation tool with a mismatched identifier and require rejection. ]]>
