NFTManager will break NFT metadata for users as tokenURI() will revert
The NFTManager contract's metadata generation functions call AssetLib.getAsset, which reads from the wrong storage context (the NFTManager's own storage instead of the diamond's), causing asset.owner to always be address(0). As a result, tokenURI() reverts, preventing wallets, explorers, and marketplaces from displaying the NFTs.
Source: https://github.com/sherlock-audit/2025-09-ammplify-judging/issues/94
Found by
0xAsen, 8olidity, JeRRy0422, OxNoble, Sa1ntRobi, axelot, befree3x, drdee, fullstop, glitch-Hunter, jayjoshix, kimnoic, soloking, thimthor, veerendravamshi, vivekd, vtim
Summary
The use of AssetLib.getAsset inside NFTManager._generateMetadata/_generateSVG will cause a revert for users requesting NFT metadata, as NFTManager will read diamond storage directly and always see asset.owner == address(0).
Root Cause
In NFTManager.sol:_generateMetadata, the call to AssetLib.getAsset(assetId) reads from Store.assets() (diamond storage). Since the call originates from NFTManager, it resolves against the ERC721’s own storage instead of the diamond’s, making every asset appear unset.
Internal Pre-conditions
-
A user must have minted a position through NFTManager.mintNewMaker.
-
The user (or marketplace) calls NFTManager.tokenURI(tokenId) to query metadata.
External Pre-conditions
None.
Attack Path
-
User calls NFTManager.mintNewMaker → NFT minted successfully, mappings updated.
-
Any party calls NFTManager.tokenURI(tokenId) → _generateMetadata calls AssetLib.getAsset(assetId).
-
AssetLib resolves Store.assets() against NFTManager storage, not the diamond.
-
asset.owner == address(0) → require fails → transaction reverts.
Impact
The users cannot retrieve NFT metadata. As a result, wallets, explorers, and marketplaces cannot display Ammplify NFTs, effectively breaking NFT usability. This makes minted NFTs indistinguishable and practically unusable in external integrations.
PoC
No response
Mitigation
Refactor _generateMetadata and _generateSVG to avoid AssetLib. Fetch asset data through the IView facet (getAssetInfo and getPoolInfo) as already done in positions().
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/itos-finance/Ammplify/pull/36
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 call to AssetLib.getAsset reads from diamond storage using the NFTManager's own storage context instead of the diamond's, so the asset appears unset.
Impact
Users cannot retrieve NFT metadata, so wallets, explorers, and marketplaces cannot display the NFTs, making them practically unusable in external integrations.
What the attacker needed
A user has minted a position via NFTManager.mintNewMaker
The fix
The protocol team fixed this issue by refactoring _generateMetadata and _generateSVG to fetch asset data through the IView facet instead of using AssetLib.
How it was found
- User calls NFTManager.mintNewMaker to mint an NFT.
- Any party calls NFTManager.tokenURI(tokenId) to query metadata.
- _generateMetadata calls AssetLib.getAsset(assetId).
- AssetLib resolves Store.assets() against NFTManager storage, not the diamond.
- asset.owner == address(0) causes a require to fail and the transaction reverts.
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.
This is a smart contract bug where a function that creates NFT metadata looks up data in the wrong place. Because it checks the wrong storage, it always thinks the NFT has no owner and stops with an error. So when someone tries to view the NFT's details, the request fails.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.