Closed code423n4 closed 1 year ago
OpenCoreCH marked the issue as disagree with severity
By design. If we would only allow one registration, we would need to permission the registration to the owner (as frontrunning could then be a huge problem), see #185 for some thoughts on why we do not do this.
berndartmueller changed the severity to QA (Quality Assurance)
berndartmueller marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2023-01-canto-identity/blob/main/src/SubprotocolRegistry.sol#L79-L101
Vulnerability details
The
SubprotocolRegistry
contract allows subprotocol owners to register their subprotocol NFT under a name.Despite frontrunning issues described in the contest, the same subprotocol NFT can be registered again under a different name, as there is no check to verify if a subprotocol NFT has been already registed.
Impact
A bad actor can re-register an already registered subprotocol NFT. Even though this requires the registered name to be different, it is possible to register the same subprotocol NFT contract to trick others into thinking this is the proper registration for the subprotocol.
The
register
function present in theSubprotocolRegistry
doesn't check that the_nftAddress
has been previously registered as a subprotocol, and allows for a bad actor to register a subprotocol under the same_nftAddress
as previously registered subprotocol.https://github.com/code-423n4/2023-01-canto-identity/blob/main/src/SubprotocolRegistry.sol#L79-L101
PoC
In the following test, an attacker registers an already registered subprotocol created by Alice.
Recommendation
Keep track of registered subprotocol NFTs and check if it was already registered during the call to
register
: