Closed sherlock-admin closed 2 years ago
Appreciate the detail in the description of the finding and recommendation. Then checking remainingDuration > MIN_LOCK_DURATION
should be sufficient (or checking remainingDuration
against other desired amount of time).
Since user can deposit without the min lockup duration limit, user can use flash loan to get huge amount of shares, claim reward, pay back the loan without any risk.
This would be valid if it's block.timestamp > userDeposit.end
instead of block.timestamp >= userDeposit.end
.
But since it revert when block.timestamp == userDeposit.end
in increaseLock()
, flash loan won't be possible.
The description made by @jack-the-pug makes this no vulnerability.
Feel free to provide a code snippet or any additional information.
minhquanym
high
Flash loan vulnerability - User can bypass
MIN_LOCK_DURATION
limitSummary
User can use
increaseLock(...)
function to bypass the min duration limit inTimeLockPool
https://github.com/sherlock-audit/2022-10-merit-circle/blob/main/merit-liquidity-mining/contracts/TimeLockPool.sol#L197Vulnerability Detail
In
TimeLockPool
, there is a min lockup durationMIN_LOCK_DURATION = 10 minutes
to prevent flash loan or MEV transaction ordering. However, exploiter can trick this limit by usingincreaseLock(...)
function. Exploiter can create a lock with minimal amount every block and he will wait for the lock to be ended in the next block and deposit usingincreaseLock(...)
function.Impact
Since user can deposit without the min lockup duration limit, user can use flash loan to get huge amount of shares, claim reward, pay back the loan without any risk.
Code Snippet
Function
increaseLock(...)
does not check the min lockup durationTool used
Manual Review
Recommendation
Consider adding min lockup duration check in
increaseLock(...)
function.