No mechanism to set boostpriceperblock for levels added after initialization
New NFT levels added after deployment via addLevel() never get a boostPricePerBlock value, because that value is only set during initialisation. As a result, users could use the boost feature on those levels for free.
- Disclosed after under an hour
60593 sc low no mechanism to set boostpriceperblock for levels added after initialization
Submitted on Nov 24th 2025 at 08:42:24 UTC by @Brainiac5 for Audit Comp | Vechain | Stargate Hayabusa
- Report ID: #60593
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/tree/main/packages/contracts/contracts/StargateNFT/StargateNFT.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Location:
StargateNFT.sol
Function: addLevel()
Description:
When new NFT levels are added using the addLevel() function, there is no mechanism to set the boostPricePerBlock value for these levels. The boostPricePerBlock is only set for levels added during contract initialization (via initializeV3). As a result, any level added after deployment will have an unset boost price.
Relevant Code Snippet:
function addLevel(
DataTypes.LevelAndSupply memory _levelAndSupply
) public onlyRole(LEVEL_OPERATOR_ROLE) {
Levels.addLevel(_getStargateNFTStorage(), _levelAndSupply);
}
Impact:
- Users can use the boost feature for levels added after contract initialization for free.
Suggested Fix:
- Add a function to set or update
boostPricePerBlockfor any level, not just those initialized ininitializeV3. - Alternatively, extend
addLevel()to accept aboostPricePerBlockparameter and set it during level addition.
function addLevel(
DataTypes.LevelAndSupply memory _levelAndSupply
+ uint256 boostPricePerBlock
) public onlyRole(LEVEL_OPERATOR_ROLE) {
+ DataTypes.StargateNFTStorage storage $ = _getStargateNFTStorage();
- Levels.addLevel(_getStargateNFTStorage(), _levelAndSupply);
+ Levels.addLevel($, _levelAndSupply);
+ Levels.updateLevelBoostPricePerBlock($, $.MAX_LEVEL_ID, boostPricePerBlock);
}
Proof of Concept
Proof of Concept
Add the unit test below to
/test/unit/StargateNFT/Levels.test.ts
it.only("should be able to add level, but not boostPricePerBlock", async () => {
const levelOperator = otherAccounts[2];
const grantTx = await stargateNFTContract.grantRole(
await stargateNFTContract.LEVEL_OPERATOR_ROLE(),
levelOperator.address
);
await grantTx.wait();
const currentLevelIds = await stargateNFTContract.getLevelIds();
const newLevelAndSupply = {
level: {
id: 25, // This id does not matter since it will be replaced by the real one
name: "My New Level",
isX: false,
vetAmountRequiredToStake: ethers.parseEther("1000000"),
scaledRewardFactor: 150,
maturityBlocks: 30,
},
cap: 872,
circulatingSupply: 0,
};
const expectedLevelId = currentLevelIds[currentLevelIds.length - 1] + 1n;
// Add new level
const addLevelTx = await stargateNFTContract
.connect(levelOperator)
.addLevel(newLevelAndSupply);
await addLevelTx.wait();
const boostPricePerBlock = await stargateNFTContract.boostPricePerBlock(expectedLevelId);
expect(boostPricePerBlock).to.equal(0);
});
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 addLevel() function only stores the level data and never sets the boost price, which is only written during initialisation.
Impact
Users could use the boost feature for levels added after initialisation for free, so the contract fails to deliver the promised returns.
What the attacker needed
Level operator role; a level added after initialisation
The fix
The addLevel() function should be extended to accept a boostPricePerBlock parameter and set it when the level is added, or a separate setter should be provided.
How it was found
- Grant the level operator role to an account.
- Call addLevel() with a new level definition.
- Read boostPricePerBlock for the new level id and observe it is zero.
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 smart contract stores a price per block for a paid 'boost' feature. That price is only filled in for levels created at setup time. If an operator later adds a new level, the price stays at zero, so the boost becomes free for that level.
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.