Skip to content
Business logic Audit finding Intermediate

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.

d1r3wolf Follow with 0x_kmr_ and Spearmint

Originally disclosed on Code4rena

Submitted by D1r3Wolf, also found by 0x_kmr_ and Spearmint

https://github.com/code-423n4/2025-01-pump-science/blob/768ef58478724bf6b464c9f0952e3e5a3b2a2613/programs/pump-science/src/state/global.rs#L119-L132

https://github.com/code-423n4/2025-01-pump-science/blob/768ef58478724bf6b464c9f0952e3e5a3b2a2613/programs/pump-science/src/state/global.rs#L66

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:

  1. Implement the logic to update migration_token_allocation in the Global::update_settings function.

    • This should retrieve the value from the GlobalSettingsInput parameter provided to the update_settings function.
  2. Test and Validate the Fix:

    • Ensure unit tests are added to confirm the successful update of Global struct with the values from the GlobalSettingsInput.

Kulture (Pump Science) confirmed


The original report as published on Code4rena, by D1r3Wolf. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

  1. Create a default Global struct.
  2. Prepare a GlobalSettingsInput with a new migration_token_allocation value.
  3. Call global.update_settings with the input.
  4. 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.

More by d1r3wolf

View all

2 more disclosed reports, best first.

More from Pump Science

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.