There is no re-register or re-assign function
The smart contract registration system lacks a way to re-register or re-assign a contract if its associated NFT is burned or transferred. This could cause contracts to lose fee distributions and gas fees.
Originally disclosed on Code4rena
Submitted by sorrynotsorry
Impact
There is no re-register or re-assign option for the smart contracts.
Let’s assume a smart contract is registered either through the register() function with a new NFT minted or the assign() function to an existing NFT.
However, if somehow, the NFT is burned by the owner or transferred to another owner either by an approval or compromised tx, there is no option to re-register for these contracts which create gas fees but might not get a fee distribution in return.
And if the NFT is burned or transferred to another owner, the smart contracts will lose the fees generated if not previously withdrawn.
Proof of Concept
register function;
function register(address _recipient) public onlyUnregistered returns (uint256 tokenId) {
address smartContract = msg.sender;
if (_recipient == address(0)) revert InvalidRecipient();
tokenId = _tokenIdTracker.current();
_mint(_recipient, tokenId);
_tokenIdTracker.increment();
emit Register(smartContract, _recipient, tokenId);
feeRecipient[smartContract] = NftData({
tokenId: tokenId,
registered: true
});
}
assign function;
function assign(uint256 _tokenId) public onlyUnregistered returns (uint256) {
address smartContract = msg.sender;
if (!_exists(_tokenId)) revert InvalidTokenId();
emit Assign(smartContract, _tokenId);
feeRecipient[smartContract] = NftData({
tokenId: _tokenId,
registered: true
});
return _tokenId;
}
Recommended Mitigation Steps
The team might consider adding an option to validate historical registrations and re-register those contracts accordingly.
tkkwon1998 (Canto) acknowledged and commented:
Currently there is no way to re-assign or re-register. This is a known limitation, and will be made extremely clear to all devs registering their contracts.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the registration functions only allow unregistered contracts and provide no mechanism to update the NFT association after loss or transfer.
Impact
Contracts may permanently lose fee distributions and waste gas fees if their NFT is burned or transferred.
What the attacker needed
NFT is burned or transferred
The fix
The team should add a function to validate historical registrations and allow re-registration or re-assignment.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Smart contracts can register to receive fees by linking to an NFT. If that NFT is destroyed or given away, the contract cannot register again, so it stops earning fees.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.