VTVL contest - GimelSec'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: 195/198

Findings: 1

Award: $0.74

๐ŸŒŸ Selected for report: 0

๐Ÿš€ Solo Findings: 0

Awards

0.7375 USDC - $0.74

Labels

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

External Links

Lines of code

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

Vulnerability details

Impact

If mintableSupply is set in VariableSupplyERC20Token.contructor(), the token wonโ€™t allow minting over mintableSupply. However, mintableSupply will reduce after every minting. Once mintableSupply is reduced to zero, the token can be minted unlimitedly.

Proof of Concept

  • mintableSupply is set to 100
  • mint 50 tokens, then mintableSupply = 100 - 50 = 0
  • mint 50 tokens again, then mintableSupply = 50 - 50 =0
  • Now if(mintableSupply > 0) is not ture, the token can be minted unlimitedly

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

function mint(address account, uint256 amount) public onlyAdmin { require(account != address(0), "INVALID_ADDRESS"); // If we're using maxSupply, we need to make sure we respect it // mintableSupply = 0 means mint at will if(mintableSupply > 0) { require(amount <= mintableSupply, "INVALID_AMOUNT"); // We need to reduce the amount only if we're using the limit, if not just leave it be mintableSupply -= amount; } _mint(account, amount); }

Tools Used

Manual Review

Donโ€™t treat mintableSupply = 0 as mint at wil. Maybe use a flag like mintableUnlimited for unlimited supply.

#0 - 0xean

2022-09-24T00:36:41Z

dupe of #3

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