The possibility to set validation requirements to zero, together with permissionless and instant oracle registrations, allows malicious users to instantly collect Oracle fees.
In the LLMOracleManager
, it is possible to set minimumParameters.numValidations
to zero: https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleManager.sol#L130, the same possibility exists in SwanManager
: https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/SwanManager.sol#L90. This opens room for an admin error when these parameters are set to zero instructing Swan protocol to create tasks with zero validation requirements via oracleStateRequest
and oraclePurchaseRequest
:
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L179
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L194
It’s worth noting that oracle registrations are permissionless and instant, allowing attackers to exploit this by registering oracles solely to collect fees. This is possible because, when numValidations
is set to zero, the protocol immediately awards oracle fees:
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleCoordinator.sol#L234
prerequisite: LLMOracleManager.minimumParameters.numValidations set to 0
prerequisite: SwanManager.oracleParameters.numValidations set to 0
User submits oracle task.
Attacker registers account #1 as a generator oracle.
Attacker submits the result to respond
method.
Since numValidations
is zero, the protocol immediately grants a fee to the oracle.
Attacker deregisters account #1, collects fees, and repeats steps 2 - 4 as many times as needed using different accounts.
Anyone can register an oracle and steal fees. The probability is low since this attack is possible only when numValidations
is set to zero.
Manual review
Imlement oracles whitelist, or delays for new oracle activation. Alternatively, disallow the possibility of setting zero validation.
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.