PerpetualVault.sol::_cancelFlow()
The _cancelFlow() function in PerpetualVault.sol performs external token transfers before updating the state. This creates a reentrancy vulnerability that attackers could exploit to withdraw funds multiple times.
safeTransfer() is called before delete depositInfo[depositId], allowing an attacker to reenter the contract and manipulate depositInfo before deletion.
POC
The attacker could call cancelFlow() repeatedly before state variables are updated, draining the vault.
Fund Theft: Attackers can withdraw more than they are entitled to.
Denial of Service: Reentrancy attacks could lock the contract and prevent legitimate withdrawals.
Manual Review
Use Reentrancy Guard (nonReentrant)
Apply Checks-Effects-Interactions Pattern
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.