Cooldown and redeem windows can be rendered useless
The cooldown and redeem window mechanism in the sNOTE contract could be bypassed because an account could start a cooldown, wait for it to end, and then deposit and redeem freely during the redeem period, making the cooldown useless. Multiple accounts could also be used to hop between redeem windows, rendering the redeem window ineffective.
Originally disclosed on Code4rena
Submitted by ShippooorDAO
Cooldown and redeem windows can be rendered useless.
Proof of Concept
- Given an account that has not staked sNOTE.
- Account calls sNOTE.startCooldown
- Account waits for the duration of the cooldown period. Redeem period starts.
- Account can then deposit and redeem as they wish, making the cooldown useless.
- Multiple accounts could be used to “hop” between redeem windows by transfering between them, making the redeem window effictively useless.
Could be used for voting power attacks using flash loan if voting process is not monitored https://www.coindesk.com/tech/2020/10/29/flash-loans-have-made-their-way-to-manipulating-protocol-elections/
Tools Used
- VS Code
Recommended Mitigation Steps
A few ways to mitigate this problem: Option A: Remove the cooldown/redeem period as it’s not really preventing much in current state. Option B: Let the contract start the cooldown on mint, and bind the cooldown/redeem window to the amount that was minted at that time by the account. Don’t make sNOTE.startCooldown() available externally. Redeem should verify amount of token available using this new logic.
jeffywu (Notional) confirmed and commented:
Propose to increase the severity of this [from Low] to High.
This image is a better way to understand the potential attack.
pauliax (judge) increased severity to high and commented:
Great find. Agree with the sponsor, the severity can be upgraded because it destroys the cooldown/redeem protection.
Could this be mitigated by including an amount (up to the whole user’s balance) when starting a cooldown, and then redeem can’t withdraw more than specified during the cooldown init?
We’ve prevented this by refactoring how the redemption window is defined.
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
The cooldown and redeem window protections could be bypassed, potentially enabling voting power attacks using flash loans if voting is not monitored.
What the attacker needed
An account that has not staked sNOTE; ability to call startCooldown; wait for cooldown period
The fix
The project refactored how the redemption window is defined to prevent the bypass.
How it was found
- Given an account that has not staked sNOTE.
- Account calls sNOTE.startCooldown
- Account waits for the duration of the cooldown period. Redeem period starts.
- Account can then deposit and redeem as they wish, making the cooldown useless.
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 cooldown is a waiting period before you can withdraw tokens, meant to stop people from quickly moving funds around. Here, once the waiting period ended, the user could add more tokens and withdraw them immediately, so the waiting period no longer protected anything. This could let someone manipulate votes or other token-based actions.
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.