Skip to content
Business logic Audit finding Beginner

reduceERC721Fee function can not set fee when the NFT token ID is more than type(uint128).max

ak1 Follow

Originally disclosed on Sherlock

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

https://github.com/Harpieio/contracts/blob/97083d7ce8ae9d85e29a139b1e981464ff92b89e/contracts/Vault.sol#L148

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.

The original report as published on Sherlock, by ak1. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by ak1

View all

6 more disclosed reports, best first.

More from Harpie

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.