Inconsistency in migratetokenmanager in terms of the permitted caller
The interface documentation for the token manager migration function says only the default admin role may call it, but the contract implementation actually restricts the call to a separate migrator role. This mismatch could lead developers or auditors to make incorrect assumptions about who holds access to that function.
Vechain | Stargate Hayabusa
Originally disclosed on Immunefi
59411 sc insight inconsistency in migratetokenmanager in terms of the permitted caller
- Submitted on: Nov 12th 2025 at 05:41:45 UTC by @Oxodus for Audit Comp | Vechain | Stargate Hayabusa
- Report ID: #59411
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/tree/main/packages/contracts/contracts/StargateNFT/StargateNFT.sol
Description
Brief / Intro
There is an inconsistency between the NatSpec in IStargateNFT and the StargateNFT implementation regarding who is allowed to call the migrateTokenManager function.
IStargateNFTstates that "this function is only callable by the DEFAULT_ADMIN_ROLE".- The implementation in
StargateNFTinstead restricts the call toTOKEN_MANAGER_MIGRATOR_ROLE:
function migrateTokenManager(
uint256 _tokenId,
address _manager
) external onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE) {
...
}
This mismatch between interface documentation and contract implementation can lead to confusion or incorrect assumptions about access control.
References
- Implementation: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/main/packages/contracts/contracts/StargateNFT/StargateNFT.sol#L660
- Interface NatSpec: https://github.com/immunefi-team/audit-comp-vechain-stargate-hayabusa/blob/main/packages/contracts/contracts/interfaces/IStargateNFT.sol#L467
Proof of Concept
No additional PoC provided.
Context
This report concerns the Stargate Hayabusa contracts, specifically the StargateNFT contract and its interface. The target named in the report is the StargateNFT.sol file in the packages/contracts/contracts/StargateNFT/ directory of the audit competition repository.
The feature in question is migrateTokenManager, whose implementation is gated on TOKEN_MANAGER_MIGRATOR_ROLE. The report is an insight about access control documentation rather than an exploitable vulnerability: the NatSpec in the interface and the modifier in the implementation disagree about who may call the function.
Setup
The report does not describe any accounts, roles, tooling or versions used to reach the finding. It is a source review of two files:
- The implementation,
StargateNFT.sol. - The interface,
IStargateNFT.sol.
The relevant roles are DEFAULT_ADMIN_ROLE, named in the interface documentation, and TOKEN_MANAGER_MIGRATOR_ROLE, used by the implementation.
Finding it
The researcher compared the NatSpec comment on migrateTokenManager in IStargateNFT with the function body in StargateNFT. The interface states that the function is only callable by DEFAULT_ADMIN_ROLE. The implementation instead gates the call on TOKEN_MANAGER_MIGRATOR_ROLE:
function migrateTokenManager(
uint256 _tokenId,
address _manager
) external onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE) {
...
}
The two statements describe different callers, which the report says can lead to confusion or incorrect assumptions about access control. The report points to the implementation at line 660 of StargateNFT.sol and the interface NatSpec at line 467 of IStargateNFT.sol as the two places to compare.
Exploitation
The report provides no proof of concept and describes no exploitation steps. The finding is that the mismatch between interface documentation and contract implementation can lead to confusion or incorrect assumptions about access control. The report says the mismatch can lead to confusion or incorrect assumptions about access control.
Root cause
The access control check in the implementation uses onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE), while the interface NatSpec documents DEFAULT_ADMIN_ROLE as the permitted caller. The report does not say which of the two is intended, so the root cause is a documentation and implementation inconsistency rather than a demonstrated bypass. The existing role check does restrict the call; the problem is that the documented restriction does not match the enforced one.
Impact
The report frames the impact as confusion or incorrect assumptions about access control. It does not claim that an unauthorised party can call the function, nor does it describe any loss of funds or state corruption.
Fix
Variants to test
- Compare every NatSpec
@devor@noticeline that names a role against the modifier actually used in the function body. A positive result is a documented role that differs from the enforced role. - Check inherited or overridden functions where the interface comment may have been copied from a base contract. A positive result is an override whose access modifier diverges from the interface it implements.
- Look at administrative functions such as migrations, upgrades and ownership transfers, where role names are easy to mix up. A positive result is a function whose documentation and modifier disagree.
Hunting notes
This kind of issue hides in the gap between interface documentation and implementation, particularly around role-gated administrative functions. During review, the signal is a NatSpec comment that names a specific role while the function body uses a different onlyRole modifier.
What happened, in plain words
A security researcher looked at two files in a set of smart contracts called Stargate Hayabusa. One file is the actual working code, the other is a description of that code meant for other programmers. The description said one thing about who is allowed to use a particular function, and the working code said something different. The researcher wrote this up as an "insight": a note that something is inconsistent, not a claim that anyone can steal money or break the system.
To follow the rest of this article you only need to know a few ideas, and each one is explained where it first appears.
Context
What a smart contract is
A smart contract is a small program that lives on a blockchain. A blockchain is a shared record book that many computers keep copies of, so once something is written there it is very hard to change or delete. Because the program runs on that shared record book, anyone can read its code and anyone can send it instructions. People often compare a smart contract to a vending machine: you put something in, it follows fixed rules, and it gives something back. Nobody stands behind the machine to make exceptions.
What StargateNFT is
StargateNFT is one of the contracts in this project. "NFT" stands for non-fungible token, which is a way of recording on a blockchain that a particular thing belongs to a particular owner. You can think of it like a numbered ticket or a deed: each one is unique and has an owner. The contract is the program that keeps track of those tickets, who owns them, and who is allowed to change the records.
What an interface is
In programming, an interface is a file that lists the functions a contract offers, together with comments describing what each one does, but without the actual working code inside. It is like the menu outside a restaurant: it tells you what dishes exist and what is in them, but it does not show you the kitchen. Other programs read the interface to learn how to talk to the contract.
What NatSpec is
NatSpec is a convention in the Solidity programming language (the language these contracts are written in) for writing documentation comments directly above a function. The word is short for "natural language specification". Tools can read these comments and turn them into documentation pages. When a comment says something like "this function is only callable by the admin", that is NatSpec.
What a role is
Many contracts use a system of roles to decide who may do what. A role is simply a named permission, like a badge in an office building. Holding the "admin" badge lets you into the server room; holding the "cleaner" badge lets you into the cleaning cupboard. In code, a function can be marked so that only holders of a particular badge can run it. The report mentions two badges:
DEFAULT_ADMIN_ROLE, the general administrator badge.TOKEN_MANAGER_MIGRATOR_ROLE, a badge specifically for whoever is allowed to migrate a token manager.
What the feature does
The function at the centre of the report is called migrateTokenManager. "Migrate" means to move something from one place to another, and a "manager" here is the address (a kind of account identifier on the blockchain) that manages a token. The function is gated on TOKEN_MANAGER_MIGRATOR_ROLE in the implementation.
What the target is
The report names the file StargateNFT.sol, located in the packages/contracts/contracts/StargateNFT/ directory of the audit competition repository. A repository is a shared folder of code, and an audit competition is an event where many people are invited to look through code and report problems.
What kind of finding this is
The report is an insight about access control documentation rather than an exploitable vulnerability. "Access control" means the rules about who is allowed to do what. "Exploitable" means that an attacker could actually use the problem to do something harmful. Here, the researcher is not saying an attacker can do anything; the researcher is saying that two pieces of text disagree about who is allowed to call the function.
Setup
The report does not describe any accounts, roles, tooling or versions used to reach the finding. No special software, no test network, no scripts. It is a source review, meaning the researcher read the code with their own eyes. Two files were compared:
- The implementation,
StargateNFT.sol. This is the working code, the kitchen. - The interface,
IStargateNFT.sol. This is the menu, the description of the functions.
The two roles involved are DEFAULT_ADMIN_ROLE, named in the interface documentation, and TOKEN_MANAGER_MIGRATOR_ROLE, used by the implementation.
Finding it
The researcher compared the NatSpec comment on migrateTokenManager in IStargateNFT with the function body in StargateNFT. The interface states that the function is only callable by DEFAULT_ADMIN_ROLE. The implementation instead gates the call on TOKEN_MANAGER_MIGRATOR_ROLE:
function migrateTokenManager(
uint256 _tokenId,
address _manager
) external onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE) {
...
}
Line by line, in plain words:
function migrateTokenManager(starts the definition of a function namedmigrateTokenManager. Everything between the brackets that follow is the list of inputs the function accepts.uint256 _tokenId,is the first input: a number called_tokenId.uint256means a whole number that cannot be negative, and here it identifies which token is being dealt with, like a ticket number.address _manageris the second input: an address called_manager. An address is the identifier of an account on the blockchain, so this is the new manager being assigned.) external onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE) {closes the input list and adds two things.externalmeans the function can be called from outside the contract.onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE)is a guard: before the function body runs, the contract checks that whoever is calling holds theTOKEN_MANAGER_MIGRATOR_ROLEbadge. If they do not, the call is refused.}closes the function.
The two statements describe different callers, which the report says can lead to confusion or incorrect assumptions about access control. The report points to the implementation at line 660 of StargateNFT.sol and the interface NatSpec at line 467 of IStargateNFT.sol as the two places to compare. A line number is just a position in the file, so anyone can open the same file and jump straight to the spot.
Exploitation
The report provides no proof of concept and describes no exploitation steps. A proof of concept is a small demonstration, such as a script or a set of steps, that shows a problem actually happening. Here there is none; the report provides no proof of concept.
The finding is that the mismatch between interface documentation and contract implementation can lead to confusion or incorrect assumptions about access control. The report says the mismatch can lead to confusion or incorrect assumptions about access control. "Deployed" means the contract has been put on the blockchain and is live.
Root cause
The access control check in the implementation uses onlyRole(TOKEN_MANAGER_MIGRATOR_ROLE), while the interface NatSpec documents DEFAULT_ADMIN_ROLE as the permitted caller. A bypass would mean someone getting past the guard without the right badge; that is not what happened here. The existing role check does restrict the call; the problem is that the documented restriction does not match the enforced one.
A simple comparison: a building's public notice says only the building manager may open the storage room, but the lock is actually programmed to accept the caretaker's key. The room is still locked to everyone else, so nothing is broken. But anyone who reads the notice and plans around it will be wrong about who to ask.
Impact
The report frames the impact as confusion or incorrect assumptions about access control. It does not claim that an unauthorised party can call the function, nor does it describe any loss of funds or state corruption. "State" here means the stored data inside the contract, such as who owns which token.
An integrator is another team building software that talks to this contract. An auditor is someone paid to check the code for problems. An operator is someone running the system day to day.
Fix
A modifier is the small guard attached to a function, like onlyRole(...) in the code above.
Variants to test
These are suggestions for other researchers looking for the same kind of mistake elsewhere. Each one describes what to compare and what a hit looks like.
- Compare every NatSpec
@devor@noticeline that names a role against the modifier actually used in the function body.@devand@noticeare tags used inside NatSpec comments to mark developer notes and user-facing notes. A positive result is a documented role that differs from the enforced role. - Check inherited or overridden functions where the interface comment may have been copied from a base contract. Inheritance means one contract building on another, and an override is a function that replaces an inherited one. A positive result is an override whose access modifier diverges from the interface it implements.
- Look at administrative functions such as migrations, upgrades and ownership transfers, where role names are easy to mix up. A positive result is a function whose documentation and modifier disagree.
Hunting notes
This kind of issue hides in the gap between interface documentation and implementation, particularly around role-gated administrative functions. "Role-gated" means the function only opens for holders of a particular badge. During review, the signal is a NatSpec comment that names a specific role while the function body uses a different onlyRole modifier.
Glossary
- Access control: the rules that decide who is allowed to do what in a system.
- Address: an identifier for an account on a blockchain, used to send and receive things.
- Audit competition: an event where many people are invited to review code and report problems.
- Blockchain: a shared record book kept in copies by many computers, hard to change once written.
- Bypass: getting past a security check without meeting its conditions.
- Contract: see smart contract.
DEFAULT_ADMIN_ROLE: the general administrator role named in the interface documentation.- Deployed: put live on the blockchain.
- Exploitable: able to be used by an attacker to cause harm.
- External: a function that can be called from outside the contract.
- Implementation: the working code of a contract, as opposed to its description.
- Inheritance: when one contract is built on top of another and reuses its functions.
- Insight: a report category for a note or observation rather than a demonstrated attack.
- Integrator: another team building software that interacts with the contract.
- Interface: a file listing a contract's functions and their descriptions, without the working code.
- Modifier: a small guard attached to a function that runs before the function body.
- NatSpec: the convention for writing documentation comments above Solidity functions.
- NFT (non-fungible token): a blockchain record of a unique item and its owner.
onlyRole(...): a modifier that refuses the call unless the caller holds the named role.- Operator: someone running the system day to day.
- Override: a function that replaces an inherited one.
- Proof of concept: a small demonstration showing a problem actually happening.
- Repository: a shared folder of code, usually with version history.
- Role: a named permission, like a badge that allows certain actions.
- Role-gated: a function that only opens for holders of a particular role.
- Smart contract: a program stored and run on a blockchain, following fixed rules.
- Solidity: the programming language used to write these contracts.
- State: the stored data inside a contract, such as ownership records.
TOKEN_MANAGER_MIGRATOR_ROLE: the role the implementation actually requires formigrateTokenManager.uint256: a whole number type in Solidity that cannot be negative.