Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xSpearmint1 - Incorrect Use of init Constraint in ReinitOApp Instruction #147

Open
sherlock-admin4 opened this issue Oct 27, 2024 · 0 comments
Labels
Sponsor Disputed The sponsor disputed this issue's validity

Comments

@sherlock-admin4
Copy link
Contributor

sherlock-admin4 commented Oct 27, 2024

0xSpearmint1

Medium

Incorrect Use of init Constraint in ReinitOApp Instruction

Summary

The ReinitOApp instruction improperly uses the init constraint on the oapp_config account, which leads to an error when attempting to reinitialize an account that already exists. The correct behavior must involve modifying the existing account using the mut constraint, rather than attempting to reinitialize it.

Root Cause

The init constraint is used on the oapp_config account in the ReinitOApp instruction. This constraint is meant for account creation and causes an error when attempting to reinitialize an existing account. In reinitialization cases, the mut constraint should be used instead.

Internal pre-conditions

The ReinitOApp instruction must be explicitly called to update the existing oapp_config account.

External pre-conditions

No response

Attack Path

  1. The ReinitOApp instruction incorrectly uses the init constraint on the existing oapp_config account.
  2. Since the account already exists, the program throws an error because the init constraint attempts to create the account again.

Impact

This issue causes a failure in the ReinitOApp instruction, preventing updates to critical fields such as admin and usdc_hash in the oapp_config account.

PoC

No response

Mitigation

Replace the init constraint in the ReinitOApp instruction with the mut constraint to allow the existing oapp_config account to be modified without attempting to recreate it. This will ensure that reinitialization occurs as intended without causing errors.

@sherlock-admin3 sherlock-admin3 added the Sponsor Disputed The sponsor disputed this issue's validity label Nov 3, 2024
@sherlock-admin4 sherlock-admin4 changed the title Tangy Peanut Lizard - Incorrect Use of init Constraint in ReinitOApp Instruction 0xSpearmint1 - Incorrect Use of init Constraint in ReinitOApp Instruction Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsor Disputed The sponsor disputed this issue's validity
Projects
None yet
Development

No branches or pull requests

2 participants