_handleReturn() double-counts withdrawn, allowing to get excess funds.
Consider this scenario:
Vault total assets = 1,000 USDC
totalShares = 1,000 shares
User holds 100 shares (10%)
The user calls withdraw(), triggering a partial close of GMX MarketSwap.
After the GMX MarketSwap, the Vault receives 50 USDC.
withdrawn = 50
_handleReturn() is called with withdrawn = 50.
withdrawn = 50 USDC
Vault balance = 1,000 USDC
BeforeWithdrawal = 1,000 - 50 = 950 USDC\
shares = 100 (10%)
amount = 50 + 95 = 145 USDC
The user ultimately receives 145 USDC, which is 45 USDC more than the 100 USDC they should have received!
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.