The Pot::closePot
has a possible reentrancy path for the trusted owner, which makes it less critical. However, a trusted owner doesn't guarantee safety. There is still a potential for accidental mistakes or vulnerabilities. An external or third-party contract could interact with the owner's contract, potentially exploiting the vulnerability through indirect means. Additionally, contracts can change ownership or be transferred, so a trusted owner today might not be a trusted owner in the future. Also if someone gets the control over the owners account, the funds are at direct risk.
The reentrancy attack could follow this pattern:
The owner is not trusted anymore
calling closePot()
the function transfers the managerCut
to the owners fallback function
the fallback-function is malicious, calling closePot() again
whenremainingRewards
> 0 the same amount of tokens are transferred again
this is repeated until remainingRewards
is empty or the contest is actual empty
Loss of the contests funds
Manual review
Security best practices, such as the Checks-Effects-Interactions (CEI) pattern and ReentrancyGuard, are implemented to protect against reentrancy vulnerabilities even if the owner is trusted. Using OpenZeppelin's ReentrancyGuard and the CEI pattern protects the contract from unintended behaviors or future vulnerabilities. Even if the current state seems safe, following these patterns ensures long-term security and reduces the potential attack surface.
In this case, claimantCut
(majority of tokens) should be transferred first, and then the manager receives their cut, including any remaining tokens.
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.