Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Valid

Malicious Validators Can Manipulate The Results

Summary
The LLMOracleCoordinator.sol contract's validation system is vulnerable to manipulation through multiple account control by a single actor. Due to the lack of a slashing mechanism and permissionless registration, an actor can register multiple validator accounts to manipulate response scoring, allowing them to unfairly earn generator and validator fees while preventing legitimate participants from receiving rewards.

Vulnerability Details
Here's an example scenario demonstrating the vulnerability:

Let's assume the following fee structure in the protocol for this example-

Generator fee per response: 100 tokens

Validator fee per validation: 50 tokens

A malicious actor can exploit the system as follows-
1) The malicious actor registers 6 different accounts by using the function register https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleRegistry.sol#L94
- 1 generator account
- 5 Validator accounts
2) Now lets assume a request comes in requiring
- 3 responses
- 5 validations
3) Response submission:

Response 1: Malicious actor's generator submits response using the function respond https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleCoordinator.sol#L207

Response 2: Legitimate generator response

Response 3: Legitimate generator response

4) Coordinated scoring by malicious actor's validators accounts -
The malicious actor now uses the function validateto manipulate the scores

Validator1 scores: [95, 30, 30] // [malicious response, legitimate1, legitimate2]
Validator2 scores: [90, 35, 35]
Validator3 scores: [93, 32, 32]
Validator4 scores: [94, 31, 31]
Validator5 scores: [92, 33, 33]

5) Statistical outcome: For malicious actor's response:

Statistical outcome:
For malicious actors response:
Mean = (95 + 90 + 93 + 94 + 92) / 5 = 92.8
Standard deviation ≈ 1.9
Valid range: [90.9 to 94.7]
Result: All controlled validators fall within range
For legitimate responses:
Mean = 32.2
Standard deviation ≈ 1.9
Valid range: [30.3 to 34.1]
Result: Legitimate responses receive 0 tokens

This makes the malicious actor earn -
100 tokens (generator fee)

250 tokens (5 validators × 50 tokens)

Legitimate generators receive no compensation

Protocol's reward mechanism is now completely manipulated

Impact
- Legitimate generators and validators receive no compensation
- Can be repeated indefinitely
- Validators cannot be removed as there is no slashing mechanism
- Malicious Actors can accumulate fees indefinitely
- As there is no slashing mechanism and the stake can be claimed back anytime through the function unregister https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleRegistry.sol#L117
this malicious attacker is never at risk as there stake will be given back to them without any consequences
- Quality of oracle responses deteriorates

Tools Used
Manual Analysis

Recommendations
Implement Slashing
Lock stake for minimum time period
Implement reputation system
Use weighted scoring based on validator history

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Unbounded score values in `validate` function

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.