The register function in LLMOracleRegistry.sol allows users to register with an invalid LLMOracleKind type, potentially leading to unintended registrations. Because LLMOracleKind is defined as an enum, any arbitrary integer can be cast to LLMOracleKind, allowing a user to bypass the expected validation. This may cause the registry to emit incorrect event types, incorrectly process fees, and mislabel users within the system.
The register function uses the LLMOracleKind enum to allow a user to register as either a Generator or a Validator:
However, the function does not validate that the input kind is restricted to these specific enum values. Because kind is not checked against valid enum values, a user can input arbitrary values, causing the registration to proceed with an invalid kind and misleading event emissions. This oversight could lead to users mistakenly being registered with incorrect roles and paying unintended fees.
By exploiting this vulnerability, users can:
Register with an undefined or unexpected kind, leading to inconsistencies in user roles within the registry.
Potentially pay incorrect fees or bypass the correct validation checks associated with the expected Generator or Validator roles.
Cause confusion or misuse in the system as events emit incorrect registration types.
Add a check at the start of the function to ensure that kind is a valid LLMOracleKind enum value (either Generator or Validator). This can be done by verifying that the kind is either 0 or 1, preventing any unintended kind values from being processed.
Suggested fix:
By validating the kind input, we prevent users from registering with invalid types, preserving the integrity of the registration process and ensuring that only legitimate Generator or Validator roles are registered.
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.