PartyDAO contest - V_B's results

A protocol for buying, using, and selling NFTs as a group.

General Information

Platform: Code4rena

Start Date: 12/09/2022

Pot Size: $75,000 USDC

Total HM: 19

Participants: 110

Period: 7 days

Judge: HardlyDifficult

Total Solo HM: 9

Id: 160

League: ETH

PartyDAO

Findings Distribution

Researcher Performance

Rank: 12/110

Findings: 3

Award: $639.56

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: 0xA5DF

Also found by: Lambda, V_B

Labels

bug
duplicate
2 (Med Risk)
edited-by-warden

Awards

521.8703 USDC - $521.87

External Links

Lines of code

https://github.com/PartyDAO/party-contracts-c4/blob/d129d647796369a18e30b336e74e7d1bfc779597/contracts/crowdfund/Crowdfund.sol#L322 https://github.com/PartyDAO/party-contracts-c4/blob/d129d647796369a18e30b336e74e7d1bfc779597/contracts/distribution/TokenDistributor.sol#L390

Vulnerability details

Description

There is function _hashFixedGovernanceOpts in Crowdfund contract and function _getDistributionHash in TokenDistributor contract. The first one truncates the hash result to 16 bytes, the second to 15 bytes.

Impact

It is possible to find a collision for such truncated hash using algorithm with O(2^(hash_bitlenght/2) * T) time complexity where T is the complexity of hash calculation (according to the Birthday Problem). And it will cost not too much money, according to the current hash computing power. So usage of such hash function is not safe at all.

Don't truncate the hash result so much. Ideally, use all 32 bytes of the hash result.

#0 - merklejerk

2022-09-22T16:28:36Z

Duplicate of #231

1. calldata instead of memory in external functions

It is reasonable to use calldata instead of memory for input arrays in external functions to reduce gas consumption and make the code more clear. As an example, createParty function from PartyFactory contract should be changed.

2. LibGlobals constants

It is reasonable to use in LibGlobals library an enum instead of 22 constants.

3. oldDelegate == newDelegate in _rebalanceDelegates

There is a _rebalanceDelegates function in PartyGovernance. For the case when oldDelegate parameter equals to newDelegate parameter it will be more clear to use special check and update, instead of doing more complicated interdependent logic.

4. MarketWrappers payable functions

MarketWrappers don't have payable functions but function bid sends something.

#0 - HardlyDifficult

2022-10-03T21:44:38Z

1. calldata instead of memory in external functions

It is reasonable to use calldata instead of memory for input arrays in external functions to reduce gas consumption and make the code more clear. As an example, createParty function from PartyFactory contract should be changed.

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