Open code423n4 opened 2 years ago
I believe the finding to be valid, the warden has shown how the Shelter design allows the client to repeatedly call activate
to prevent anyone from withdrawing the tokens.
Because this is contingent on a malicious admin, I believe Medium Severity to be more appropraite
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/Shelter.sol#L38-L42
Vulnerability details
Impact
Shelter contract can steal user tokens.
Proof of Concept
Shelter
client
can callactivate
on an already activated token, this will reset its start time, so if the client activate a token when itGRACE_PERIOD
is almost finished, it will reset this time. This will prevent the user to callwithdraw
because the conditionactivated[_token] + GRACE_PERIOD < block.timestamp
but will allow the client to calldeactivate
and receive all funds from the users because it will satisfy the conditionactivated[_token] + GRACE_PERIOD > block.timestamp
.Steps:
activate
tokenA.donate
.activate
tokenA again until they has enough tokens.donate
.Recommended Mitigation Steps
activate
twice for the same tokendonate
only after theGRACE_PERIOD