-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Describe the bug
Broken Access Control (IDOR - Insecure Direct Object Reference) in Phoenix LiveView route /games/:game_id/players/:id.
The :game_id parameter from the URL is completely ignored in the socket handle_params/3. The code fetches the player by :id only, then loads the game using player.game_id instead of verifying the URL-provided game_id. This allows any user to view any player's full game state (cards, hand, status, etc.) by forging the game_id part of the URL while keeping a valid player_id.
Steps to Reproduce
- Open a player view page, for example:
/games/01KJQJAR0B57E96P7YJBDCEVYG/players/01KJQJBZGWBQBEKFYE7AMZ01S0 - Copy the full URL and change only the
game_idsegment to any random/invalid string, e.g.:
/games/999999999999999999/players/01KJQJBZGWBQBEKFYE7AMZ01S0 - Load the modified URL in the same browser/session.
- Observe that the page loads successfully and displays the correct player data, including:
- Full hand/cards
- Player status
- Game-specific state
(despite thegame_idin the URL being completely wrong/forged)
Video Demo
2026-03-05.03-34-40.mp4
Expected behavior
When a user visits /games/:game_id/players/:id, the application must verify that the provided :game_id exactly matches the game_id associated with that player_id in the database. If they do not match, the socket should return a 404 Not Found, redirect to a safe page, or show an access denied message.
Desktop (please complete the following information):
- OS: any (Windows / macOS / Linux / iPadOS etc.)
- Browser: any modern browser (Chrome, Firefox, Safari, Edge)
- Version: any recent version
Additional context
- Reproducible by changing only the
game_idsegment in the URL → same player data/cards still load correctly - Only basic rate limiting appears to be present