agents/skills/injectable/nft-protocol-security/SKILL.md
Protocol Type Trigger nft (detected when ERC721/ERC1155 with marketplace, minting, staking, or collateral logic found) - Inject Into Breadth agents, depth-token-flow, depth-edge...
npx skillsauth add plamentsv/plamen nft-protocol-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Protocol Type Trigger:
nft(detected when ERC721/ERC1155 with marketplace, minting, staking, or collateral logic found) Inject Into: Breadth agents, depth-token-flow, depth-edge-case Language: EVM only (Solana/Move NFT models use different mechanisms without callbacks or enumeration) Finding prefix:[NFT-N]
When decomposing this skill into depth agent investigation questions, map sections to domains:
Recon detects NFT protocol patterns: ERC721/ERC1155 with state-modifying logic beyond simple transfer (marketplace listing, staking, collateral, minting with conditions, royalty enforcement, batch operations).
Pure ERC721/ERC1155 token implementations without protocol logic do NOT trigger this skill.
For each function that triggers NFT callbacks:
Enumerate all code paths that invoke _safeMint, _safeTransfer, safeTransferFrom, or onERC1155Received/onERC1155BatchReceived:
| # | Function | Callback Triggered | State Modified BEFORE Callback | State Modified AFTER Callback | Reentrancy Guard? | |---|----------|-------------------|-------------------------------|------------------------------|-------------------|
For each entry:
_safeMint(to, tokenId) → onERC721Received callback → recipient reverts if assigned token has undesirable properties → retry until desired properties assigned.For contracts implementing ERC1155:
onERC1155Received implemented for single transfers?onERC1155BatchReceived implemented for batch transfers?safeBatchTransferFrom will revert, blocking batch settlement/distribution.Tag: [TRACE:_safeMint → onERC721Received callback → state_before={list} → reentrant_path={YES/NO}]
For each approval mechanism:
approve(address, tokenId): per-token approval. Is approval cleared on transfer?setApprovalForAll(address, bool): blanket approval. Can an approved operator transfer ANY token?For each transfer function:
setApprovalForAll from users → contract can transfer any user's NFTs → compromise of contract = compromise of all approved NFTs.If royalties are enforced:
transferFrom vs marketplace executeSale)Tag: [TRACE:transfer_path={function} → auth_check={method} → royalty_enforced={YES/NO}]
For contracts using ERC721Enumerable or custom enumeration:
_ownedTokens, _allTokens, index mappings)_beforeTokenTransfer (OZ v4) or _update (OZ v5) without calling super → index structures become stale.tokenOfOwnerByIndex still return correct values? Is totalSupply decremented?For batch mint/burn/transfer:
Tag: [BOUNDARY:burn_last_token → _ownedTokens[owner].length={0} → tokenOfOwnerByIndex={result}]
If tokenURI or uri returns dynamic content:
uri(uint256 id) return a template with literal {id} placeholder per spec? Or a fully resolved URL? (clients expect to substitute the zero-padded hex ID client-side)If tokens have properties assigned at mint time (rarity, type, attributes):
When tokens are deposited into protocol custody (staking, collateral, escrow):
ownerOf(tokenId) return the protocol address or the depositor?Tag: [TRACE:mint → property_assignment={method} → randomness_source={source} → manipulable={YES/NO}]
_safeMint/_safeTransfer: is critical state updated BEFORE the callback?uri() follow the spec for the token standard used?ownerOf?_safeMint within nonReentrant modifier → callback reentrancy blockedERC721Enumerable or ERC1155 without overriding internal hooks → indices maintained by parent| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1. Callback Reentrancy Surface | IF safe mint/transfer used | | Callback inventory, batch completeness | | 2. Approval and Transfer Paths | YES | | Authorization, scope, royalty bypass | | 3. Enumeration and Index Integrity | IF enumerable | | Index consistency across operations | | 4. Metadata and State Consistency | YES | | URI spec, property assignment, custody |
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline