Part 2

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

Reentrancy Vulnerability in Vault Withdrawals

Summary: Reentrancy in Vault.sol allows repeated withdrawals before balance updates, risking fund drainage.

Vulnerability Details:
The withdraw function in Vault.sol transfers assets before updating the user’s balance. ERC777 tokens with callbacks enable attackers to reenter the function, withdrawing more funds than their balance.

Code Reference:

// Vault.sol
function withdraw(uint256 amount) public {
asset.transfer(msg.sender, amount); // Interaction before effect
balances[msg.sender] -= amount;
}


Attack Scenario:
An attacker deposits ERC777 tokens, calls withdraw, and their contract reenters withdraw multiple times during the token’s tokensReceived callback. Each reentry withdraws the same amount, draining the vault.

Impact: High – Complete depletion of vault assets.

Recommendations:

  1. Follow checks-effects-interactions: Update balances before transferring assets.

  2. Use OpenZeppelin’s ReentrancyGuard modifier.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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