VTVL contest - ak1'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: 55/198

Findings: 3

Award: $60.78

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

32.8268 USDC - $32.83

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

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

Vulnerability details

Impact

The current implementation will not allow to createClaim again if the user was revoked by admin once.

Proof of Concept

https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L317 https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L245-L253 From above line of codes, claim can be created when the claim start time is == 0 , refer the hasNoClaim(_recipient) modifier.

When we see the revoke claim, https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L418-L437

During revoke, the codes do not reset any of the claim's state variables. That mean the start time can be greater than zero.

In this scenario, as the start time is greater than zero, after revoking the claim, the same user can not be added for claim.

I will explain one use case where the same user can be added for claim.

Lets say, Bob joined a company and spent some time in work. Then the company offers some ERC20 tokens for certain period. After withdrawing few of the claims, he decided to quit. Now bob claim is revoked and remaining tokens are transferred to company. After some time, bob wanted to join the same company (may be, this time with more perks :)), Now the company looks to create claim for Bob, but can not create claim. Since the start time for the claim is greater than zero, the company can not create claim for bob.

Tools Used

Manual code review

During revokeClaim call, reset all the claim's state variable.

#0 - 0xean

2022-09-24T19:09:07Z

dupe of #140

  1. For safer side, type cast the time variable into uint112 during following math operation. https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L176 updated code : uint112 linearVestAmount = _claim.linearVestAmount * uint112(truncatedCurrentVestingDurationSecs) / uint112(finalVestingDurationSecs)

Awards

9.086 USDC - $9.09

Labels

bug
G (Gas Optimization)

External Links

  1. https://github.com/code-423n4/2022-09-vtvl/blob/f68b7f3e61dad0d873b5b5a1e8126b839afeab5f/contracts/VTVLVesting.sol#L206 To get the finalVestedAmount, no need to call _baseVestedAmount. The finalVestedAmount, can be calculated by directly adding the _claim.cliffAmount+_claim.linearVestAmount

  2. In _baseVestedAmount calculation, at the start of the function, add check if the _referenceTs <= start time of the cliam . Can save some amount of gas that could be consumed by calculation.

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