The ParaSwap integration in the ParaSwapUtils library hardcodes the expected ParaSwap contract address (0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57). If ParaSwap upgrades their contract or if the hardcoded address is ever compromised, this validation check becomes outdated, potentially allowing integration with an unintended (and possibly malicious) contract.
Issue:
The library’s _validateCallData
function enforces that the target address to
must exactly equal the hardcoded ParaSwap address.
Context:
Relying on a hardcoded address prevents dynamic upgrades or migration if ParaSwap releases a new version. This reduces flexibility and could lead to integration issues or security risks if the external service is compromised.
Inter‑Contract Considerations:
No other part of the system mitigates this risk. A configurable or registry-based approach is absent from this library.
Integration Failure:
An upgraded or replaced ParaSwap contract will not pass the validation, causing legitimate swaps to fail.
Security Risk:
If the hardcoded ParaSwap address is compromised, attackers could exploit this fixed check to redirect swaps to a malicious contract.
Reduced Flexibility:
The system cannot adapt to changes in the external protocol without redeploying updated contracts.
This PoC demonstrates that the hardcoded check in _validateCallData
forces the integration to use a fixed address. Changing the expected ParaSwap address in the call data (simulating an upgrade or compromise) will cause the swap function to revert.
Attacker: Not applicable directly this PoC demonstrates a misconfiguration scenario.
Legitimate User: Attempts to perform a swap.
Protocol: ParaSwapUtils library enforcing the hardcoded check.
Legitimate Scenario:
When testValidSwap()
is called, the swap function receives the correct hardcoded address, passes the validation, and executes normally.
Failure Scenario:
When testInvalidSwap()
is called, the swap function receives a different address (simulating an upgrade or compromise), triggering the require statement and reverting the transaction.
Manual Code Review
Configurable Address:
Replace the hardcoded ParaSwap address with a state variable that can be updated via governance or owner control.
Registry-Based Lookup:
Integrate a registry mechanism where the valid ParaSwap address can be managed and updated dynamically.
Defensive Checks:
Ensure that any update mechanism for the ParaSwap address is secure and audited.
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. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."
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. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."
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.