-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Multicall being payable is seriously dangerous. #52
Comments
We don't actually use |
3 tasks
z0r0z
added a commit
to kalidao/keep
that referenced
this issue
Mar 21, 2022
security advisory on payable Uniswap/v3-periphery#52
How I can use multicall function? |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Multicall.multicall
pattern is getting a lot of love lately. I first saw it used by ENS and now in Uniswap-V3-periphery. Yet, I see that your implementation includes the payable keyword. I do believe this is potentially dangerous and should be removed. People might copy that and not see the side-effect.Example:
Exploit:
If I batch multiple payable subcall, they will all consider the msg.value. So calling
instance.multicall(["0x","0x","0x","0x","0x"], {value : 10**18 })
will credit me 5eth, despite only having deposited one.Thus I could drain 4eth from the contract in a single call by doing :
instance.multicall(["0x","0x","0x","0x","0x", "0x853828b6" ], {value : 10**18 })
Beyond this simple example, any contract that considers msg.value, without comparing it to
address(this).balance - interbookkeppingBalance
is sensible ... this include almost all contracts with payable functionsAdvice:
Add extensive warnings in the Multicall contract, or remove payability from it.
The text was updated successfully, but these errors were encountered: