Eggstravaganza

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

Attacker could frontrun deposit nft to vault

Summary

Attacker could frontrun deposit nft in vault and withdraw nft after that on own address.

Vulnerability Details

User could deposit nft in vault directly, without using funciton depositEggToVault() from EggHuntGame.

  1. User transfer nft on vault contract address.

  2. [Frontrun] Attacker look this tx in mempool and send own tx with call depositEgg(user's nft id, attacker.address). Contract store info, that attacker is owner of this nft.

  3. User send his tx to depositEgg function, but tx will revert.

  4. Attacker call withdrawEgg(user's nft id) and receive nft on his address.

Impact

User could lost his nft, if use depositEgg function directly.

Tools Used

Manual review

Recommendations

Add check in EggVault.depositEgg that caller is EggHuntGame contract and do not allow users call deposit function directly.

Updates

Lead Judging Commences

m3dython Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Frontrunning Vulnerability DepositEgg

Front-running depositEgg allows deposit ownership hijacking.

Support

FAQs

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