Skip to content

Improper function behaviour in ERC721Enumerable #69

@code423n4

Description

@code423n4

Lines of code

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/base/ERC721Enumerable.sol#L54-L56

Vulnerability details

Impact

One of the view functions will revert instead of returning false.

Proof of Concept

In package.json, the following lines show which version of openzeppelin is being used:

    "@openzeppelin/contracts": "^4.1.0",
    "@openzeppelin/contracts-upgradeable": "^4.1.0",

The function supportsInterface() in ERC721Enumerable.sol calls OZ's ERC165 supportsInterface(), which has a known vulnerability that causes the function to revert instead of returning false due to an abi.decode behaviour introduced in solidity's version 0.8

More details in the links below:
https://security.snyk.io/vuln/SNYK-JS-OPENZEPPELINCONTRACTS-2958047
OpenZeppelin/openzeppelin-contracts#3552

Tools Used

Manual code reading

Recommended Mitigation Steps

Update OpenZeppelin to version 4.7.1 or more recent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 (Med Risk)Assets not at direct risk, but function/availability of the protocol could be impacted or leak valuebugSomething isn't workinginvalidThis doesn't seem rightsponsor disputedSponsor cannot duplicate the issue, or otherwise disagrees this is an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions