reduceERC721Fee function can not set fee when the NFT token ID is more than type(uint128).max
Source: https://github.com/sherlock-audit/2022-09-harpie-judging/tree/main/081-M
Found by
ak1
Summary
reduceERC721Fee function can not set fee when the NFT token ID is more than type(uint128).max
Vulnerability Detail
The NFT token ID can be any value within uint 256.
As the reduceERC721Fee takes the _id argument as uint 128, when the reduceERC721Fee function is called with an NFT id that has above type(uint128).max , the fee can not set to the expected NFT id.
Impact
High : RC721Fee can not set fee when the NFT token ID value is more than type(uint128).max
Code Snippet
Tool used
Manual Review
Recommendation
Change the function argument for reduceERC721Fee as shown below.
before fix : function reduceERC721Fee(address _originalAddress, address _erc721Address, uint128 _id, uint128 _reduceBy) external returns (uint128)
after fix: function reduceERC721Fee(address _originalAddress, address _erc721Address, uint256 _id, uint128 _reduceBy) external returns (uint128)
Lead Senior Watson
Good find! ERC721 standard doesn't enforce how tokenId is implemented for a given NFT. Could definitely be greater than uint128, although I've never seen a case where this is true.
Harpie Team
Changed to uint256. Fix here.
Lead Senior Watson
Confirmed fix.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Harpie. Sherlock made it public on 18 September 2022. Found in the 3 audit contest (finding M-8).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.