Missing Update of migration_token_allocation on Global Struct
The `migration_token_allocation` field in the `Global` struct is not updated by the `update_settings` function, so any new value provided through `GlobalSettingsInput` is ignored. As a result, the allocation remains at its default value, which could disrupt the migration process.
Submitted by D1r3Wolf, also found by 0x_kmr_ and Spearmint
During the audit, it was identified that the migration_token_allocation variable on the Global struct is not updated in the Global::update_settings function. This creates a critical issue as the migration_token_allocation value, which is used during the migration process in the create_pool instruction, will remain uninitialized or stuck at its default value indefinitely.
The update_settings function is executed within the set_params instruction, making it a central mechanism for modifying key global settings. However, due to the missing update logic for migration_token_allocation, any updates intended for this variable via GlobalSettingsInput are ignored. As a result, the migration_token_allocation on the Global struct is never updated, leading to a persistent and incorrect value that could disrupt the migration process.
Proof of Concept
Notes: Execute the test case in src/state/bonding_curve/tests.rs
#[test]
fn test_global_update_settings() {
use crate::GlobalSettingsInput;
let mut global = Global::default();
let new_mint_decimals = 8;
let new_migration_token_allocation = 123_000_000;
let mut params = GlobalSettingsInput {
initial_virtual_token_reserves: 0,
initial_virtual_sol_reserves: 0,
initial_real_token_reserves: 0,
token_total_supply: 0,
mint_decimals: new_mint_decimals,
migrate_fee_amount: 0,
migration_token_allocation: new_migration_token_allocation,
fee_receiver: Pubkey::default(),
whitelist_enabled: false,
meteora_config: Pubkey::default(),
};
global.update_settings(params, 0);
assert_eq!(global.mint_decimals, new_mint_decimals); // Passes
assert_eq!(global.migration_token_allocation, new_migration_token_allocation); // Fails as the variables not updated
}
Impact:
The migration_token_allocation will retain its default value indefinitely, regardless of any intended updates.
Recommended mitigation steps
To resolve this issue, we recommend the following steps:
-
Implement the logic to update
migration_token_allocationin theGlobal::update_settingsfunction.- This should retrieve the value from the
GlobalSettingsInputparameter provided to theupdate_settingsfunction.
- This should retrieve the value from the
-
Test and Validate the Fix:
- Ensure unit tests are added to confirm the successful update of Global struct with the values from the
GlobalSettingsInput.
- Ensure unit tests are added to confirm the successful update of Global struct with the values from the
Kulture (Pump Science) confirmed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the `update_settings` function omits the assignment of `migration_token_allocation` from the input parameters.
Impact
The migration_token_allocation will retain its default value indefinitely, regardless of any intended updates, which could disrupt the migration process.
What the attacker needed
Admin access to call set_params
The fix
The update_settings function should be modified to assign migration_token_allocation from the GlobalSettingsInput parameter, and unit tests should be added to confirm the update.
How it was found
- Create a default Global struct.
- Prepare a GlobalSettingsInput with a new migration_token_allocation value.
- Call global.update_settings with the input.
- Check that migration_token_allocation equals the new value; it does not.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A program stores important settings in a global structure. One setting, the amount of tokens reserved for migration, is supposed to be changeable by an admin. However, the function that changes settings forgets to update this particular field, so it always stays at its original default value. This means the admin cannot set the correct amount, which might cause problems when tokens are migrated later.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.