The BriVault contract implements the ERC4626 standard where users deposit assets and receive vault shares proportional to their deposit amount. Share calculation uses the ratio of total shares to total assets in the vault, ensuring fair distribution where larger deposits receive proportionally more shares.
The vault is vulnerable to an inflation attack where a malicious first depositor can manipulate the share price by depositing a minimal amount (1 wei) to mint 1 share, then directly transferring a large amount of tokens to the vault without going through the deposit function. This artificially inflates the vault's asset balance without minting corresponding shares, causing the share-to-asset ratio to become extremely skewed. When subsequent users deposit significant amounts, the share calculation rounds down to zero due to the inflated asset base, resulting in victims receiving no shares while their funds remain locked in the vault. The attacker can then redeem their single share for the entire vault balance, effectively stealing all victim deposits.
The vulnerability exists because _convertToShares uses IERC20(asset()).balanceOf(address(this)) to calculate share price. This balance can be manipulated by direct token transfers outside the deposit function, causing the share calculation to round down to zero for subsequent depositors when the balance is artificially inflated.
Likelihood:
This attack occurs at vault deployment when an attacker monitors the mempool and front-runs the first legitimate depositor with a minimal deposit followed by a direct token transfer.
The exploit requires no special privileges or complex conditions - any user can execute the attack by simply being the first depositor and performing a standard ERC20 transfer to inflate the vault balance.
Impact:
Users who deposit after the inflation attack receive zero shares despite transferring their full deposit amount, resulting in complete and permanent loss of their funds with no ability to withdraw.
The attacker extracts the entire vault balance (including all victim deposits) by redeeming their single share, effectively stealing all subsequent deposits and making the vault unusable for its intended tournament betting functionality.
RESULT:
prevents the inflation attack by ensuring the share-to-asset ratio cannot be manipulated through rounding errors.
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.