Dria

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

Memory Bomb Attack in LLM Oracle Response Validation

Relevant Context

The LLMOracleCoordinator contract manages responses from generators and validators in a decentralized LLM oracle system. Generators provide responses to tasks which are then validated by validators. The winning response (with highest validation score) is used by the BuyerAgent contract to make purchase decisions.

Finding Description

The respond() function in LLMOracleCoordinator allows generators to submit responses with unconstrained output size. This creates a vulnerability where a malicious generator can submit an extremely large response that must be processed by:

  1. The BuyerAgent contract when processing the winning response

The issue is compounded by the fact that a malicious actor can manipulate the validation scoring system (through other vulnerabilities) to ensure their oversized response becomes the winning one that must be processed by downstream consumers (BuyerAgent).

Impact Explanation

High. This vulnerability can:

  1. Make the BuyerAgent contract unusable if the winning response is too large to process

  2. Lead to excessive gas costs for contract interactions

Likelihood Explanation

Medium. While implementing this attack requires some sophistication in manipulating the validation scores, the core vulnerability (unbounded response size) is straightforward to exploit. The economic incentives also favor the attacker as they can profit from breaking the protocol's functionality.

Recommendation

Add size limits to the output parameter in the respond() function:

uint256 constant MAX_OUTPUT_SIZE = 32_768; // 32KB example limit
function respond(uint256 taskId, uint256 nonce, bytes calldata output, bytes calldata metadata)
public
onlyRegistered(LLMOracleKind.Generator)
onlyAtStatus(taskId, TaskStatus.PendingGeneration)
{
// Add maximum size check
if (output.length > MAX_OUTPUT_SIZE) {
revert OutputTooLarge(output.length, MAX_OUTPUT_SIZE);
}
// ... rest of existing function ...
}
error OutputTooLarge(uint256 size, uint256 maxSize);

The MAX_OUTPUT_SIZE should be carefully chosen based on:

  • Gas limits for validators processing the output

  • Reasonable size limits for LLM responses

  • Maximum size that buyer agents can process efficiently

Consider also making this limit configurable by the owner.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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