createTradingAccountAndMulticall()
does not implement any guards that prevent the caller from draining the contract's native funds.
Currently, there isn’t any logic in any of the implementation contracts that use msg.value
for any purpose. The only thing that needs native funds in the current state of the protocol is the Chainlink verification fee which seems unrelated to this function and a separate issue.
If the assumption that createTradingAccountAndMulticall()
is payable
for users to be able to make calls to functions that will use msg.value
and that are not yet implemented (maybe added in Zaros Part 2) then there is an issue in the way createTradingAccountAndMulticall()
handles msg.value
.
Reference to code: link
When doing a multicall a user could call many function in a batch in one transaction. All these calls will have the same msg.value
and if the functions use msg.value
directly then the user will be able to drain the contracts funds.
This could happen when the user is sending 1 ETH with the multicall but each call from the batch spends 1 ETH from the contracts funds (lets say the user puts 10 such calls in that batch). At the end of the multicall the user have sent 1 ETH and spent 10 ETH.
User is able to drain the contracts native funds if there are any functions that work with msg.value.
Manual Review
In order to prevent this from happening createTradingAccountAndMulticall()
should:
record in storage the sent msg.value
before looping through the calls
the functions that work with msg.value
should only trust this storage variable and reduce it with the amount they have used (depending on the logic)
Before the multicall finishes execution reset the storage variable to 0.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.