Skip to content
Business logic Audit finding Intermediate

Deposits after the grace period should not be allowed

The donate function in Shelter.sol allows deposits after the grace period ends, which can increase the savedTokens for a token and thus increase claim amounts for users who have not yet withdrawn, potentially disadvantaging those who already withdrew.

pauliax Follow

Originally disclosed on Code4rena

Submitted by pauliax

Shelter.sol#L34 Shelter.sol#L54

Function donate in Shelter shouldn’t allow new deposits after the grace period ends, when the claim period begins. Otherwise, it will be possible to increase savedTokens[_token], and thus new user claim amounts will increase after some users might already have withdrawn their shares.

Recommended Mitigation Steps

Based on my understanding, it should contain this check:

  require(activated[_token] + GRACE_PERIOD > block.timestamp, "too late");

leekt (Concur) confirmed

Alex the Entreprenerd (judge) commented:

Separating between a rescuing period and a redemption period does make sense and avoids losing on future rewards by withdrawing early.

The sponsor confirmed, I believe medium severity to be appropriate.


The original report as published on Code4rena, by pauliax. 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

Impact

This could allow an attacker to increase the savedTokens for a token after some users have already withdrawn, thereby increasing the claim amounts for remaining users and potentially causing loss or unfairness.

What the attacker needed

None

The fix

The donate function should include a check that the current time is within the grace period, such as requiring that the activation time plus the grace period is greater than the current block timestamp.

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 has a donation function that lets people add tokens to a pool. After a certain time (the grace period), users can claim their share. The bug is that donations are still allowed after that time, so someone can add more tokens and change the amounts others can claim, which is unfair to those who already claimed.

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 pauliax

View all

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