Dria

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

Withdrawal Function Can Prevent Oracles From Claiming Their Earned Fees

Vulnerability Details

The withdrawPlatformFees() function in LLMOracleCoordinator transfers all tokens from the contract to the owner:

LLMOracleCoordinator.sol#L374-L377

/// @notice Withdraw the platform fees & along with remaining fees within the contract.
function withdrawPlatformFees() public onlyOwner {
feeToken.transfer(owner(), feeToken.balanceOf(address(this)));
}

This is problematic because:

  1. The contract uses an allowance-based system for paying oracles in respond() and validate():

LLMOracleCoordinator.sol#L393-L398

/// Increases the allowance by setting the approval to the sum of the current allowance and the additional amount.
/// @param spender spender address
/// @param amount additional amount of allowance
function _increaseAllowance(address spender, uint256 amount) internal {
feeToken.approve(spender, feeToken.allowance(address(this), spender) + amount);
}
  1. Tokens aren't transferred immediately to oracles but rather their allowance is increased

  2. Oracles can claim their fees at any time after the allowance is set

  3. Different tasks are in different phases at any given time:

    • Some tasks are pending validation

    • Some tasks are completed but oracles haven't claimed fees yet

    • Some tasks are in progress

If withdrawPlatformFees() is called while oracles still have unclaimed allowances:

  1. All tokens are transferred to the owner

  2. When oracles try to claim their fees using their allowance, the transfers will fail due to insufficient balance

  3. There is no mechanism to track which tokens in the contract belong to platform fees vs unclaimed oracle fees

Impact

  • Oracles can lose their earned fees if owner withdraws before they claim

  • No way to determine a "safe" time to withdraw platform fees

  • Owner could accidentally drain funds meant for oracles

  • Breaks the core economic incentives of the protocol

  • Could lead to oracles abandoning the protocol due to payment uncertainty

Recommendations

  1. Track platform fees separately from oracle fees.

  2. Or switch to immediate transfers instead of allowances.

Updates

Lead Judging Commences

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

`withdrawPlatformFees` withdraws the entire balance

Support

FAQs

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