Single Error Within SponsorVault Contract Could Cause Entire Cross-Chain Communication To Break Down #146
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/BridgeFacet.sol#L819](https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/BridgeFacet.sol#L819
Vulnerability details
Proof-of-Concept
A third party sponsor would need to implement a
SponsorVault
contract that is aligned with theISponsorVault
interface.Assume that a
SponsorVault
contract has been defined on Optimism chain. All cross-chain communications are required to call theBridgeFacet.execute
, which in turn will trigger theBridgeFacet._handleExecuteTransaction
internal function.However, if there is an error within
SponsorVault
contract in Optimism causing a revert whens.sponsorVault.reimburseLiquidityFees
ors.sponsorVault.reimburseRelayerFees
is called, the entireexecute
transaction will revert. Sinceexecute
transaction always revert, any cross-chain communication between Optimism and other domains will fail.https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/BridgeFacet.sol#L819
Impact
It will result in denial of service. The
SponsorVault
contract, which belongs to a third-party, is a single point of failure for a domain.Recommended Mitigation Steps
This is a problem commonly encountered whenever a method of a smart contract calls another contract – we cannot rely on the other contract to work 100% of the time, and it is dangerous to assume that the external call will always be successful. Additionally, external smart contract might be vulnerable and compromised by an attacker. Even if the team has audited or review the SponsorVault before whitelisting them, some risk might still exist.
Therefore, it is recommended to implement a fail-safe design where failure of an external call to SponsorVault will not disrupt the cross-chain communication. Consider implementing a try-catch block as shown below. If there is any issue with the external
SponsorVault
contract, no funds are reimbursed to the users in the worst case scenario, but the issue will not cause any impact to the cross-chain communication.The text was updated successfully, but these errors were encountered: