In the PerpetualVault.sol
contract, when a user deposits funds while the position is closed, any ETH sent as an execution fee will be permanently stuck in the contract. This happens because the deposit function is marked as payable
but fails to handle or refund the execution fee in this specific scenario.
Looking at the deposit
function when positionIsClosed
is true:
The issue arises because the function is payable
and can receive ETH as execution fee and when positionIsClosed
is true:
msg.value
(execution fee) is not stored in depositInfo
_payExecutionFee
is not called
_mint
is called with refundFee = false
No other mechanism exists to handle or refund the ETH
Users who send ETH as execution fee during deposit when position is closed will permanently lose their ETH. The ETH will be stuck in the contract with no mechanism to recover it. This could particularly impact users interacting through frontends that automatically include execution fees.
Manual code review
Add a check to prevent ETH being sent when position is closed:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.