The deposit function in PerpetualVault contract is marked as payable and accepts ETH, but lacks proper ETH handling logic. This allows users to send excess ETH beyond the required execution fee, which becomes permanently locked in the contract , while there is no rescue function for it .
The deposit function accepts ETH payments for execution fees but does not validate whether the sent ETH amount matches the required execution fee especially when position is closed . Any excess ETH sent with the transaction becomes trapped in the contract with no withdrawal mechanism.
Impact
Users who accidentally send more ETH than the required execution fee will permanently lose access to their excess ETH, as there is no mechanism to recover these funds.
Here is the relevant fuzz test in foundry that could be added to file PerpetualVault.t.sol :
And here is the log output from it :
[PASS] testFuzz_Deposit_ExcessETH(uint96) (runs: 258, μ: 486078, ~: 486220)
Tools Used
Manual
Add msg.value related validation to condition branch of function Deposit when positionIsClosed is true , or implement function withdrawEth just like in contract GmxProxy .
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.