Tokens without properties can be minted and cannot be rendered
Tokens could be minted before any properties were configured in the MetadataRenderer, and such tokens could never be rendered because getAttributes reverts. An attacker or careless deployer could create tokens stuck in an undefined state that buyers might purchase.
Submitted by Jeiwan, also found by imare, ladboy233, and rvierdiiev
It’s possible to mint tokens when properties haven’t yet been set in MetadataRenderer. Such tokens won’t be possible to render due to this check in the getAttributes function of MetaRenderer contract. There’s no way to fix such tokens after they were minted since the number of properties of each token is stored individually, thus a patched MetadataRenderer and a proxy contract need to be deployed.
Proof of Concept
Consider this test case:
function testRevert_MintedWithoutProperties() public {
// Deploying a token and a metadata renderer
address tknImpl = address(new Token(address(this)));
Token tkn = Token(address(new ERC1967Proxy(tknImpl, "")));
address rndrImpl = address(new MetadataRenderer(address(this)));
MetadataRenderer rndr = MetadataRenderer(address(new ERC1967Proxy(rndrImpl, "")));
bytes memory initString = abi.encode("Test", "Test", "Test", "Test", "Test");
IManager.FounderParams[] memory founders = new IManager.FounderParams[](1);
founders[0] = IManager.FounderParams({ wallet: address(this), ownershipPct: 1, vestExpiry: 4 weeks });
tkn.initialize(founders, initString, address(rndr), address(this));
rndr.initialize(initString, address(tkn), address(this), address(this));
// Exploit starts here:
// Properties haven't been added yet...
assertEq(rndr.propertiesCount(), 0);
// but minting is still possible.
tkn.mint();
assertEq(tkn.totalSupply(), 2); // 1 to the founder, 1 to the auction
// When trying to render a token without properties, there's a revert.
vm.expectRevert(abi.encodeWithSignature("TOKEN_NOT_MINTED(uint256)", 0));
rndr.getAttributes(0);
}
The call to getAttributes() reverts because the token’s attributes were not set since properties hadn’t been added to the metadata renderer.
Recommended Mitigation Steps
In the onMinted() function of MetadataRenderer, ensure that properties.length is greater than 0.
Alex the Entreprenerd (judge) commented:
I think a better solution is to have a default display or similar, but the finding is correct
iainnash (Nouns Builder) acknowledged and commented:
Duplicate of #459?
iainnash (Nouns Builder) commented:
Slightly different from the other ticket mentioned. Not sure if this is a medium risk bug or more of an inconvenience since the mint succeeds and the DAO can vote to upgrade the impl.
Alex the Entreprenerd (judge) commented:
In contrast to #459, which shows a way to achieve a revert, this report shows how to mint a token without any properties.
The question we are left to ask is whether a token without any property is a unique and “rarer” token, a mistake, a placeholder, or something else.
We could argue that the finding is informational in nature as the “lens” of the codebase, the MetadataRenderer is the only contract that will revert.
On the other hand, the lens will be reverting with a
TOKEN_NOT_MINTEDerror.Meaning that we can argue that while the token exists, the token is in a state that is not well defined.
Because upgrades are not in-scope we can only argue with the finding and the code in scope at this time.
Because the contract will not revert in minting one or more people may end up purchasing a token that is “in limbo”.
While a bit of a stretch, given the irrefutable POC, showing that this can happen by “forgetting to set properties”, I think Medium Severity to be appropriate.
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 minting path did not check that at least one property had been configured in the metadata renderer before allowing a token to be created.
Impact
Tokens could be minted in an undefined state that cannot be rendered, so a buyer could end up purchasing a token that is stuck in limbo; the judge rated this Medium.
What the attacker needed
Properties not yet configured; minting enabled
The fix
The onMinted function of MetadataRenderer should check that properties.length is greater than zero before allowing a mint.
How it was found
- Deploy the token and metadata renderer contracts and initialise them.
- Confirm the renderer reports zero properties.
- Mint a token anyway, which succeeds.
- Attempt to render the token's attributes, which reverts.
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.
A token is a digital collectible. Each token is supposed to have traits (properties) that describe how it looks. This report shows that the system allowed creating a token before any traits were set up, so the token exists but can never be displayed. Anyone buying it would get something that cannot be shown.
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.