Skip to content
Business logic Audit finding Intermediate

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.

0x1f8b Follow

Originally disclosed on Code4rena

Submitted by 0x1f8b

Shelter.sol#L38-L42

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 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.

Recommended Mitigation Steps

  • Avoid activate twice for the same token
  • donate only after the GRACE_PERIOD

leekt (Concur) disputed

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 activate to prevent anyone from withdrawing the tokens.

Because this is contingent on a malicious admin, I believe Medium Severity to be more appropraite.


The original report as published on Code4rena, by 0x1f8b. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

  1. client `activate` tokenA.
  2. Users deposit tokenA using `donate`.
  3. client `activate` tokenA again until they has enough tokens.
  4. More users use `donate`.
  5. 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.

More by 0x1f8b

View all

21 more disclosed reports, best first.

More from Concur Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.