VTVL contest - 0xSky'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: 19/198

Findings: 3

Award: $408.52

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: Trust

Also found by: 0xSky, CertoraInc, KIntern_NA, bin2chen, hansfriese, neko_nyaa, neumo, rokinot, wastewa

Labels

bug
duplicate
3 (High Risk)

Awards

388.9184 USDC - $388.92

External Links

Lines of code

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L176

Vulnerability details

Impact

In _baseVestedAmount of VTVLVesting.sol, when we calculate the vested amount, vestAmt is the sum of cliffAmount and linearVestAmount. linearVestAmount is calculated from the fraction of completed interval as follows.

uint112 linearVestAmount = _claim.linearVestAmount * truncatedCurrentVestingDurationSecs / finalVestingDurationSecs;

40 bytes are allocated to timestamps, and _claim.linearVestAmount is 112 bytes long. So actual space for _claim.linearVestAmount is 112 - 40 = 72 bytes in the multiplication. If the token has 18 decimals, it is nearly 60 bytes. As a result, linearVestAmount is limited to 2**12 = 4096 tokens. For better clarification, if we consider the actual timestamps are in 32 bytes, this limit can go up to 1048576 tokens, and still not so enough.

Allocate more space to linearVestAmount in the Claim struct.

#0 - 0xean

2022-09-24T19:18:40Z

dupe of #95

Awards

0.7375 USDC - $0.74

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

External Links

Lines of code

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/token/VariableSupplyERC20Token.sol#L40-L44

Vulnerability details

Impact

In VariableSupplyERC20Token.sol, token supply is limited to mintableSupply and it is initialized by maxSupply_ in the constructor. If mintableSupply is 0, there is no limit in the supply. So in the mint function, when mintableSupply is 0, internal _mint function is called directly without any validation. But this logic has a problem. In the mint function, mintableSupply is decreased by amount and it can be zero when amount == mintableSupply after several mints. As a result, we can mint further without any limit after we mint initial mintableSupply(=maxSupply_ of constructor).

Add a state variable which stores actual minted amount, instead of decreasing mintableSupply.

#0 - 0xean

2022-09-24T00:37:07Z

dupe of #3

There can be no admin

In setAdmin of AccessProtected.sol, when disable an admin, there is no check about how many admins left.

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/AccessProtected.sol#L39-L43

So it is possible that there is no admin in the Vesting contract. The impact is not huge because only admins can change admin status, and users can withdraw their claim without any admins. But in the situation, it is not possible to create new claims anymore, and revokeClaim is impossible when needed. So I raise this as a low risk.

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