20,000 USDC
View results
Submission Details
Severity: high
Valid

unchecked value of _share

Summary

The value of individual _share can be 0 even after staking non zero amount of tokens

Vulnerability Details

uint256 _share = _supplied * _delta / 1e18;

Here it calculate the individaual share through supplied amount 

1. Let say  first deposited 100 tokens first, which will update only supplyIndex[recipient] = index; 
   for the user since balance is updated after updateFor(msg.sender) call   and for the protocol it
   will update index and balance.
2. Second time i deposit the 150 token, it will update   supplyIndex[recipient] = index; and   
   claimable[recipient] += _share; here supplied amount will be 100 token supply 250 so if we take the index as 1.5 
    100*index / 250
   the share value will be yield as zero

Impact

User can lose its reward

Tools Used

manual review

Recommendations

Add the check - require(_share != 0,"err_msg");

Support

FAQs

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