DeFiHardhatOracleProxyUpdates
100,000 USDC
View results
Submission Details
Severity: low
Invalid

`transferStalk` Doesn't check sender's stalk balance

Summary

The LibSilo:transferStalk function does not properly check whether the sender has a sufficient balance of stalk to transfer. This oversight could allow transfers that exceed the sender's balance, leading to an overdraft situation where the sender's balance goes negative.

Vulnerability Details

See the folowing code:

function transferStalk(address sender, address recipient, uint256 stalk) internal {
AppStorage storage s = LibAppStorage.diamondStorage();
uint256 roots;
roots = stalk == s.a[sender].s.stalk ? s.a[sender].roots : s.s.roots.sub(1).mul(stalk).div(s.s.stalk).add(1);
// Subtract Stalk and Roots from the 'sender' balance.
s.a[sender].s.stalk = s.a[sender].s.stalk.sub(stalk);
s.a[sender].roots = s.a[sender].roots.sub(roots);
emit StalkBalanceChanged(sender, -int256(stalk), -int256(roots));
// Add Stalk and Roots to the 'recipient' balance.
s.a[recipient].s.stalk = s.a[recipient].s.stalk.add(stalk);
s.a[recipient].roots = s.a[recipient].roots.add(roots);
emit StalkBalanceChanged(recipient, int256(stalk), int256(roots));
}

Impact

If the transferStalk function allows transfers exceeding the sender's balance, it can lead to inconsistencies in the accounting of Stalk and Roots balances. Additionally, it can create unexpected behavior within the application, potentially disrupting the intended flow of operations and causing financial losses for users.

Tools Used

Manual Review

Recommendations

To address this issue, proper validation should be added to ensure that the sender has a sufficient balance of Stalk to transfer before proceeding with the transfer. If the sender's balance is insufficient, the function should revert the transaction or handle the situation gracefully, based on the requirements of the application.

Updates

Lead Judging Commences

giovannidisiena Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational/Invalid

Support

FAQs

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