VTVL contest - innertia'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: 138/198

Findings: 2

Award: $19.60

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

VariableSupplyERC20Token can initially set the value of maxSupply to mintableSupply.
Suppose you initially set the maxSupply to 1000. Indeed, due to the constraints of the mint function, we cannot mint more than 1000 at a time. Each minting under 1000 will decrease mintableSupply, and finally, after 1000 mints, it will be zero.
Here is the problem: mintableSupply = 0 means there is no minting limit.
In other words, even though maxSupply was initially set, you can mint an unlimited number of mints even after maxSupply has been minted.
This makes maxSupply meaningless.

Proof of Concept

mintableSupply = maxSupply_;

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

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); }

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

There is a way to set the initial value of mintableSupply to the maximum value of uint256 and not reset it when maxSupply_= 0.

#0 - 0xean

2022-09-23T23:55:46Z

dupe of #3

Lines of code

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

Vulnerability details

When removing admins' privileges, you can set your own address. This in itself is not a problem, but if you do this while there is only one Admin, there will be zero Admins.
After that, no one will be able to perform operations that require admin privileges.

Proof of Concept

function setAdmin(address admin, bool isEnabled) public onlyAdmin { require(admin != address(0), "INVALID_ADDRESS"); _admins[admin] = isEnabled; emit AdminAccessSet(admin, isEnabled); }

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

  • Keep a count of the number of admins and keep it from going to zero.
  • Make it impossible to disenfranchise one's own address.

#0 - 0xean

2022-09-23T23:42:02Z

dupe of #469

#1 - 0xean

2022-10-09T23:06:17Z

downgraded to QA

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