MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: low
Valid

Unrestricted Token Minting which could lead to an inflation of the token supply.

Summary

function mint(address _account, uint256 _amount) external onlyOwner {
require(_amount <= 1000 * (10 ** decimals()), "StETHMock: amount is too big");
uint256 sharesAmount = getSharesByPooledEth(_amount);
_mintShares(_account, sharesAmount);
totalPooledEther += _amount;
}

The vulnerability in the mint() function is that this function allows anyone who calls it to mint new tokens without any restrictions.

Vulnerability Details

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.

Here is a possible attack path on this function:
  1. Send Transaction:
    The attacker sends the transaction to the network. Since the mint() function is external, it can be called from outside the contract.

  2. Execute Function:
    The contract executes the mint() function, which calculates the number of shares to mint based on the _amount provided.

  3. Mint Tokens:
    The contract mints new tokens according to the calculated shares and assigns them to the attacker's address.

  4. Increase Supply:
    The totalPooledEther is updated, reflecting the increased supply of ether backing the tokens.

  5. Repeat Exploitation:
    The attacker can repeat the process as many times as they wish, continuously minting more tokens and increasing the total supply.

  6. 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.

Impact

This could lead to an inflation of the token supply, which could devalue the token and potentially cause financial loss for holders.

Tools Used

Manual Review
VS code

Recommendations

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.

function mint(address _account, uint256 _amount) external onlyOwner {
require(_amount <= 1000 * (10 ** decimals()), "StETHMock: amount is too big");
uint256 sharesAmount = getSharesByPooledEth(_amount);
_mintShares(_account, sharesAmount);
totalPooledEther += _amount;
}

This way, only the owner of the contract can mint new tokens, preventing potential inflation of the token supply.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Lack of access control in `StETHMock:mint` and `WStETHMock::mint`

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.