The vulnerability in the mint()
function is that this function allows anyone who calls it to mint new tokens without any restrictions.
The issue here is that there's no restriction on who can call this function. Any address can call this function and mint new tokens. This could lead to an inflation of the token supply if the function is called repeatedly.
Send Transaction:
The attacker sends the transaction to the network. Since the mint()
function is external
, it can be called from outside the contract.
Execute Function:
The contract executes the mint()
function, which calculates the number of shares to mint
based on the _amount
provided.
Mint Tokens:
The contract mints
new tokens according to the calculated shares
and assigns them to the attacker's address
.
Increase Supply:
The totalPooledEther
is updated, reflecting the increased supply of ether backing the tokens.
Repeat Exploitation:
The attacker can repeat the process as many times as they wish, continuously minting more tokens and increasing the total supply
.
Manipulate Market:
With a large portion of the token supply, the attacker could influence the market, potentially causing significant changes in the token's price and trading volume.
This could lead to an inflation of the token supply, which could devalue the token and potentially cause financial loss for holders.
Manual Review
VS code
You could add a modifier that restricts who can call this function. For example, you could add a onlyOwner
modifier to ensure that only the owner of the contract can mint new tokens.
This way, only the owner
of the contract can mint new tokens, preventing potential inflation of the token supply.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.