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

Unchecked Transfer Vulnerability in LibWellConvert.sol

Summary

The code snippet provided contains a high-severity vulnerability related to an unchecked transfer in the _wellAddLiquidityTowardsPeg function within the LibWellConvert library. The contract fails to verify the return value of the C.bean().transfer operation, introducing a potential security risk.

Vulnerability Details

In the _wellAddLiquidityTowardsPeg function, the C.bean().transfer(well, beansConverted) operation is performed without checking the return value for success or failure. This unchecked transfer can lead to vulnerabilities where the function continues execution even if the transfer fails, allowing an attacker to manipulate the state of the contract without proper detection.

(contracts/libraries/Convert/LibWellConvert.sol#194-207)

function _wellAddLiquidityTowardsPeg(
uint256 beans,
uint256 minLP,
address well
) internal returns (uint256 lp, uint256 beansConverted) {
(uint256 maxBeans, ) = _beansToPeg(well);
require(maxBeans > 0, "Convert: P must be >= 1.");
beansConverted = beans > maxBeans ? maxBeans : beans;
C.bean().transfer(well, beansConverted);
lp = IWell(well).sync(
address(this),
minLP
);
}

Impact

The impact of this vulnerability is significant as it allows an attacker to exploit the unchecked transfer, potentially causing loss of funds or manipulation of the contract's state. If the C.bean().transfer operation fails, the function proceeds without reverting, leading to unexpected behavior and a potential security breach.

Tools Used

Manual review and slither.

Recommendations

To mitigate this vulnerability, it is strongly recommended to check the return value of the C.bean().transfer operation and handle potential failure conditions appropriately. Consider using SafeERC20 or implementing a manual check to ensure that the transfer was successful before proceeding with further operations. This practice is crucial for maintaining the integrity and security of the contract, preventing unauthorized state changes or fund losses.

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.