Since the ERC-4626 tokens can be transferred between players freely at any period of time, winner can aggregate more shares from other losers (likely also be attacker's address) to increase share balance while the denominator totalWinnerShares stay unchanged.
assetToWithdraw will then have an outsized allocation to the winner, making other legitimate winners withdraw less or even unable to withdraw.
It is mainly caused by the snapshot mismatch in getting shares and totalWinnerShares. The contracts uses balanceOf(msg.sender) to calculate a "now" winner's shares and totalWinnerShares to record a "then" total winners shares, which has already been fixed during the setWinner process.
Likelihood: High
The attack requires no extra settings and permissions. Losers may willingly transfer their shares to the attacker because their shares otherwise have zero payouts. Losers can also be addresses controlled by the attacker making every possible guess, guarantee at least one winning address (Sybil), transferring the losing shares to over claim.
Extremely profitable for attackers and very easy to conduct exploitation.
Impact: High
Full loss for honest winners. Attackers can withdraw most or all of the final assets on their first claim, causing subsequent winners to revert. Protocol totally unusable.
This test function demonstrates how to make attacker win an extra amount of prize and drain the vault, making other winners (victim) unable to withdraw.
How to run this test: Paste test function test_exploitShareStuffing() in file test/briVault.t.sol.
Switch the shares to userSharesToCountry[msg.sender][winnerCountryId] to align the snapshot timing with that of totalWinnerShares.
Or we can just block all share transfers after the event ends
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.