TransferOutAndCall
event is still emitted for failed transferOutAndCall
, which will be observed by Bifrost
#91
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-17
🤖_12_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-06-thorchain/blob/e5ae503d0dc2394a82242be6860eb538345152a1/ethereum/contracts/THORChain_Router.sol#L261-L293
https://github.com/code-423n4/2024-06-thorchain/blob/e5ae503d0dc2394a82242be6860eb538345152a1/ethereum/contracts/THORChain_Router.sol#L209-L238
https://github.com/code-423n4/2024-06-thorchain/blob/e5ae503d0dc2394a82242be6860eb538345152a1/ethereum/contracts/THORChain_Router.sol#L185-L207
https://github.com/code-423n4/2024-06-thorchain/blob/e5ae503d0dc2394a82242be6860eb538345152a1/ethereum/contracts/THORChain_Router.sol#L304-L341
Vulnerability details
Impact
In the
transferOutAndCall
function, if the aggregator's swap fails and directly sending ETH to the recipient also fails (i.e. !erc20Success && !ethSuccess == true), the ETH is sent back to the vault.In this case, the
transferOutAndCall
should be a no-op transaction, meaning it should have no side effects.However, it still emits a
TransferOutAndCall
event, which will be logged by the Bifrost. when Bifrost observes aTransferOutAndCall
event, it can not tell whether the funds were transferred to the recipient or sent back to the vault. This could lead to a situation where the THORNChain network believes the recipient has received a fund when they were actually sent back to the vault, resulting in a loss of funds for the recipient.The same issue also applies to the
transferOut
and_transferOutV5
functions, which emit theTransferOut
event even when ETH is sent back to the vault.It could also apply to the
_transferOutAndCallV5
functions, which emit theTransferOutAndCallV5
event when ETH is sent back to the vault.Tools Used
Manual Review
Recommended Mitigation Steps
Design a distinct event for the scenario where ETH is sent back to the vault, and handle it separately in Bifrost.
Assessed type
Error
The text was updated successfully, but these errors were encountered: