The finalizeValidation
function of the LLMOracleCoordinator
contract, which is susceptible to a Denial of Service (DoS) attack through inflated validator scores. The vulnerability arises when a malicious actor submits exaggerated scores, resulting in the calculated standard deviation (_stddev
) exceeding the mean (_mean
). This anomalous situation can lead to arithmetic computation errors, potentially causing the transaction to revert and denying service.
The vulnerability is positioned within the finalizeValidation
function where the mean and standard deviation are computed for scores submitted by validators.
The computation of standard deviation and mean is sensitive to extreme deviations in score inputs. Inflated scores can result in the _stddev
value surpassing the _mean
, which breaks the logic using these calculations for determining validators' reward eligibility.
When _stddev
becomes greater than _mean
, range checks of scores for reward distribution (_mean ± _stddev
) lead to a logical incongruity, invoking arithmetic underflow, thus causing the entire transaction to fail.
The most immediate impact is a DoS condition.
POC
The POC demonstrates the vulnerability in the LLMOracleCoordinator
contract where a malicious validator inflates scores, leading to an arithmetic underflow and transaction revert.
Initialize Validators:
Four validators are set up with addresses and registered with the required fee tokens, preparing them for the validation process.
Score Configuration:
Validators are configured with two sets of scores:
Regular scores (55, 86, 99, 71) within an expected range of 1 to 100.
Inflated scores (100,000; 80,000; 90,000; 70,000) used by the malicious validator to attack.
Attack Execution:
The first validator submits inflated scores (scores2
) aiming to skew standard deviation calculations and induce an underflow.
Validation & Execution:
Validators mine nonces and submit validations. The malicious scores lead to abnormal variability, resulting in an underflow when calculating variance or standard deviation.
The test concludes with a revert due to arithmetic underflow, effectively demonstrating the potential for a Denial of Service (DoS) via manipulated score inputs.
Logs
Foundry
Implement strict input validation checks to ensure submitted scores fall within a realistic and acceptable range. This can prevent overly large or malicious scores from being processed.
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.