The MultiHopOracle contract contains a fundamental architectural weakness in its oracle path validation system. The contract's constructor accepts and implements any sequence of oracle configurations without performing essential validation checks:
The architectural flaw lies in the contract's assumption of path validity during deployment. The constructor's implementation blindly accepts oracle configurations without verifying the logical connection between consecutive price feeds. This creates a system where oracle paths can be deployed with broken price relationships, unconnected token pairs, or circular references that invalidate the entire price computation chain.
In QuantAMM's TFMM architecture, this vulnerability becomes particularly problematic as it permits the deployment of fundamentally broken price discovery mechanisms. Once deployed, these invalid oracle paths become permanent fixtures in the system, as the contract offers no post-deployment correction capabilities. The immutable nature of these configurations means that any logical inconsistencies, token mismatches, or circular dependencies become permanently embedded in the protocol's price discovery mechanism.
The severity of this issue extends beyond deployment mistakes. Invalid oracle paths can pass basic testing scenarios but fail in complex market conditions or specific edge cases. When such failures occur, they affect not just individual transactions but potentially compromise all pools and strategies relying on the corrupted price feed path. The requirement to redeploy and migrate affected components creates significant operational risks and potential disruptions to the protocol's functionality.
Consider this scenario:
Alice is a protocol deployer at QuantAMM wanting to set up a new ETH/USDT price feed
Direct price feeds aren't available, so Alice plans to use ETH -> WBTC -> USDT path
During deployment setup, Alice accidentally misconfigures the second hop:
First hop correctly set as ETH/WBTC
Second hop mistakenly set as BNB/USDT instead of WBTC/USDT
The deployment proceeds successfully as the contract lacks path validation
The protocol accepts this oracle for ETH/USDT pricing
Later, Bob, a liquidity provider:
Deposits funds into a pool using this oracle
The pool tries to calculate optimal weights using the broken price feed
Receives incorrect share calculations due to meaningless price derivations
The issue is only discovered after multiple users experience unexpected losses
Due to the immutable design, the entire oracle must be redeployed and all dependent pools must migrate
Implement comprehensive path validation in constructor:
Add path visualization helper:
Add deployment script validations:
These mitigations would:
Prevent deployment of invalid oracle paths
Ensure token pair compatibility
Provide tools for path verification
Make deployments more reliable and secure
The validation should be implemented in both the contract and deployment scripts for maximum security.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood 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.