Detailed description of the impact of this finding.
The external function named openCdpWithEth calls the function named _convertRawEthToStETH, which calls the function _depositRawEthIntoLido does not check the return value of the external call to the stEth contract. This can lead to a situation where the call to the stEth contract fails silently, and the function continues execution without any indication of failure. This could result in a discrepancy in the accounting of stEth balances, potentially leading to financial loss.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
function _convertRawEthToStETH(uint256 _initialETH) internal returns (uint256) {
require(msg.value == _initialETH, "EbtcZapRouter: Incorrect ETH amount");
return _depositRawEthIntoLido(_initialETH);
}
In the above function, the external call is made using _depositRawEthIntoLido in call{value: _initialETH}("") without checking the success of the operation.
The _depositRawEthIntoLido function should be modified to check the return value of the external call and revert if the call fails. Here is the recommended change:
By adding the require(success, "Deposit to Lido failed"); statement, the function will revert if the external call to stEth fails, ensuring that the transaction does not proceed with an incorrect stEth balance.
Lines of code
https://github.com/code-423n4/2024-06-badger/blob/9173558ee1ac8a78a7ae0a39b97b50ff0dd9e0f8/ebtc-zap-router/src/ZapRouterBase.sol#L54-L57 https://github.com/code-423n4/2024-06-badger/blob/9173558ee1ac8a78a7ae0a39b97b50ff0dd9e0f8/ebtc-zap-router/src/ZapRouterBase.sol#L56
Vulnerability details
Impact
Detailed description of the impact of this finding.
The external function named openCdpWithEth calls the function named _convertRawEthToStETH, which calls the function _depositRawEthIntoLido does not check the return value of the external call to the stEth contract. This can lead to a situation where the call to the stEth contract fails silently, and the function continues execution without any indication of failure. This could result in a discrepancy in the accounting of stEth balances, potentially leading to financial loss.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
In the above function, the external call is made using
_depositRawEthIntoLido
incall{value: _initialETH}("")
without checking the success of the operation.https://github.com/code-423n4/2024-06-badger/blob/9173558ee1ac8a78a7ae0a39b97b50ff0dd9e0f8/ebtc-zap-router/src/EbtcLeverageZapRouter.sol#L44
https://github.com/code-423n4/2024-06-badger/blob/9173558ee1ac8a78a7ae0a39b97b50ff0dd9e0f8/ebtc-zap-router/src/EbtcLeverageZapRouter.sol#L34-L66
Tools Used
Manual review.
Recommended Mitigation Steps
To mitigate this issue,
By adding the require(success, "Deposit to Lido failed"); statement, the function will revert if the external call to stEth fails, ensuring that the transaction does not proceed with an incorrect stEth balance.
Assessed type
call/delegatecall