Description:
The deposit() function assigns the deposit amount to stakedAsset[receiver] using the = operator instead of +=:
This means if a user deposits multiple times before the event starts, only their most recent deposit is tracked. Previous deposits are lost from the accounting system, even though:
All deposits are transferred to the vault
Shares are minted for each deposit
The user paid participation fees for each deposit
Impact:
Users who deposit multiple times lose tracking of earlier deposits
If user deposits 1000, then 500, stakedAsset[user] shows only 500 (not 1500)
User has shares from both deposits but accounting is wrong
joinEvent() will only use shares from the last deposit in calculations
Users effectively lose previous deposit amounts from the betting pool consideration
Participation fees are charged multiple times but only last deposit counts
Proof of Concept:
Mitigation:
Use += to accumulate deposits:
Vault tracks only a single deposit slot per user and overwrites it on every call instead of accumulating the total.
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.