The _handleReturn function incorrectly refunds execution fees to the owner of the latest deposit instead of the current deposit being withdrawn. This is due to referencing depositInfo[counter] instead of using depositId extracted from flowData.
The _handleReturn function is called during the WITHDRAW flow.
The flowData contains the depositId corresponding to the withdrawal.
However, when refunding execution fees, the function references depositInfo[counter], which always points to the last deposit made.
This means that if a user withdraws an earlier deposit, the execution fee refund could be sent to the wrong owner.
Instead of using depositInfo[depositId], the function mistakenly uses depositInfo[counter], leading to incorrect refunds.
Users may not receive their rightful refund if the execution fee is mistakenly sent to the latest depositor instead of the current one.
Execution fee refunds will not correspond correctly to the deposit being withdrawn, leading to financial inconsistencies.
Manual Review
Ensure that execution fee refunds are based on the depositId from flowData (current deposit) instead of counter (last deposit).
Likelihood: Medium/High, when withdraw on a 1x vault. Impact: High, the fees will be distributed to the last depositor and not the withdrawer.
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.