- Full-access keys have complete control over the account, including the ability to transfer NEAR tokens
- Function-call keys are requested by third-party apps to sign transactions on behalf of the user. They can only call methods on a specific contract and cannot transfer NEAR tokens.
The vulnerable pattern
Consider an NFT contract that checks that the caller owns the token, but does not require one yoctoNEAR:Rust: vulnerable flow
How the issue happens
- A user gives a website a function-call
- The website calls
nft_transfer, sending the NFT to its own account without opening the user’s wallet predecessor_account_idis still the user’s account, so the ownership check passes- The contract transfers the NFT even though the user did not confirm this particular transfer
The safe pattern
Make the method payable and require exactly one yoctoNEAR before transferring the NFT:Rust: safe flow