Closed code423n4 closed 2 years ago
The risk is low for Nouns DAO since our Auction House is already deployed and initialized. However we do agree it's good to upgrade the open zeppelin library version and plan to do so.
Not exploitable given the current state of the contract.
Lines of code
https://github.com/code-423n4/2022-08-nounsdao/blob/main/package.json#L32-L33 https://github.com/code-423n4/2022-08-nounsdao/blob/main/contracts/NounsAuctionHouse.sol#L62-L82
Vulnerability details
Impact
Currently,
@openzeppelin/contracts
and@openzeppelin/contracts-upgradeable
versions are set as follows.https://github.com/code-423n4/2022-08-nounsdao/blob/main/package.json#L32-L33
For the specified version, there are some critical and high vulnerabilities as shown in https://snyk.io/test/npm/@openzeppelin/contracts/4.1.0. One of these vulnerabilities deals with the
initializer
modifier in which https://security.snyk.io/vuln/SNYK-JS-OPENZEPPELINCONTRACTS-2320176 mentions that "it is possible forinitializer()
protected functions to be executed twice, if this happens in the same transaction".The
initializer
modifier is currently used in theNounsAuctionHouse
contract. AlthoughNounsAuctionHouse
is not in the scope of this contest, because of the nature of high vulnerability, this finding is issued so the protocol can be aware of this risk. Moreover, since the Openzeppelin contracts are used in multiple places, the protocol should review these vulnerabilities carefully so these risks can be avoided when using a feature from these contracts in the future.Proof of Concept
Because of the
@openzeppelin/contracts
and@openzeppelin/contracts-upgradeable
versions specified inpackage.json
, Openzeppelin contracts of version, such as 4.1.0, can be installed.In the
NounsAuctionHouse
contract, theinitializer
modifier is used for the followinginitialize
function. Due to the high vulnerability related toinitializer
mentioned above, theinitialize
function can be executed twice to cause the state variables, such asweth
, to be set to undesired and malicious values.https://github.com/code-423n4/2022-08-nounsdao/blob/main/contracts/NounsAuctionHouse.sol#L62-L82
Tools Used
VSCode
Recommended Mitigation Steps
In
package.json
, set@openzeppelin/contracts
and@openzeppelin/contracts-upgradeable
versions to the latest. To fix the issue related toinitializer
, version 4.4.1 or higher should be used.