The protocol implements a Vault architecture that allows users to deposit and withdraw funds. The vulnerability lies in the _mint
function and how shares for deposits are calculated. Depending on the deposit amount, users can receive disproportionately profitable rates.
Let's take a look at the _mint
function:
As we can see, after the first deposit is made, shares are calculated based on the amount deposited relative to the current balance. The problem with this approach is that if a user deposits an amount close to the current Vault balance, they will receive a significantly higher share allocation.
For example:
The first depositor deposits 1e10
tokens and receives 10e18
shares.
The second depositor also deposits 1e10
tokens, but their share calculation is as follows:
As we can see, the second depositor receives significantly more shares than the first depositor, despite depositing the same amount of tokens.
Users can receive far more shares than intended by the protocol, leading to unfair distribution and potential exploitation.
Manual review.
Fix the formula to align with the ERC-4626 shares/tokens calculation method.
No proof when this can happen: Most of the time totalAmountBefore equals 0 (balance minus amount sent), it means totalShares equals 0. If it could happen with very specific conditions, report with that tag didn't add the needed details to be validated.
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.