DeFiHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Invalid

Unchecked return value in `_withdrawTokens` function

Summary

The _withdrawTokens function is integral to the contract's operations, managing the withdrawal of tokens from user accounts and updating the corresponding bean denominated value (BDV) and stalk. However, the original implementation lacks proper handling of the return value from the LibSilo.burnActiveStalk function, which could lead to silent failures and inconsistencies in the contract's state.

Vulnerability Details

The LibSilo.burnActiveStalk function call in the _withdrawTokens function does not check its return value. This is a critical issue because if burnActiveStalk fails, it might not be noticed, leading to potential inconsistencies and vulnerabilities in the contract's accounting system.

Impact

Silent Failure: If the burnActiveStalk function fails and its return value is not checked, the contract may continue operating under the assumption that the stalk was successfully burned. This could lead to incorrect accounting and potential double-spending vulnerabilities.

State Inconsistency: Failing to verify the success of critical operations like burnActiveStalk can leave the contract in an inconsistent state, undermining the integrity of the entire system.

Tools Used

Manual review

Recommendations

Implement Return Value Checks: Ensure that the return values of all critical functions are checked and handled appropriately. This can prevent silent failures and ensure that the contract's state remains consistent.

// Check the return value of burnActiveStalk
bool burnSuccess = LibSilo.burnActiveStalk(
account,
a.active.stalk.add(a.active.bdv.mul(s.ss[token].stalkIssuedPerBdv))
);
require(burnSuccess, "Burn active stalk failed");
Updates

Lead Judging Commences

giovannidisiena 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.