Closed c4-submissions closed 1 year ago
GalloDaSballo changed the severity to QA (Quality Assurance)
Wholeheartedly disagree, safeMint is unsafe and introduces undesirable novel attack vectors. Onus is on the user to specify correct receiver addresses
0xfoobar (sponsor) disputed
Siding with the Sponsor on this one
GalloDaSballo marked the issue as grade-c
Hi @GalloDaSballo
This is not an invalid, rather it should be a valid medium, Some users can implement transfers function in the onERC721Recieved()
of their contracts, however this never gets triggered and the Principal Token is lost.
SafeMint cannot trigger any unsafe novel attacks in this case by examining the function the mint is the last call done in create after all checks and updates has been done,
https://github.com/code-423n4/2023-09-delegate/blob/a6dbac8068760ee4fc5bababb57e3fe79e5eeb2e/src/DelegateToken.sol#L320-L322
No, it is not a medium, it is invalid. We explicitly designed to not use safeMint. safeMint is more unsafe and more gas-expensive.
Lines of code
https://github.com/code-423n4/2023-09-delegate/blob/a6dbac8068760ee4fc5bababb57e3fe79e5eeb2e/src/PrincipalToken.sol#L32-L37
Vulnerability details
Impact
The principal token contract mints an nft to a user when a
Delegate.create()
is called.From the StorageHelpers.mintPrincipal, we see that the mint function is called passing in the address without checks. This address could be a contract which is unequipped to handle the token being minted to it;
Proof of Concept
As seen above
_mint()
is used instead of_safemint()
which would ensure the tokens are not lost forever in a contract.Tools Used
Manual Review
Recommended Mitigation Steps
Use
_safemint()
instead of_mint()
to mint the nft to the userAssessed type
ERC721