VTVL contest - cRat1st0s'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: 194/198

Findings: 1

Award: $0.74

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

2022-09-vtl-code4rena Report

Files Description Table

File NameSHA-1 Hash
2022-09-vtl/contracts/token/VariableSupplyERC20Token.solc85443294bfb78bd2ce7695b66a9a726a864ed80

High Report

Issues found

[H-01]: Limited supply can be surpassed in mint()

Impact

In function mint there is the if-statement if(mintableSupply > 0), that based on the comment, is needed to make sure that maxSupply is respected. But, in some point, by subtracting the amount from mintableSupply the mintableSupply will be equal to zero. As a consequence, again based on the comment, when mintableSupply is equal to zero then this means mint at will. So, token that has a limited supply can be surpassed.

Code Affected

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

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

Check with maxSupply to verify that limited supply can not be surpassed.

Tools used

VS Code

#0 - 0xean

2022-09-23T23:56:14Z

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