stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

Susceptibility to accounting problems with rebasing tokens in contracts

Summary

The continuous increment of each holder's balanceOf() over time without proper accounting can lead to misallocation of rewards, making them inaccessible to the rightful owners.

Vulnerability Details

Rebasing tokens, such as Aave's aTokens, cause each holder's balanceof() to increment as time progresses. When utilized, any rewards generated accrue to the contract retaining these tokens, rendering them inaccessible to the initial depositor.

function distributeRewards() external onlyRewardsInitiator {
uint256 totalRESDL = ISDLPoolPrimary(sdlPool).effectiveBalanceOf(address(this));
address[] memory tokens = ISDLPoolPrimary(sdlPool).supportedTokens();
uint256 numDestinations = whitelistedChains.length;
ISDLPoolPrimary(sdlPool).withdrawRewards(tokens);
uint256[][] memory distributionAmounts = new uint256[][](numDestinations);
for (uint256 i = 0; i < numDestinations; ++i) {
distributionAmounts[i] = new uint256[](tokens.length);
}
for (uint256 i = 0; i < tokens.length; ++i) {
address token = tokens[i];
uint256 tokenBalance = IERC20(token).balanceOf(address(this));

Impact

Potential loss of rewards

Tools Used

Manual review

Recommendations

To mitigate this, it's recommended to monitor deposited 'shares' on a pro-rata scale. Allow these shares to be redeemed based on their share of the existing balance when the withdrawal is made.

Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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