Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THORChain_Router::batchTransferOutAndCallV5 function uses msg.value in a loop which makes the function unusable for batch transfers of ETH #77

Closed
howlbot-integration bot opened this issue Jun 14, 2024 · 1 comment
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 duplicate-44 🤖_26_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/code-423n4/2024-06-thorchain/blob/e3fd3c75ff994dce50d6eb66eb290d467bd494f5/ethereum/contracts/THORChain_Router.sol#L309-L311

Vulnerability details

Impact

This error makes the THORChain_Router::batchTransferOutAndCallV5 function unusable for batch swapping ETH, because the full ETH value will be forwarded and depleted with the first transaction causing a revert. This breaks an important functionality for more efficient swaps of large amounts of assets.

Tools Used

Slither

Recommended Mitigation Steps

The fromAmount property on the THORChain_Router::TransferOutAndCallData should be used as the value to send when calling the swapOutV5 function and the THORChain_Router::batchTransferOutAndCallV5 should keep track whether the msg.value has been depleted on each loop iteration and revert if so.

Assessed type

ETH-Transfer

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_26_group AI based duplicate group recommendation bug Something isn't working duplicate-7 sufficient quality report This report is of sufficient quality labels Jun 14, 2024
howlbot-integration bot added a commit that referenced this issue Jun 14, 2024
@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Jun 21, 2024
@c4-judge
Copy link

trust1995 marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 duplicate-44 🤖_26_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

1 participant