The WinningToken
contract inherits from OpenZeppelin's ERC20Burnable
but doesn't override the burn functionality with appropriate access controls. This allows any token holder to burn their tokens, which contradicts the intended design of a controlled game token system where token lifecycle should be managed by the game contract.
The WinningToken
contract implements:
By inheriting from ERC20Burnable
without overriding the functions, the contract inherits:
burn(uint256 amount)
- allowing any user to burn their own tokens
burnFrom(address account, uint256 amount)
- allowing approved addresses to burn tokens from others
Since the intent appears to be that only the owner (the game contract) should control token lifecycle, this unrestricted burning capability goes against the token's design purpose.
This vulnerability allows any player to unilaterally destroy their tokens rather than using them within the game system. This can lead to:
Circumvention of game economics - Players can burn tokens instead of using them in the game
Inconsistent token accounting - The game contract may lose track of tokens that were intended to be in circulation
Potential game state manipulation - If the game contract doesn't account for tokens being burned outside its control, this could lead to unexpected behaviors
The severity is medium since this doesn't directly lead to fund loss but undermines the token economy design and could disrupt game functionality.
Manual code review
Implement access control on burn operations by overriding the burn functions:
Alternatively, if the intent is to allow the game contract to burn tokens while also allowing players to burn their own tokens:
Create a mapping of authorized burners:
Add functions to manage this list:
Override burn functions with this check:
This ensures only authorized entities can perform token burning operations.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.