{"id":30900574,"url":"https://github.com/ruelalarcon/game_logic_exploits_ctf","last_synced_at":"2026-06-19T06:32:31.155Z","repository":{"id":311823639,"uuid":"937623810","full_name":"ruelalarcon/game_logic_exploits_ctf","owner":"ruelalarcon","description":"Capture The Flag (CTF) challenges focused on exploiting game logic vulnerabilities","archived":false,"fork":false,"pushed_at":"2025-08-26T20:20:48.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T06:40:56.304Z","etag":null,"topics":["ctf","cybersec","exploitation","game","logic","nodejs","webapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruelalarcon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-23T14:20:33.000Z","updated_at":"2025-08-26T20:20:52.000Z","dependencies_parsed_at":"2025-08-27T04:53:36.815Z","dependency_job_id":"50c86b0d-c663-4eeb-a818-5fe2ef153c0a","html_url":"https://github.com/ruelalarcon/game_logic_exploits_ctf","commit_stats":null,"previous_names":["ruelalarcon/game_logic_exploits_ctf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ruelalarcon/game_logic_exploits_ctf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruelalarcon%2Fgame_logic_exploits_ctf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruelalarcon%2Fgame_logic_exploits_ctf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruelalarcon%2Fgame_logic_exploits_ctf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruelalarcon%2Fgame_logic_exploits_ctf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruelalarcon","download_url":"https://codeload.github.com/ruelalarcon/game_logic_exploits_ctf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruelalarcon%2Fgame_logic_exploits_ctf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34520431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ctf","cybersec","exploitation","game","logic","nodejs","webapp"],"created_at":"2025-09-09T05:52:37.786Z","updated_at":"2026-06-19T06:32:31.132Z","avatar_url":"https://github.com/ruelalarcon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Game Logic CTF Challenges\n\n\u003e Capture The Flag (CTF) challenges focused on exploiting game logic vulnerabilities:\n\u003e\n\u003e 1. **Card Trading Game**: A multiplayer card trading game where players need to obtain duplicate name cards to capture the flag. The challenge involves exploiting faulty logic in the card gifting system.\n\u003e\n\u003e 2. **Dice Guessing Game**: A dice prediction game where players need to correctly guess 10 rolls in a row. The challenge involves analyzing and predicting the output of a Linear Congruential Generator (LCG). Most likely via brute force but can also done intelligently using incremental modulo backtracking.\n\n## Setup Requirements\n\n- Docker\n- Git\n\n## Getting Started\n\n### Clone the Repository\n\n```bash\n# Using HTTPS\ngit clone https://github.com/ruelalarcon/game_logic_exploits_ctf.git\ncd game_logic_exploits_ctf\n\n# Or using SSH\ngit clone git@github.com:ruelalarcon/game_logic_exploits_ctf.git\ncd game_logic_exploits_ctf\n```\n\n### Environment Setup\n\nCreate a `.env` file in the root directory with the following variables:\n\n```env\nSESSION_SECRET=your_random_secret\nDICEGAME_FLAG=your_flag_here\nCARDGAME_FLAG=your_flag_here\n```\n\n### Deploy with Docker\n\nBuild and start the container:\n```bash\ndocker compose up -d\n```\n\nThe application will be available on port 3000 by default.\n\n### Changing the Port (If Needed)\n\nTo run the application on a different port, modify the `ports` section in `docker-compose.yml`:\n\n```yaml\nservices:\n  app:\n    # ... other configuration ...\n    ports:\n      - \"8080:3000\"  # Change 8080 to your desired port\n```\n\n## Running the Solutions\n\nThe repository includes solution scripts for both challenges.\n\nFirst, `cd` into the solutions directory:\n```bash\ncd solutions\n```\n\nThese require Python 3.7+ and the following dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n### Card Game Solution\n```bash\npython cardgame_solution.py\n```\nThe script will:\n1. Create two accounts\n2. Exploit the race condition in the gifting system\n3. Obtain duplicate name cards\n4. Retrieve the flag\n\n\u003e Note: By default, this solution connects to `localhost:3000`. If you've changed the port or are running on a different host, modify the `HOST` and `PORT` variables in the script.\n\n### Dice Game Solution\nFirst, change the \"history\" array at the top of the file to your dice roll history array.\n```bash\npython dicegame_solution.py\n```\nThe script will:\n1. Use the provided roll history to determine the RNG state\n2. Calculate the next 10 rolls\n3. Print the predictions for manual entry\n\n## Nginx Configuration Requirements\n\nIf you're using Nginx as a reverse proxy, ensure your configuration includes WebSocket support:\n\n```nginx\nlocation / {\n    proxy_pass http://localhost:3000;  # Change port if needed\n    proxy_http_version 1.1;\n    proxy_set_header Upgrade $http_upgrade;\n    proxy_set_header Connection \"upgrade\";\n    proxy_set_header Host $host;\n}\n```\n\n## Challenge Details\n\n### Card Trading Game\n- Players can trade cards with each other\n- Each account gets a unique \"name card\" on registration\n- The goal is to obtain two identical name cards\n- The gift handling is given as a hint\n- Vulnerability: Race condition in the card gifting system\n- Solution: Exploit the race condition by sending multiple gift requests during the artificial delay\n\n### Dice Guessing Game\n- Players must correctly guess 10 dice rolls in a row\n- The game uses a Linear Congruential Generator (LCG) for randomness\n- The RNG implementation is \"accidentally\" leaked\n- Vulnerability: Predictable random number generation\n- Solution: Analyze the roll history to determine the LCG state and predict future rolls\n\n## Notes\n\nThis was designed by Ruel Nathaniel Alarcon for the USASK Cybersecurity Club's meeting/presentation on Advanced Game Exploitation.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruelalarcon%2Fgame_logic_exploits_ctf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruelalarcon%2Fgame_logic_exploits_ctf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruelalarcon%2Fgame_logic_exploits_ctf/lists"}