Nouns Builder contest - datapunk's results

A permissionless, governed protocol to deploy nouns-style DAOs complete with treasury, generative collections, and governance mechanisms.

General Information

Platform: Code4rena

Start Date: 06/09/2022

Pot Size: $90,000 USDC

Total HM: 33

Participants: 168

Period: 9 days

Judge: GalloDaSballo

Total Solo HM: 10

Id: 157

League: ETH

Nouns Builder

Findings Distribution

Researcher Performance

Rank: 61/168

Findings: 4

Award: $205.93

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

5.6134 USDC - $5.61

Labels

bug
duplicate
2 (Med Risk)
old-submission-method

External Links

Lines of code

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L118 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L179

Vulnerability details

Impact

wrong % calculation. The % is not applied to baseTokenId, so baseTokenId can go beyond 100 given certain founderPct sequence, for example, 23, 19, 17, 13. Thus founders cannot claim some tokenIds for free.

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L118 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L179

Tools Used

if this is the intention then: baseTokenId = (baseTokenId + schedule) % 100;

Findings Information

🌟 Selected for report: davidbrai

Also found by: Ch_301, Chom, GimelSec, PwnPatrol, cccz, datapunk, elad, pauliax, rbserver

Labels

bug
duplicate
2 (Med Risk)
old-submission-method

Awards

104.7173 USDC - $104.72

External Links

Findings Information

🌟 Selected for report: dipp

Also found by: 0x1f8b, 0x52, 0xSky, 0xc0ffEE, Jeiwan, Migue, R2, bin2chen, datapunk, eierina, elad, hansfriese, hyh, scaraven

Labels

bug
duplicate
2 (Med Risk)
upgraded by judge

Awards

34.7819 USDC - $34.78

External Links

Judge has assessed an item in Issue #686 as Medium risk. The relevant finding follows:

#0 - GalloDaSballo

2022-09-27T14:49:21Z

Impact by design, there should not be more than 16 attributes. but when adding properties, there are no constraints

Proof of Concept https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/metadata/storage/MetadataRendererStorageV1.sol#L20 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/metadata/MetadataRenderer.sol#L91

Tools Used Recommended Mitigation Steps do something with this effect: function addProperties() { ... if (_names.length + properties.length) > 16) revert TOO_MANY_PROPERTIES; ... }

Dup of #523

1

Impact

struct/contract Auction name shadowing Local variables, state variables, functions, modifiers, or events with names that shadow (i.e. override) builtin Solidity symbols e.g.Β nowΒ or other declarations from the current scope are misleading and may lead to unexpected usages and behavior.

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/auction/types/AuctionTypesV1.sol#L29 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/auction/Auction.sol#L22

Tools Used

be more explicit/creative with naming

2

Impact

unnecessary uint40 casting, while _duration variable could have been passed in as uint40 to start with

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/auction/Auction.sol#L58 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/auction/Auction.sol#L77

Tools Used

function initialize(..., uint40 _duration, ...)

3

Impact

unnecessary uint16 casting, while both quorumThresholdBps and _newQuorumVotesBps are defined as uint256

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/governance/governor/Governor.sol#L588 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/manager/IManager.sol#L79

Tools Used

function updateQuorumThresholdBps(uint16 _newQuorumVotesBps) external onlyOwner {...}

4 Differences between ERC721 in this project and OpenZepplin

Impact

one can approve or set him/herself as _to and _operator

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/lib/token/ERC721.sol#L102 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/lib/token/ERC721.sol#L115

Tools Used

function setApprovalForAll(address _operator, bool _approved) external { require(owner != operator, "ERC721: approve to caller"); ... } function approve(address _to, uint256 _tokenId) external { require(to != owner, "ERC721: approval to current owner"); ... }

5

Impact

no need to delegate if new delegatee is the same as previous delegatee

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/lib/token/ERC721Votes.sol#L181

Tools Used

add if (_to==prevDelegate) revert REPEATED_DELEGATE;

6

Impact

condense elements in struct FounderParams into one slot Especially all three elements are accessibled together

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/manager/IManager.sol#L48 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L82

Tools Used

struct FounderParams { address wallet; **uint8** ownershipPct; **uint32** vestExpiry; // @audit why uint256? can use one slot instead }

7

Impact

increase state variable for incrementation. Use a memory variable to save gas

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/Token.sol#L91

Tools Used

uint256 curNumFounder = settings.numFounders; unchecked { ... uint256 founderId = curNumFounders++; ... } settings.numFounders = curNumFounder;

8

Impact

by design, there should not be more than 16 attributes. but when adding properties, there are no constraints

Proof of Concept

https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/metadata/storage/MetadataRendererStorageV1.sol#L20 https://github.com/code-423n4/2022-09-nouns-builder/blob/7e9fddbbacdd7d7812e912a369cfd862ee67dc03/src/token/metadata/MetadataRenderer.sol#L91

Tools Used

do something with this effect: function addProperties() { ... if (_names.length + properties.length) > 16) revert TOO_MANY_PROPERTIES; ... }

#0 - GalloDaSballo

2022-09-27T01:21:09Z

struct/contract Auction name shadowing

R as it's not technically shadowing

one can approve or set him/herself as _to and _operator

R

no need to delegate if new delegatee is the same as previous delegatee

R

condense elements in struct FounderParams into one slot

R

by design, there should not be more than 16 attributes. but when adding properties, there are no constraints

TODO

#1 - GalloDaSballo

2022-09-27T01:21:18Z

4R

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter