Platform: Code4rena
Start Date: 31/01/2023
Pot Size: $36,500 CANTO
Total HM: 5
Participants: 38
Period: 3 days
Judge: berndartmueller
Total Solo HM: 2
Id: 212
League: ETH
Rank: 17/38
Findings: 1
Award: $108.60
🌟 Selected for report: 0
🚀 Solo Findings: 0
360.4223 CANTO - $108.60
The inability of AddressRegistry.sol#getCID() to return a valid value makes the AddressRegistry functionality meaningless. Other contracts that use the cid protocol will get the wrong data, which may produce various abnormal situations and may even lead to loss of funds.
Function AddressRegistry.sol#register requires the msg.sender
to be the owner of the cid NFT.
function register(uint256 _cidNFTID) external { if (ERC721(cidNFT).ownerOf(_cidNFTID) != msg.sender) // We only guarantee that a CID NFT is owned by the user at the time of registration // ownerOf reverts if non-existing ID is provided revert NFTNotOwnedByUser(_cidNFTID, msg.sender); cidNFTs[msg.sender] = _cidNFTID; emit CIDNFTAdded(msg.sender, _cidNFTID); }
Function AddressRegistry.sol#getCID() simply returns the state written during registration, which will be invalid if the nft's owner changes after registration.
function getCID(address _user) external view returns (uint256 cidNFTID) { cidNFTID = cidNFTs[_user]; }
Manual
I recommend checking the owner of the cid NFT in getCID. If the user is no longer the owner of the cid NFT, return 0.
#0 - berndartmueller
2023-02-09T12:54:40Z
Intended behavior:
Transferring CID NFTs that are still referenced in the address registry: CID NFTs are transferrable on purpose and a user can transfer his CID NFT while it is still registered to his address if he wants to do so.
See https://github.com/code-423n4/2023-01-canto-identity#automated-findings--publicly-known-issues.
Leaving the submission open for the sponsor review, but I'm inclined to invalidate the finding.
#1 - c4-sponsor
2023-02-10T18:21:50Z
OpenCoreCH marked the issue as sponsor disputed
#2 - c4-judge
2023-02-16T18:39:44Z
berndartmueller marked the issue as unsatisfactory: Invalid
#3 - c4-judge
2023-03-07T21:35:22Z
berndartmueller marked the issue as satisfactory
#4 - c4-judge
2023-03-07T21:35:34Z
berndartmueller marked the issue as duplicate of #177