The vault can be drained
The owner-only stakeNxm function does not verify that the vault owns the requested NFT token ID, so an admin can approve the vault for an NFT they still own and have vault funds staked to that NFT. The admin can then withdraw the stake, taking assets funded by the vault.
Source: https://github.com/sherlock-audit/2025-11-stnxm-by-easedefi-judging/issues/127
Found by
0xeix, Tricko, asui, oxwhite, typicalHuman
Summary
The funds of vault can be drained by admin
Root Cause
stakeNxm is onlyOwner function and there is no validation of requested TokenId
Internal Pre-conditions
.
External Pre-conditions
.
Attack Path
stakeNxm()is owner-only but calls _stakeNxm from the vault contract, so inside depositTo() the msg.sender is address(this).depositTo()only checks thatmsg.sender (the vault)is owner or approved forrequestTokenId, and that the token belongs to the target pool.- An admin can keep ownership of an NFT (say tokenId 105), call
stakingNFT.approve(address(vault), 105), then invokestakeNxm(amount, pool, tranche, 105). - The vault unwraps its wNXM and stakes it, but the stake shares are credited to tokenId
105, which is still owned by the admin. - When the admin later uses Nexus’ withdraw on tokenId
105, they receive the stake that was funded entirely by vault assets. - The vault, meanwhile, thinks it gained a staked position (it adds
tokenIdToPool[105]and counts the tranche intokenIdToTranches[105]), sostakedNxm()andtotalAssets()are inflated with assets the vault does not actually control.
The Readme states:
Are there any limitations on values set by admins (or other roles) in the codebase, including restrictions on array lengths?
Owner (NOT proxy owner) should generally not be able to do anything that would allow them to steal from the vault.
Impact
- Loss of funds
- Incorrect accounting
- Potential insolvency
PoC
No response
Mitigation
I think the vault's ownership of requested tokenId should be checked .
Require stakingNFT.ownerOf(_requestTokenId) == address(this) before calling depositTo().
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/EaseDeFi/stNXM-Contracts/commit/beea701e46d16e9b68bbe61bf75efba406191895
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 stakeNxm function lacks a check that the vault owns the requested token ID before depositing into it.
Impact
The vault could lose funds, its accounting becomes incorrect, and it may become insolvent.
What the attacker needed
Admin/owner role of the vault
The fix
The vault should check that it owns the requested token ID before calling depositTo; the protocol team fixed this issue.
How it was found
- The admin keeps ownership of an NFT and approves the vault to use it.
- The admin calls stakeNxm with that token ID.
- The vault stakes its own funds but credits the stake to the admin's NFT.
- The admin withdraws the stake through the NFT and receives the vault's assets.
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 vault is a shared pot of money managed by code. The person who runs the vault could tell it to put money into a receipt that they personally own, then cash that receipt in and keep the money. The code never checked that the receipt belonged to the vault rather than to the admin.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.