In Perpetual::_handleReturn, at the end, if there is refund parameter set to true, refund will be processed, and correspond value will be passed in as argument to refundExecutionFee to proceed refund. However, the current implementation passes incorrect value, causing refund processed incorrectly.
Here at the end of _handleReturn:
If execution fee is greater than used fee, meaning there is excess fee to be refunded, however, in refundExecutionFee, the depositInfo is getting index counter, instead of depositId, original user will not receive refund, but the last deposit owner will.
Refund is handled incorrectly, intended user will not receive refund.
Manual review
For index in depositInfo, use depositId instead.
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.