BriVault

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

Unrestricted ERC‑4626 redeem/withdraw Allows Non‑winners to Exit and Drain Pool

Critical Finding (F-001)

Title: Unrestricted ERC‑4626 redeem/withdraw Allows Non‑winners to Exit and Drain Pool

  • Impact: Losers can call standard ERC‑4626 withdrawal functions to retrieve assets after deposit but before winner settlement, preventing correct distribution to winners and breaking the wagering logic.

  • Evidence: ERC‑4626 exposes public redeem/withdraw which calculate assets = shares * totalAssets() / totalSupply(). Without restrictions, registered participants can redeem their shares.

  • Recommendation (formal mitigation):

    1. Explicitly override public ERC‑4626 withdrawal entry points (redeem, withdraw) to block withdrawals for registered participants while the event has started.

    2. Allow standard withdrawals only when the user is not registered or the event has not started.

    3. Ensure the vault’s custom withdraw() (winner-only) and cancelParticipation() (pre-start) remain the only permitted exit paths for registered users.

Suggested override (illustrative):

function redeem(
uint256 shares,
address receiver,
address owner
) public virtual override returns (uint256 assets) {
// Lock registered participants when the event has started
if (block.timestamp >= eventStartDate && bytes(userToCountry[owner]).length > 0) {
revert eventStarted();
}
return super.redeem(shares, receiver, owner);
}
// Apply equivalent logic to withdraw(uint256 assets, address receiver, address owner)

Notes: Add unit tests for the locked state and for non-registered users to ensure expected ERC‑4626 behavior outside the event lifecycle.


Updates

Appeal created

bube Lead Judge 19 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Unrestricted ERC4626 functions

Support

FAQs

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

Give us feedback!