In the "addUnderlying" function of the "LibFertilizer.sol" contract stems from the lack of proper return value checks when interacting with ERC20 tokens. Specifically, the function fails to validate the return values of the "transferFrom" and approve calls, which can lead to severe security risks.
The function neglects to verify the return values of the "transferFrom" and "approve" calls made to interact with ERC20 tokens "(barnRaiseToken)". According to the ERC20 standard, these functions should return a boolean value indicating the success or failure of the operation. However, certain tokens like BAT may deviate from this standard, potentially returning false or failing silently instead of reverting. Since the "addUnderlying" function handles the minting of tokens and liquidity addition to the Barn Raise Well, any successful exploitation of this vulnerability could undermine the system's integrity and functionality.
The absence of proper return value checks poses a risk wherein transfer or approval operations may fail without the contract's awareness. Consequently, tokens could become lost or trapped within the contract, lacking mechanisms to address failed token transfers. This, in turn, may lead to unintended minting of free bean tokens, LP beans, and liquidity addition to the well.
The vulnerability was identified using Slither-analyzer along with manual code review.
It is advised to address the aforementioned instance by implementing proper return value checks. Consider leveraging "safeTransferFrom" from OpenZeppelin, as it is utilized elsewhere in the codebase.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.