The withdrawPlatformFees function in the Swan protocol's smart contract allows the contract owner to transfer the entire balance of feeToken from the contract to their own address. This includes not only platform fees but also funds staked by oracles and any pending rewards. Even if the owner is trusted, this design poses significant risks such as accidental fund mismanagement or potential key compromise, which could lead to the draining of all funds intended for oracles and disrupt the protocol's operations.
Contract Involved:
LLMOracleRegistry (Assumed based on context)
Issue Description:
Unrestricted Withdrawal:
The withdrawPlatformFees function allows the contract owner to withdraw all feeToken held by the contract.
This includes funds allocated for oracle staking and pending rewards, not just platform fees.
Lack of Fund Segregation:
There is no mechanism to differentiate between platform fees and oracle funds within the contract.
This means that withdrawing platform fees inadvertently removes funds necessary for oracle operations.
Risk of Accidental Withdrawal:
Even with a trusted owner, human error could lead to accidental withdrawal of essential funds meant for oracles.
Potential Key Compromise:
If the owner's private key is compromised, an attacker could maliciously withdraw all funds from the contract.
Operational Disruption:
Oracle Payments Halted: Oracles rely on staked funds and pending rewards to operate. Draining these funds would prevent oracles from fulfilling their roles, disrupting the entire protocol.
Financial Loss:
Users Lose Staked Funds: Oracles and users who have staked tokens would lose access to their funds, leading to significant financial losses.
Reputational Damage:
Negative Perception: The protocol's reputation may suffer, affecting future collaborations, integrations, and user base growth.
manual review
Implement Proper Fund Segregation:
Separate Accounting for Platform Fees and Oracle Funds:
Introduce distinct state variables to track platform fees and oracle-related funds separately.
Benefits:
Protects Oracle Funds: Ensures that only platform fees are withdrawable by the owner, leaving oracle funds intact.
Prevents Accidental Withdrawals: Reduces the risk of accidentally draining funds meant for oracles.
Enhances Security: Limits the scope of withdrawals, minimizing potential damage from key compromises.
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.