DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: high
Invalid

user can stake, claimPoints and unstake at same timestamp

Summary

When block.timestamp == lastDistribution + EPOCH_DURATION this allows users to stake , claimPoints and unstake at same time .User can flash loan tokens > stake > claimPoints > unstake which will lead more points being claimed.

Vulnerability Details

Users need to stake for a lifeCycle of 6 epochs to unstake but its possible to unstake within 1 epoch which is 1 week which allows staking > claiming > unstake in same epoch.

  1. For flashloan scenario:
    the if statement is true when block.timestamp = lastDistribution + EPOCH_DURATION which allows user to flash loan tokens > stake > claimPoints > unstake .
    In function distributePoints():

function distributePoints() public {
if (block.timestamp < lastDistribution + EPOCH_DURATION) {
return;
}
}
  1. For stake before EPOCH_DURATION end or claimPoints() :
    user can stake before epoch end and claimPoints and unstake at same epoch same as flashloan but only flashloan is not applied because user needs to pay fees within the same transaction.

Impact

user can claim rewards without waiting for EPOCH_DURATION.

Tools Used

manual review

Recommendations

for flashloan : now cant at same block.timestamp

function distributePoints() public {
if (block.timestamp <= lastDistribution + EPOCH_DURATION) {
return;
}
}

for stake before claim :
Recalculate points or rewards based on the actual duration that a user's stake was held within an epoch.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

0x00a Submitter
about 1 year ago
inallhonesty Lead Judge
about 1 year ago
0x00a Submitter
about 1 year ago
0x00a Submitter
about 1 year ago
inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.