MochiTreasuryV0.withdrawLock() Is Callable When Locking Has Been Toggled
The withdrawLock() function in MochiTreasuryV0 can be called even when locking has been toggled off, allowing unexpected withdrawals. An attacker could potentially relock tokens maliciously if the behaviour is unintended.
Submitted by leastwood
Impact
withdrawLock() does not prevent users from calling this function when locking has been toggled. As a result, withdraws may be made unexpectedly.
Proof of Concept
Tools Used
Manual code review
Recommended Mitigation Steps
Consider adding require(lockCrv, "!lock"); to withdrawLock() to ensure this function is not called unexpectedly. Alternatively if this is intended behaviour, it should be rather checked that the lock has not been toggled, otherwise users could maliciously relock tokens.
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 withdrawLock() function lacks a check on the lockCrv state variable to ensure locking is enabled before allowing withdrawals.
Impact
Withdrawals may be made unexpectedly, and if the behaviour is unintended, users could maliciously relock tokens.
What the attacker needed
None
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 function to withdraw locked tokens. The contract also has a setting to turn locking on or off. The bug is that the withdraw function does not check whether locking is currently on, so someone could withdraw tokens even when locking is supposed to be off, which might be unexpected.
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.