-
Notifications
You must be signed in to change notification settings - Fork 0
Supply cap of VariableSupplyERC20Token is not properly enforced #3
Copy link
Copy link
Open
Labels
2 (Med Risk)Assets not at direct risk, but function/availability of the protocol could be impacted or leak valueAssets not at direct risk, but function/availability of the protocol could be impacted or leak valuebugSomething isn't workingSomething isn't workingsponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Metadata
Metadata
Assignees
Labels
2 (Med Risk)Assets not at direct risk, but function/availability of the protocol could be impacted or leak valueAssets not at direct risk, but function/availability of the protocol could be impacted or leak valuebugSomething isn't workingSomething isn't workingsponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Type
Fields
Give feedbackNo fields configured for issues without a type.
Lines of code
https://github.com/code-423n4/2022-09-vtvl/blob/main/contracts/token/VariableSupplyERC20Token.sol#L36-L46
Vulnerability details
Impact
The admin of the token is not constrained to minting
maxSupply_, they can mint any number of tokens.Proof of Concept
The logic is as follows: if the amount that can be minted is zero, treat this as an infinite mint. Else require that the minted amount is not larger than mintable supply.
One can note that it is possible to mint all mintable supply. Then the mintable supply will be
0which will be interpreted as infinity and any number of tokens will be possible to be minted.Tools Used
Manual analysis
Recommended Mitigation Steps
Treat
2 ** 256 - 1as infinity instead of0.