Rogue pool in Shelter
The Shelter contract allows the client to call activate on an already activated token, resetting its start time. This prevents users from withdrawing their donated tokens while allowing the client to deactivate and take all funds.
Submitted by 0x1f8b
Shelter contract can steal user tokens.
Proof of Concept
Shelter client can call activate on an already activated token, this will reset its start time, so if the client activate a token when it GRACE_PERIOD is almost finished, it will reset this time.
This will prevent the user to call withdraw because the condition activated[_token] + GRACE_PERIOD < block.timestamp but will allow the client to call deactivate and receive all funds from the users because it will satisfy the condition activated[_token] + GRACE_PERIOD > block.timestamp.
Steps:
- client
activatetokenA. - Users deposit tokenA using
donate. - client
activatetokenA again until they has enough tokens. - More users use
donate. - client deactivate tokenA and receive all tokens.
Recommended Mitigation Steps
- Avoid
activatetwice for the same token donateonly after theGRACE_PERIOD
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
I believe the finding to be valid. The warden has shown how the Shelter design allows the client to repeatedly call
activateto prevent anyone from withdrawing the tokens.Because this is contingent on a malicious admin, I believe Medium Severity to be more appropraite.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The activate function does not check if the token is already activated, allowing the client to reset the start time repeatedly.
Impact
The client could steal all user tokens by preventing withdrawals and then deactivating to collect the funds.
What the attacker needed
Malicious client (admin) of the contract
How it was found
- client `activate` tokenA.
- Users deposit tokenA using `donate`.
- client `activate` tokenA again until they has enough tokens.
- More users use `donate`.
- client deactivate tokenA and receive all tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract holds tokens that users donate. The contract has a rule that users can only withdraw after a waiting period, and the person who set up the contract can take the tokens if the waiting period is still active. The bug is that the setup person can restart the waiting period whenever they want, so users can never withdraw, but the setup person can still take the tokens.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.