Decoding of user supplied calldata
can fail unexpectedly before making the onCatalystCall
call
#75
Labels
invalid
This doesn't seem right
Github username: --
Twitter username: --
Submission hash (on-chain): 0xf589e38631045ac8160c778bc6fdbdd028b70693fca9cb3aa54490520b12b224
Severity: medium
Description:
Description
The CCI contract makes external call to a user supplied address during the cross chain swap. Before making the external
onCatalystCall
the CCI contract tried to decode the address and calldata for that call.This is done in these functions:
_handleReceiveAssetFallback
https://github.com/catalystdao/catalyst/blob/main/evm/src/CatalystChainInterface.sol#L536-L537
It can be seen that this function tries to decode
dataTarget
address.In case a user supplied invalid calldata (length < 20 bytes) then this decoding will fail abruptly, resulting in the
CCI.receiveMessage
call getting reverted.Attachments
Test case was added to
ExampleTest.t.sol
Output:
The
ff
in the log shows that theCCI.receiveMessage
call failed silently.Consider validating that the calldata input if of sufficient lenght (atleast 20 bytes).
The text was updated successfully, but these errors were encountered: