Submitted by d3e4
https://github.com/code-423n4/2023-03-canto-identity/blob/077372297fc419ea7688ab62cc3fd4e8f4e24e66/canto-pfp-protocol/src/ProfilePicture.sol#L59
https://github.com/code-423n4/2023-03-canto-identity/blob/077372297fc419ea7688ab62cc3fd4e8f4e24e66/canto-pfp-protocol/src/ProfilePicture.sol#L99
Besides having to re-register the protocol, it will also have to be redeployed.
A protocol is registered by name in the SubprotocolRegistry. Quoting the Canto Identity Protocol contest details:
However, the ProfilePicture subprotocol suffers from the additional issue of also having to be redeployed, making this exploit more severe.
In ProfilePicture, subprotocolName is set on construction.
subprotocolName is used to retrieve the cidNFTID to which the subprotocols NFT is added.
This means that this subprotocol must be registered under this name, or it will not work. So if ProfilePicture is deployed but someone else manages to register it in the SubprotocolRegistry before the owner (recipient of fees) of ProfilePicture (by frontrunning or otherwise), it cannot simply be re-registered under a different name, but would have to be redeployed with a new name under which it then can be registered.
Since the subprotocol is meant to be registered with the CID protocol, its deployment and registration should be atomic. Or the name can be initialized after deployment and registration, and set by a (temporary) owner to the name it then has been registered with.
OpenCoreCH (Canto Identity) acknowledged and commented:
