Dria

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

Initialization can be front-run leading to unauthorized contract ownership

Description

The initialize() function in the LLMOracleRegistry contract is vulnerable to front-running attacks. Since this is an upgradeable contract using the UUPS pattern, the initialize() function is critical as it sets up the initial contract state including the contract owner who has privileged access to upgrade the contract implementation.

The current implementation allows any address to call initialize() first and become the owner of the contract. While the deployment process likely intends to call this function immediately after deployment, there is a small window where an attacker monitoring the mempool could front-run the legitimate initialization transaction.

If successful, the attacker would gain ownership of the contract and therefore have the ability to:

  1. Call setStakeAmounts() to manipulate required stake amounts

  2. Call _authorizeUpgrade() to upgrade the contract implementation to a malicious version

  3. Effectively take control of all staked tokens

This is particularly concerning given that this contract handles user stakes in ERC20 tokens and serves as a registry for LLM oracles.

Recommendation

To prevent front-running of the initialization, ensure the initialization is done in the same transaction as the proxy deployment using a deployment framework like OpenZeppelin Hardhat Upgrades that handles this automatically.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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