Closed c4-submissions closed 11 months ago
DadeKuma marked the issue as insufficient quality report
QA
DadeKuma marked the issue as primary issue
0xean marked the issue as unsatisfactory: Insufficient quality
0xean marked the issue as unsatisfactory: Insufficient quality
Lines of code
https://github.com/code-423n4/2023-11-zetachain/blob/44c8dd426e829536850b5d42b3f0ade1ce29a23c/repos/protocol-contracts/contracts/zevm/ZetaConnectorZEVM.sol#L92-L108
Vulnerability details
Impact
The
send()
function makes 3 external contract calls toWZETA
andFUNGIBLE_MODULE_ADDRESS
without locking state first via a reentrancy guard. This allows an attacker to make a callback back intosend()
before the first call finishes.For example, the
WZETA.withdraw()
call could trigger a malicious WZETA contract to callsend()
again. This second invocation would then operate on the same storage state as the first, leading to potentially unintended side effects.So, the external calls made in ZetaConnectorZEVM's
send()
function can be exploited by a malicious callback contract to re-entersend()
before the first invocation finishes. This can lead to:Proof of Concept
As we can see, the send() function makes external calls to
WZETA.transferFrom()
,WZETA.withdraw()
, andFUNGIBLE_MODULE_ADDRESS.call()
without locking state first. This allows for a reentrancy attack.Tools Used
Manual review
Recommended Mitigation Steps
Add a [Re-entrancy Guard] to the function. The function should use a Checks-Effects-Interactions pattern. The external calls should be executed at the end of the function and all the state-changing must happen before the call.
Assessed type
Reentrancy