Fund stuck forever
in vault in case of multiple deposits to different vaults
#6
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
edited-by-warden
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-06-thorchain/blob/main/bifrost/pkg/chainclients/shared/evm/smartcontract_log_parser.go#L182-L212
Vulnerability details
Description
While removing whitelisting will open the door for more composability with THORChain, the current
SmartContractLogParser::GetTxInItem
implementation seemstoo rigid
to leverage such composability, at least in regard to theDeposit event
, which seems to warrantHigh
severity asuser funds loss
could occurs.Imagine a dApp that integrates with THORChainRouter (as possible in the future with no whitelisting) decides to make multiple deposits in a
single transaction
which would be as follow:DepositAggregatorDapp
is a smart contract call, but not directly the router. And since those events are generated by the router, it would pass the main gate.GetTxInItem
, the first deposit event would be processed properly (depositWithExpiry(Vault1, Asset1, ...
), but the 2nd event processed would fail the following condition, which would cause the function to abort and return an error. This is due to the fact that in a same transaction, there would be multiple deposit event that goes todifferent vaults
, which granted doesn't make sense in a whitelisted world, but seems to make sense in a non-whitelisted world. This would means that those deposits event would not be accounted for, thus not sent to THORChain, which is effectively is auser funds loss
for the user as those funds would be stuck there forever, like a donation.Impact
User deposits could be
stuck forever
into the THORChain vault(s) in case a non-whitelisted smart contract do multiple deposits to different vault in the same transaction.Tools Used
Manual review
Recommended Mitigation Steps
The current event processing rules in
GetTxInItem
might need toevolve
with the fact of removing the whitelisting. While in this report I showcased how an aggregator/integrator could break theDeposit event
, other events would need also to be reviewed. Seems like a refactoring would be needed in GetTxInItem in order to support the use case described in my report, which seems realistic with increased composability.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: