No upper limit on coolDownTimeInSeconds allows funds to be locked sNOTE owner
The sNOTE contract allows the owner to set an arbitrarily large cooldown period, which can cause the startCooldown function to always revert, locking users' funds indefinitely if ownership is compromised.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain, also found by defsec, Dravee, and Jujic
Inability for sNOTE holders to exit the pool in the case of ownership over SNOTE contract being compromised/malicious.
Proof of Concept
sNOTE works on a stkAAVE model where users have to wait a set cooldown period before being able to reclaim the underlying tokens. This cooldown period can be set to an arbitrary uint32 value in seconds by the owner of the sNOTE contract.
Below in the startCooldown() function, it’s possible for the owner of the sNOTE contract to choose a value for coolDownTimeInSeconds which always causes this function to revert (_safe32 will always revert if coolDownTimeInSeconds = type(uint32).max).
Should ownership over sNOTE become compromised then all of the users’ assets may be locked indefinitely.
Recommended Mitigation Steps
Provide a sensible upper limit to coolDownTimeInSeconds of, say, a month. This will give plenty of time for NOTE governance to withdraw funds in the event of a shortfall while giving confidence that a user’s funds can’t be locked forever.
Valid concern. I was thinking if this should be left as of medium or low severity, but decided this time in favor of wardens: “Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.”
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
Likely the absence of an upper bound on the cooldown period allows the owner to set a value that causes an arithmetic overflow in the _safe32 conversion, making the startCooldown function always revert.
Impact
If the owner's account is compromised, all users' assets could be locked indefinitely because the cooldown cannot be started.
What the attacker needed
Ownership of sNOTE is compromised or malicious
The fix
The cooldown period should be capped at a sensible maximum, such as one month, to prevent indefinite locking.
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.
In this staking contract, users must wait a cooldown period before withdrawing their tokens. The owner can set this period to any number, and if set too high, the function that starts the cooldown will always fail, so users can never withdraw. This means if the owner's account is hacked, all funds could be stuck forever.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.