https://github.com/CodeHawks-Contests/2025-02-gamma/blob/main/contracts/GmxProxy.sol#L123-L147
The contract relies on a single oracle for price data, introducing a centralization risk. If the oracle provides manipulated or incorrect data, users may experience unfair liquidations, arbitrage exploits, or inaccurate pricing calculations.
This contract fetches price data from a single oracle without implementing redundancy, validation, or price sanity checks. The lack of oracle diversity creates a single point of failure, violating decentralization principles. If the oracle is compromised, malfunctioning, or manipulated by a privileged entity, the entire pricing mechanism of the protocol becomes unreliable.
This breaks core security guarantees:
Trust Assumptions: A decentralized system should not rely on a single data provider.
Fair Liquidations: Manipulated prices can lead to forced liquidations of users' positions.
Manipulation Resistance: The lack of price aggregation makes it easy for an attacker to exploit price discrepancies.
An attacker gains control over the oracle (via governance control, admin privileges, or external market manipulation).
The attacker reports incorrect prices, artificially inflating or deflating asset values.
This results in incorrect trade executions, forced liquidations, or risk-free arbitrage opportunities.
Users lose funds due to manipulated price feeds, while the attacker profits from the exploit.
Severity: High
If the oracle is manipulated, an attacker can liquidate positions, withdraw excess funds, or influence asset pricing, leading to significant financial loss.
The system has no fallback mechanism if the oracle fails, making this a major security flaw in a DeFi protocol.
Likelihood: Medium
If the oracle is a trusted provider like Chainlink, the likelihood is lower but still present due to potential oracle failures, delays, or off-chain manipulation.
If the oracle is controlled by the project team or a centralized entity, the likelihood increases significantly.
An attacker could target oracle vulnerabilities (e.g., flash loans, governance attacks, or data manipulation) to exploit the contract.
To simulate this attack, a malicious oracle can be created to return manipulated prices:
The contract retrieves the manipulated price from MaliciousOracle
.
This incorrect price triggers forced liquidations or incorrect trade settlements.
The attacker profits by liquidating positions at artificial prices.
To mitigate this issue, the following solutions should be implemented:
Use Multiple Oracles: Fetch prices from multiple sources (e.g., Chainlink, Pyth, Tellor) and aggregate them.
Implement Price Sanity Checks: Ensure price deviations stay within a reasonable threshold before accepting new values.
Introduce a Fallback Mechanism: If the primary oracle fails, use a backup source for price data.
Impact: High (Funds at risk, potential protocol-wide exploitation)
Likelihood: Medium (Depends on oracle security, but attack scenarios exist)
Overall Severity: High
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.