Misconfigured Level With maturityBlocks = 0 Allows Skip of Maturity Requirements and Backrun Minting
The addLevel function in the Levels library does not validate the maturityBlocks parameter, so a level operator could accidentally create a level with zero maturity blocks. A user who notices this could immediately mint an NFT at that level and delegate it without waiting for the maturity period, gaining an unintended economic advantage.
- Disclosed after under an hour
60289 sc low misconfigured level with maturityblocks 0 allows skip of maturity requirements and backrun minting
Submitted on Nov 21st 2025 at 01:29:33 UTC by @MoZi for Audit Comp | Vechain | Stargate Hayabusa
- Report ID: #60289
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/tree/main/packages/contracts/contracts/StargateNFT/libraries/Levels.sol
- Impacts:
- Unintended economic advantage
Description
Brief/Intro
The protocol Levels::addLevel function allows the LEVEL_OPERATOR_ROLE to introduce new NFT levels. However, the function does not validate the _levelAndSupply.level.maturityBlocks input paramater, allowing a new level to be added with maturityBlocks = 0.
Vulnerability Details
Inside Levels::addLevel, the function validates only:
_levelAndSupply.level.namelength_levelAndSupply.level.vetAmountRequiredToStakeinput_levelAndSupply.circulatingSupply_levelAndSupply.cap
But no validation is applied to:
_levelAndSupply.level.maturityBlocks_levelAndSupply.level.scaledRewardFactor
The currentStargate and StargateNFT contract does not implement the Levels::updateLevel from libraries to prevent when this scenario occur. It allowing user to backrun and mint the misconfigured level before protocol pause and upgrade the contract to implement function Levels::updateLevel. The updated level is only applies to the next minting and NFTs that have already been minted will not be affected.
This creates an unintended economic advantage for any user who immediately backruns the level addition and mints the NFT.
Impact Details
when LEVEL_OPERATOR_ROLE unintentionally sets maturityBlocks = 0, users can:
- Immediately stake to mint the NFT
- Receive an NFT that is already considered matured
- Delegate instantly without waiting or paying boost
and if the added level is a level that has a high scaledRewardFactor then the user who immediately backruns and mints the NFT will get a huge advantage.
References
Proof of Concept
Proof of Concept
Step-by-step explanations:
LEVEL_OPERATOR_ROLEcallStargateNFT::addLeveland mistakenly sets maturityBlocks = 0.- A user monitoring mempool detects the misconfiguration.
- User backruns or immediately call
Stargate::stake(levelId)to mint the NFT. - Minted NFT is exempt from the maturity requirement.
- User instantly call
Stargate::delegate(TokenId)without waiting. - The protocol cannot fix the misconfigured NFT Level without: pausing the contract, deploying upgrade , adding a new function for
updateLevel.
Even though the misconfigured NFT level has been updated, the ones that have been minted will not change.
it("Misconfigured Level With maturityBlocks = 0 Allows Permanent Skip of Maturity Requirements and Backrun Minting", async () => {
// 1. `LEVEL_OPERATOR_ROLE` call `StargateNFT::addLevel` and mistakenly sets maturityBlocks = 0.
const Level = {
name: "NOMAD",
isX: false,
id: 11,
maturityBlocks: 0,
scaledRewardFactor: 2,
vetAmountRequiredToStake: ethers.parseEther("2")
}
tx = await stargateNFTMockContract.connect(deployer).helper__setLevel(Level);
await tx.wait();
const LevelInfo = await stargateNFTMockContract.getLevel(11);
console.log("Name: ", LevelInfo.name);
console.log("Maturity blocks: ", LevelInfo.maturityBlocks);
console.log("Scaled reward factor: ", LevelInfo.scaledRewardFactor);
console.log("Stake amount required: ", LevelInfo.vetAmountRequiredToStake);
console.log("");
// 2. A user monitoring mempool detects the misconfiguration.
// 3. User backruns or immediately call `Stargate::stake(levelId)` to mint the NFT.
const levelSpec = await stargateNFTMockContract.getLevel(11);
tx = await stargateContract.connect(user).stake(11, {
value: levelSpec.vetAmountRequiredToStake
});
await tx.wait();
const TokenId = await stargateNFTMockContract.getCurrentTokenId();
const Token = {
tokenId: TokenId,
levelId: 11,
mintedAtBlock: 0,
vetAmountStaked: ethers.parseEther("2"),
lastVetGeneratedVthoClaimTimestamp_deprecated: 0
}
await stargateNFTMockContract.helper__setToken(Token);
const TokenInfo = await stargateNFTMockContract.getToken(TokenId);
console.log("tokenId: ", TokenInfo.tokenId);
console.log("levelId: ", TokenInfo.levelId);
// 4. Minted NFT is exempt from the maturity requirement.
// 5. User instantly call `Stargate::delegate(TokenId)` without waiting.
tx = await stargateContract.connect(user).delegate(TokenId, validator.address);
await tx.wait();
tx = await protocolStakerMockContract.helper__setValidationCompletedPeriods(
validator.address,
10
);
await tx.wait();
// assert the delegation is active
expect(await stargateContract.getDelegationStatus(TokenId)).to.equal(
DELEGATION_STATUS_ACTIVE
);
await tx.wait();
await protocolStakerMockContract.helper__setDelegationIsLocked(1, true);
const Delegation = await stargateContract.getDelegationDetails(TokenId);
console.log("Delegation Id: ", Delegation.delegationId);
console.log("Validator: ", Delegation.validator);
console.log("Delegated Stake: ", Delegation.stake);
console.log("Probability Multiplier: ", Delegation.probabilityMultiplier);
console.log("Start Period: ", Delegation.startPeriod);
console.log("End Period: ", Delegation.endPeriod);
console.log("is Locked ?: ", Delegation.isLocked);
console.log("Delegation status: ", Delegation.status);
// 6. The protocol cannot fix the misconfigured NFT Level without:
// pausing the contract, deploying upgrade , adding a new function for `updateLevel`.
});
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 lacks input validation for maturityBlocks, and there is no updateLevel function to correct a misconfigured level after creation.
Impact
A user could mint an already-matured NFT and delegate instantly without waiting or paying a boost, gaining an unintended economic advantage, especially if the level has a high scaledRewardFactor; the protocol cannot fix already-minted NFTs without pausing and upgrading.
What the attacker needed
Level operator sets maturityBlocks to 0; attacker monitors mempool; attacker can backrun the transaction
The fix
The addLevel function should validate maturityBlocks (and scaledRewardFactor), and an updateLevel function should be added to correct misconfigured levels.
How it was found
- The level operator calls addLevel and mistakenly sets maturityBlocks to 0.
- A user monitoring the mempool detects the misconfiguration.
- The user backruns or immediately calls stake with the new level ID to mint the NFT.
- The minted NFT is exempt from the maturity requirement.
- The user immediately calls delegate on the token ID without waiting.
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.
Some NFTs require a waiting period (maturity) before they can be used for certain actions like delegation. If a level is created with a maturity of zero blocks, that waiting period disappears. A user who spots this mistake quickly can mint the NFT and use it straight away, which may give them an unfair advantage over others.
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.