Not handling the failure of cross chain messaging
The L1 bridge receiver contract calls the restake deposit function without handling reverts, so a cross-chain deposit can fail on arrival while the L2 side has already minted tokens. Funds sent with the failed message could become stuck on the receiver contract, requiring manual recovery by admins.
Submitted by fyamf, also found by tapir, 0xCiphky (1, 2), LessDupes, ladboy233, guhu95, t0x1c, and grearlake
If the xReceive function fails to handle reverts properly, it could result in funds getting stuck. This can happen for example when:
- Depositing into L2 when protocol on L1 is paused: because pausing is not defined on L2.
- Depositing large amount on L2: because it is not enforced to deposit less than a limit on L2
- Depositing too small amount on L2: because the
ezETHrate on L1 and L2 could be different.
Proof of Concept
Failure to handle errors in the xReceive function as outlined by Connext can lead to funds becoming inaccessible. See here.
This can happen in several scenarios within the xRenzoBridge contract:
- If the deposited amount on L2 exceeds the
maxDepositTVLlimit set on L1, the deposit will fail when bridged to L1. This could occur if an attacker uses a large flash loan ofWETHto deposit on L2 and then swaps the mintedxezETHto repay the flash loan.
function xReceive(
bytes32 _transferId,
uint256 _amount,
address _asset,
address _originSender,
uint32 _origin,
bytes memory
) external nonReentrant returns (bytes memory) {
// ...
restakeManager.depositETH{ value: ethAmount }();
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Bridge/L1/xRenzoBridge.sol#L175
function deposit(
IERC20 _collateralToken,
uint256 _amount,
uint256 _referralId
) public nonReentrant notPaused {
//....
if (maxDepositTVL != 0 && totalTVL + collateralTokenValue > maxDepositTVL) {
revert MaxTVLReached();
}
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/RestakeManager.sol#L510
- If the protocol on L1 is paused, the deposit made on L2 will be successful and equivalent
xezETHwill be minted, but when it is bridged to L1, it will fail. This is because no pausing mechanism is defined on L2 to be aligned with L1.
function depositETH(
uint256 _minOut,
uint256 _deadline
) external payable nonReentrant returns (uint256) {
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Bridge/L2/xRenzoDeposit.sol#L168
function deposit(
uint256 _amountIn,
uint256 _minOut,
uint256 _deadline
) external nonReentrant returns (uint256) {
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Bridge/L2/xRenzoDeposit.sol#L204
- If the deposited amount on L2 is too low so that when it is bridged to L1, minted amount of
ezETHbecomes zero, it will fail. This can happen if between the deposit on L2 and bridging to L1, the TVL increases while total supply ofezETHdoes not change. By doing so, eachezETHis worth more than before. So, when that small amount ofWETHis going to be deposited into the protocol on L1, it mints lessezETHthan the amount ofxezETHminted on L2. If it is zero, it will revert.
function xReceive(
bytes32 _transferId,
uint256 _amount,
address _asset,
address _originSender,
uint32 _origin,
bytes memory
) external nonReentrant returns (bytes memory) {
// ...
restakeManager.depositETH{ value: ethAmount }();
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Bridge/L1/xRenzoBridge.sol#L175
function deposit(
IERC20 _collateralToken,
uint256 _amount,
uint256 _referralId
) public nonReentrant notPaused {
//....
uint256 ezETHToMint = renzoOracle.calculateMintAmount(
totalTVL,
collateralTokenValue,
ezETH.totalSupply()
);
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/RestakeManager.sol#L565
function calculateMintAmount(
uint256 _currentValueInProtocol,
uint256 _newValueAdded,
uint256 _existingEzETHSupply
) external pure returns (uint256) {
//....
if (mintAmount == 0) revert InvalidTokenAmount();
//....
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Oracle/RenzoOracle.sol#L146
Recommended Mitigation Steps
To address these potential failures, it is suggested to:
- Implement error handling in the
xReceivefunction. Specifically, placing thedepositETHfunction call within a try/catch block could help manage these failures. Additionally, only authenticated addresses should be allowed to handle these errors. - Enforce the deposited amount on L2 to be less than
maxDepositTVL. - Define the pausing mechanism on L2.
- Allow the
BrdigeSweeprto define the amount of token to be bridged to L1. By doing so, it can handle the situations where a large amount is deposited on L2.
function sweep(uint256 _amount) public payable nonReentrant {
//...
}
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Bridge/L2/xRenzoDeposit.sol#L414
Assessed type
Context
jatinj615 (Renzo) acknowledged
@alcueca - I think this issue should be of low severity because we can see that
xRenzoBridgehas functions to retrieve the funds that are “stuck”, which is exactly what the first paragraph of the provided Connext documentation advises here. In all matters, manually distributing failed transactions funds is not an optimal solution, but in the end, funds are not really stuck, since the admin can still process them from the Connext directly.
sin1st3r__ (warden) commented:
@Blckhv - I’m afraid this is factually incorrect. Connext allows you to re-submit/retry a failed TX only if it failed due to insufficient relayer fee.
In the case it failed due to the
xReceive()on the destination chain reverting, then the funds will be stuck. Not to mention that this failure is silent. Meaning that admins may be notified that this call failed on the destination chain very late.That’s why the Connext docs says that the
IXReceivercontract should be implemented defensively.If the call on the receiver contract (also referred to as “target” contract) reverts, funds sent in with the call will end up on the receiver contract. To avoid situations where user funds get stuck on the receivers, developers should build any contract implementing
IXReceivedefensively.Ultimately, the goal should be to handle any revert-susceptible code and ensure that the logical owner of funds always maintains agency over them.
Bridging silently failing and admins having to manually recover funds and manually redistribute to other parts of the system is surely Medium severity worthy.
Note: for full discussion, see here.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the receiver's xReceive function performs a deposit call that can revert without a try/catch or other defensive handling, and the L2 side does not mirror L1 limits or pause state.
Impact
Deposits could become stuck on the receiver contract when the L1 deposit reverts, and the failure is silent, so recovery depends on manual admin action.
What the attacker needed
Cross-chain bridge in use; L1 deposit reverts (limit, pause, zero mint)
The fix
The report recommends wrapping the deposit call in a try/catch with authenticated error handling, enforcing the L1 deposit limit on L2, adding a pause mechanism on L2, and letting the sweeper choose the bridged amount; the project acknowledged the issue.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A bridge moves tokens between two blockchains. Here the second chain mints a receipt token immediately, but the first chain can reject the deposit later, for example because a limit was hit or the protocol was paused. Because the receiving contract does not catch that rejection, the money that arrived with the message sits on the contract instead of being credited to the user.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.