The swapTo function in the NFTXVaultUpgradeable contract should use the modifier nonReentrant to prevent reentrancy, which could happen when a user receives an NFT and calls the swapTo function again in the onERC721Received or onERC1155Received functions he implemented.
Proof of Concept
Both the mintTo, redeemTo includes a nonReentrant modifier to prevent reentrancy, while the function swapTo does not. Currently, the modifier is applied in the swap function instead of swapTo.
Handle
shw
Vulnerability details
Impact
The
swapTo
function in theNFTXVaultUpgradeable
contract should use the modifiernonReentrant
to prevent reentrancy, which could happen when a user receives an NFT and calls theswapTo
function again in theonERC721Received
oronERC1155Received
functions he implemented.Proof of Concept
Both the
mintTo
,redeemTo
includes anonReentrant
modifier to prevent reentrancy, while the functionswapTo
does not. Currently, the modifier is applied in theswap
function instead ofswapTo
.Referenced code: NFTXVaultUpgradeable.sol#L259-L289
Tools Used
None
Recommended Mitigation Steps
Move the
nonReentrant
modifier fromswap
toswapTo
.