Inconsistent swap handling in the PerpetualVault
it lacks uniformity in how swaps (e.g., DEX swaps or GMX swaps) are managed and validated. This inconsistency can lead to failed swaps, incorrect state updates, or loss of funds. The contract interacts with external protocols like Paraswap (DEX) and GMX for swaps, but the handling of these swaps is not always robust or consistent.
_doDexSwap
FunctionIf outputAmount
is zero, the contract may mint shares for zero token
A user may receive shares for a deposit that was not actually processed.
If the contract mints shares for zero tokens, an attacker could exploit this to drain funds.
Manual Code Review
Ensure the output amount meets the expected minimum before proceeding with state updates.
Use require
to handle swap failures consistently.
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.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.