Summary
The depositEggToVault function contains a potential reentrancy vulnerability due to external calls to the NFT and Vault contracts. While the function's ordering is correct and there are no state updates after external calls, the dependency on external contracts could lead to security issues if either contract is compromised or contains vulnerabilities.
Vulnerability Details:
The depositEggToVault function performs two sequential external calls:
The function first transfers the NFT to the vault contract and then calls the vault's depositEgg function. While the ordering follows the Checks-Effects-Interactions pattern, the function's security depends on the trustworthiness of both external contracts.
Root Cause:
The vulnerability stems from the following factors:
External Contract Dependencies:
The function relies on the security of the EggstravaganzaNFT contract
The function depends on the security of the EggVault contract
Both contracts must maintain proper security standards
Trust Model:
The implementation assumes both external contracts are secure
No validation of external contract behavior is performed
Success of external calls is not verified
Impact
If either the NFT or Vault contracts are compromised or contain vulnerabilities:
Potential Consequences:
Unauthorized NFT transfers
Inconsistent vault state
Loss of user assets
Tools Used:
Foundry
PoC
Recommended Mitigation
Immediate Fixes:
Add return value checking for external calls
Implement event emissions for state changes
Add input validation for token IDs
Long-term Solutions:
Document trust assumptions about external contracts
Implement monitoring for external contract changes
Consider using a reentrancy guard if needed
Add fuzz testing for edge cases
Implement property-based testing
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.