Ethena Labs - oxchsyston's results

Enabling The Internet Bond

General Information

Platform: Code4rena

Start Date: 24/10/2023

Pot Size: $36,500 USDC

Total HM: 4

Participants: 147

Period: 6 days

Judge: 0xDjango

Id: 299

League: ETH

Ethena Labs

Findings Distribution

Researcher Performance

Rank: 123/147

Findings: 1

Award: $4.52

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

1. No address zero check on on the _to address in the mint function

In the mint function in contract USDe.sol there is no address(0) check to ensure that USDe is not minted to the zero address, which is basically burning the intended tokens to mint.

function mint(address to, uint256 amount) external {
   if (msg.sender != minter) revert OnlyMinter();
   _mint(to, amount);
 }

2. No checks to ensure that role is not granted to the zero address

in the _grantRole function in SingleAdminAccessControl.sol is used by the DEFAULT_ADMIN_ROLE grant roles to accountsbut does not ensure that the account to grant role is not the zero address before granting rolethis can lead to DoS and loss of gas.

  function _grantRole(bytes32 role, address account) internal override {
    if (role == DEFAULT_ADMIN_ROLE) {
      emit AdminTransferred(_currentDefaultAdmin, account);
      _revokeRole(DEFAULT_ADMIN_ROLE, _currentDefaultAdmin);
      _currentDefaultAdmin = account;
      delete _pendingDefaultAdmin;
    }
    super._grantRole(role, account);
  }

3. Direct minting using the mint funntion by MINTER can break the maximun_mint_per_block

As the there are no checks in the mint function that ensures that the max_mint_per_block is not exceeded. so if there is a direct mint using the mint function in USDe.sol it is very possible that the max_mint_per_block will be exceeded. Adding the belowMaxRedeemPerBlock mordifier to the mint function will eliminate this possible loophole. This will also act as a form of extra security if the MINTER role is breached as it limits the amount of USDe the malicious minter possibly mint in a short time. This also applies to the redeem function in USDe.sol

function mint(address to, uint256 amount) external {
    if (msg.sender != minter) revert OnlyMinter();
    _mint(to, amount);
  }

See link here

4. function previewRedeem not specified in the codebase.

The function previewRedeem is called in the cooldownShares/cooldownAssets functions, which presumably should be used to calculate the conversion of shares to assets to redeem, but this function is not implemented in the codebase in scope and out of scope, which can lead to unintended behaviour in the contract.

 function cooldownShares(uint256 shares, address owner) external ensureCooldownOn returns (uint256) {
    if (shares > maxRedeem(owner)) revert ExcessiveRedeemAmount();

    uint256 assets = previewRedeem(shares);

    cooldowns[owner].cooldownEnd = uint104(block.timestamp) + cooldownDuration;
    cooldowns[owner].underlyingAmount += assets;

    _withdraw(_msgSender(), address(silo), owner, assets, shares);

    return assets;
    }

#0 - c4-pre-sort

2023-11-02T02:55:18Z

raymondfam marked the issue as low quality report

#1 - c4-pre-sort

2023-11-02T02:55:24Z

raymondfam marked the issue as sufficient quality report

#2 - c4-judge

2023-11-14T16:56:55Z

fatherGoose1 marked the issue as grade-b

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