The ethRouter contract inherits ERC721TokenReceiver and can accept NFTs sent by users. However, if a user accidentally sends an NFT to the contract or airdrops an NFT to the contract, the administrator cannot rescue the NFT from the contract.
contract EthRouter is ERC721TokenReceiver {
......
......
}
Proof of Concept
Send nft directly to the contract
Tools Used
vscode
Recommended Mitigation Steps
Add a function similar to PrivatePool::withdraw to rescue NFTs sent to the contract.
Lines of code
https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L45
Vulnerability details
Impact
The ethRouter contract inherits ERC721TokenReceiver and can accept NFTs sent by users. However, if a user accidentally sends an NFT to the contract or airdrops an NFT to the contract, the administrator cannot rescue the NFT from the contract.
Proof of Concept
Send nft directly to the contract
Tools Used
vscode
Recommended Mitigation Steps
Add a function similar to
PrivatePool::withdraw
to rescue NFTs sent to the contract.