VTVL contest - fatherOfBlocks's results

Building no-code token management tools to empower web3 founders and investors, starting with token vesting.

General Information

Platform: Code4rena

Start Date: 20/09/2022

Pot Size: $30,000 USDC

Total HM: 12

Participants: 198

Period: 3 days

Judge: 0xean

Total Solo HM: 2

Id: 164

League: ETH

VTVL

Findings Distribution

Researcher Performance

Rank: 4/198

Findings: 3

Award: $1,383.17

🌟 Selected for report: 1

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: fatherOfBlocks

Also found by: wagmi

Labels

bug
enhancement
2 (Med Risk)
sponsor confirmed

Awards

1355.2196 USDC - $1,355.22

External Links

Lines of code

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L224 https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L245 https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L302 https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L317

Vulnerability details

Impact

  • L224/245/302/317 - When the smart contracts start to be used, the variable in storage vestingRecipients will start to be filled with addresses, as there is no mechanism to eliminate elements, this will cause the allVestingRecipients() function to generate a DoS yes has many addressess.

In the withdraw() function you could remove the element from vestingRecipients that no longer has vesting. This would make the variable not grow without reducing elements.

#0 - 0xean

2022-09-24T21:37:11Z

On the fence on this on. I agree with the warden, but in the current implementation allVestingRecipients is unused and assumed to be for external, off chain uses so the impact is hard to determine. Going to leave as M, pending sponsor review.

#1 - lawrencehui

2022-10-07T00:07:33Z

I would agree with the warden on the lack of control for an ever-growing array size could be an issue. I will tag this as an enhancement.

On the side, I want to check what is the allowed max size of the array in this case? 2**256 -1? but theoretically calling a large array would exceed the the block gas limit when retrieving it?

#2 - 0xean

2022-10-07T22:51:13Z

@lawrencehui - Yes retrieval will eventually fail, long before you populate the array fully. You could pass in an index range to retrieve portions of the array to avoid this failure mode.

#3 - 0xean

2022-10-07T22:51:38Z

and yes 2**256 -1 is my understanding of the theoretical limit.

FullPremintERC20Token

  • L9 - There is commented code that is not used, this should be removed.

AccessProtected

  • L5 - The Ownable library is not used and is imported, this should be removed.

VTVLVesting

  • L6 - The Ownable library is not used and is imported, this should be removed.

  • L40/41 - There is commented code that is not used, this should be removed.

Awards

9.086 USDC - $9.09

Labels

bug
G (Gas Optimization)

External Links

FullPremintERC20Token

  • L11 - When we make a comparison between two numbers it is much less expensive to do uint256() != 0 than uint256() > 0.

VariableSupplyERC20Token

  • L27/31/40 - When performing a comparison between two numbers it is much less expensive to do uint256() != 0 than uint256() > 0.

VTVLVesting

  • L27/148/353 - It is not necessary to set a variable with its default value, this generates an extra expense since a double setting is made.

  • L107/256/257/263/272/273/449 - When performing a comparison between two numbers it is much less expensive to do uint256() != 0 than uint256() > 0.

  • L111 - When we want to use a boolean to execute something or not, it is not necessary to do: validation == true or validation == false, this generates an extra gas cost. Validation or validation can be done directly

  • L167/353/374/377/426/429 - When an operation has already been validated beforehand and we know that it does not generate an overflow or underflow, we can wrap the operation with unchecked so that it does not validate the overflow twice.

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