Description: The RockPaperScissors::setAdmin
function can currently only be called by the admin. This invalidates the docs which state that the owner of the RockPaperScissors
should be able to change the admin.
Impact: The RockPaperScissors
contract owner has no power over the contract admin once they've set the first admin. This gives all power to the admin to change and set new admins. This is dangerous because the admin is the one who can withdraw the fees from the contract. Therefore, the contract owner has no control over the contract administration whatsoever.
Recommended Mitigation:
There are a different ways to mitigate this:
Use the Ownable
abstract class by openzeppelin
by extending the RockPaperScissors
contract which will make the initial deployer of the contract the owner and use the onlyOwner
modifier for the setAdmin
function to prevent the admin and anyone else from setting a new admin.
Introduce a contractOwner
property and change the require check in the setAdmin
function to verify it's called by the contract owner. This will ensure only the contract owner has the means to set and change the admin any time.
Code suggestions or observations that do not pose a direct security risk.
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.