Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

Reentrancy Risk in withdrawEgg (EggVault)

Summary

The withdrawEgg function in EggVault performs an external call (transferFrom) before updating state, opening a reentrancy attack vector.

Vulnerability Details

  • The function updates storedEggs and eggDepositors after transferring the NFT.

  • If eggNFT is a malicious contract overriding onERC721Received, it could re-enter withdrawEgg to drain the vault.

Impact

  • An attacker could recursively withdraw the same egg multiple times or manipulate vault state.

Tools Used

Manual review of state changes and external calls.

Recommendations

  • Follow Checks-Effects-Interactions (CEI) pattern: update state before calling transferFrom.

  • Use OpenZeppelin’s ReentrancyGuard for critical functions.

Updates

Lead Judging Commences

m3dython Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!