Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 2.08 KB

128.md

File metadata and controls

57 lines (37 loc) · 2.08 KB

Broad Jetblack Alligator

High

Uninitialized Roles in most of the smart contracts

Summary

Failure to initialize roles will result in a critical loss of functionality for contract users, as authorized actors will be unable to perform necessary operations without proper role assignments.

Root Cause

In BoostStablecoin.sol, Minter.sol, MasterAMO.sol, and SolidlyV2AMO.sol, failing to initialize roles in the constructor or initialization function is a mistake that renders critical functions inaccessible.

https://github.com/sherlock-audit/2024-10-axion/blob/c65e662999d0c79439703fc6713814b4ad023e01/liquidity-amo/contracts/BoostStablecoin.sol#L25C2-L27C68 https://github.com/sherlock-audit/2024-10-axion/blob/c65e662999d0c79439703fc6713814b4ad023e01/liquidity-amo/contracts/MasterAMO.sol#L52C1-L60C85 https://github.com/sherlock-audit/2024-10-axion/blob/c65e662999d0c79439703fc6713814b4ad023e01/liquidity-amo/contracts/Minter.sol#L21C1-L26C62 https://github.com/sherlock-audit/2024-10-axion/blob/c65e662999d0c79439703fc6713814b4ad023e01/liquidity-amo/contracts/SolidlyV2AMO.sol#L40C5-L40C97

Internal pre-conditions

  1. Contracts deployed without proper role initialization.
  2. No function exists to assign roles post-deployment.

External pre-conditions

No response

Attack Path

  1. Smart contract deployed without role initialization.
  2. Most protocol functions (e.g., getReward, pause, mint) cannot be called by anyone.

Impact

The contract role established cannot perform essential functions like minting, pausing, or adjusting critical parameters, resulting in a total loss of intended functionality for the protocol.

PoC

No response

Mitigation

set the role to the address in the initialize function

function initialize(address admin, address getrole) external initializer {
    __ERC20_init("Boost", "BOOST");
    __ERC20Burnable_init();
    __Pausable_init();
    __AccessControl_init();

    _grantRole(DEFAULT_ADMIN_ROLE, admin);
    _setupRole(PAUSER_ROLE, getrole);
    _setupRole(UNPAUSER_ROLE, getrole);
    _setupRole(MINTER_ROLE, getrole);
}