Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

Reentrancy Attack Risk - ZipVault.sol

Summary

The deposit, mint, withdraw, and redeem functions in ZipVault.sol are overridden and can be called by the MarketMakingEngine contract, potentially leading to a reentrancy attack.

Vulnerability Details

The deposit, mint, withdraw, and redeem functions are overridden and can be called by the MarketMakingEngine contract. If the MarketMakingEngine contract is compromised or has a bug, it could potentially call these functions multiple times, leading to a reentrancy attack. For example, if the MarketMakingEngine calls the withdraw function, and then calls it again before the first call is completed, it could drain all the assets from the vault.

Impact

A high reentrancy attack could lead to the loss of all assets in the vault, causing significant financial damage to users and the protocol.

Tools Used

Manual code review and analysis.

Recommendations

Implement the Checks-Effects-Interactions pattern to ensure that all state changes are made before any external calls are made. For example, in the withdraw function, update the vault's state before transferring the assets to the receiver.

function withdraw(
uint256 assets,
address receiver,
address owner
) public override onlyMarketMakingEngine returns (uint256) {
// Update state before making external calls
_burn(owner, assets);
IERC20(asset()).transfer(receiver, assets);
return assets;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.