The _runSwap
function decodes and uses a gPath
(swap path) from off-chain metadata without validation. A malicious keeper can craft a gPath
that routes swaps through untrusted or malicious pools/tokens, enabling fund theft or manipulation.
Unverified gPath
: The swap path (gPath
) is entirely controlled by the keeper and not validated by the contract.
Malicious Routing: A compromised keeper can route swaps through malicious or low-liquidity pools to:
Extract value via manipulated prices.
Drain funds via reentrancy or fake pools.
Keeper Submits Malicious gPath
:
gPath = [collateralToken, attackerToken, indexToken]
, where attackerToken
is a malicious ERC20.
Swap Execution:
The contract transfers collateralToken
to gmxProxy
, which routes through attackerToken
.
The attackerToken
contract drains funds during the swap (e.g., via a fake transferFrom
implementation).
Fund Theft: Malicious gPath
can siphon tokens from the contract.
Slippage Losses: Low-liquidity paths cause high slippage, reducing output.
Token Locking: Swaps involving non-whitelisted tokens disrupt vault operations.
Keeper Prepares Malicious Metadata:
Encodes gPath
with a malicious token (e.g., attackerToken
).
User Triggers run
Function:
The _runSwap
function decodes and executes the malicious gPath
.
Malicious Token Drains Funds:
The attackerToken
contract hijacks the swap, stealing collateralToken
.
gPath
On-ChainRestrict gPath
to trusted tokens (e.g., collateralToken
and indexToken
):
Hardcode allowed paths (e.g., direct swaps between collateralToken
and indexToken
):
Use a whitelist of approved pools/routers for GMX swaps:
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.