code-423n4 / 2021-05-nftx-findings

1 stars 0 forks source link

Potential reentrancy in the `swapTo` function of `NFTXVaultUpgradeable` #113

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

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.

Referenced code: NFTXVaultUpgradeable.sol#L259-L289

Tools Used

None

Recommended Mitigation Steps

Move the nonReentrant modifier from swap to swapTo.

cemozerr commented 3 years ago

Duplicate of https://github.com/code-423n4/2021-05-nftx-findings/issues/93