When oapp is reset, the ownership of oapp_config_account is set to the solana system program and the data storage is set to zero. When that happens, it is not possible to reinit the oapp_config_account because no one controls the account anymore and the reinitialization doesn't provide storage space back to oapp_config.
Root Cause
In reset_oapp.rs, ownership is transferred to the system_program and data storage size is set to zero:
In reinit_oapp.apply, there is no expansion of storage space and the oapp is already initialized so it cannot be created again and the ownership is orphaned
Droll Cider Armadillo
Medium
reinit_oapp will not work after resetting oapp
Summary
When oapp is reset, the ownership of
oapp_config_account
is set to the solana system program and the data storage is set to zero. When that happens, it is not possible to reinit theoapp_config_account
because no one controls the account anymore and the reinitialization doesn't provide storage space back tooapp_config
.Root Cause
In reset_oapp.rs, ownership is transferred to the system_program and data storage size is set to zero:
In reinit_oapp.apply, there is no expansion of storage space and the oapp is already initialized so it cannot be created again and the ownership is orphaned
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
oapp_config
account cannot be reinitialized.PoC
No response
Mitigation
Don't
assign
theoapp_config
account to the system program. Simply setting the storage size to zero is a good measure.When reinitializing, call
realloc
withspace = 8 + OAppConfig::INIT_SPACE,
again.