Spectrum Protocol - Audit(Addendum)

CertiKFiles named in the report

CertiK reviewed Kroma (Spectrum Protocol - Audit(Addendum)) on 13 May 2024: 18 findings, 0 critical; 3 marked fixed, 2 acknowledged, 13 open.

No open critical findings
Open the reportOpen Kroma’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings18

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High020
Medium101
Low1202
MediumPotential Inflation Attack caused by ERC4626UpgraOpen

The contract `EcoERC4626Upgradeable` inherits `ERC4626Upgradeable`, which is a token vault. Within the `ERC20RebasedUpgradeable` contract, users can stake underlying tokens to acquire shares, functioning as a token vault. When the vault, whether it's `EcoERC4626Upgradeable` or `ERC20RebasedUpgradeable`, is empty or close to empty, deposits are at high risk of being stolen through front-running. This occurs when a donation to the vault inflates the price of a share, a situation also known as a donation or inflation attack. Essentially, this is a problem of slippage. Reference: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706

Low`_findIndex` functions that are not called by theOpen

The `_findIndex()` functions are internal and not called by the contract. ```solidity=191 function _findIndex(EnumerableSet.AddressSet storage $, address item) internal view returns (uint256 i) { i = $._inner._positions[bytes32(uint256(uint160(item)))]; if (i == 0) revert Spectrum(SpectrumErrors.NotExist); } function _findIndex(address[] memory addrs, address item) internal pure returns (uint256 i) { unchecked { for (; i < addrs.length; i++) { if (addrs[i] == item) return i; } } revert Spectrum(SpectrumErrors.NotExist); } ```

LowContract deployment fails unless the specified owOpen

The contract's constructor is designed to accept an `initialOwner` parameter intended to designate the owner of the contract. The constructor transfers ownership to the specified `initialOwner` and subsequently calls the `grantSelectorRole()` function, which is an `onlyAdmin` function. If the `initialOwner` parameter provided is not the same as the deployer's address, the deployer is not the contract owner when calling `grantSelectorRole()`, resulting in a failed contract deployment, limiting the flexibility intended by transferring the ownership at the deployment phase. The root cause is that the ownership transfer to `initialOwner` happens before `grantSelectorRole()` is called, and since the deployer no longer has ownership permission, the deployer cannot execute the `onlyAdmin` function `grantSelectorRole()`.

LowFunction Can Be Modified With `pure` Or `view`Open

`_proxyAdmin()` do not require modifying the contract state, nor do they need to receive Ether. However, these functions are not labeled with `pure` or `view` modifiers.

LowIncompatibility with Deflationary TokensOpen

When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction.

LowInherited Contracts Not Initialized In InitializeOpen

- Contract ·`ERC20MetadataUpgradeable`· extends `ERC20Upgradeable` - contract `EcoERC20Upgradeable`· extends `ERC20PermitUpgradeable` - contract `ERC20MintableUpgradeable`· extends `ERC20Upgradeable` and `ERC20BurnableUpgradeable` - contract `WETH`· extends `ERC20BurnableUpgradeable` - contract `EcoOwnable` extends `Ownable2StepUpgradeable` - contract `SelectorRoleControlUpgradeable` extends `PausableUpgradeable` and `AccessControlEnumerableUpgradeable` - contract `EcoProxyAdmin` extends `MulticallUpgradeable` - contract `EcoERC1155Upgradeable` extends `ERC1155PausableUpgradeable`, `ERC1155BurnableUpgradeable` and `ERC1155SupplyUpgradeable` - contract `NFT_Mintable`· extends `PausableUpgradeable`, `ERC721BurnableUpgradeable` and `ERC721EnumerableUpgradeable` - contract `ERC721PausableUpgradeable` extends `PausableUpgradeable` - contract `ERC20RebasedUpgradeable`· extends `ERC20PermitUpgradeable` - contract `EcoERC4626Upgradeable`· extends `ERC20PermitUpgradeable` and `ERC20BurnableUpgradeable` but these extended contracts are not initialized by the current contracts. Generally, the initializer function of a contract should always call all the initializer functions of the contracts that they extend.

LowInvalid Use of Access Control ModifierOpen

The functions marked as 'view' or 'pure' are unnecessarily restricted by the 'restrict' modifier. These functions are designed to be read-only, meaning they do not modify the state on the blockchain. However, they are restricted so that only a specific address can call them. It's important to note that even private state variables can be read off-chain, rendering the access restriction on these functions ineffective.

LowNot Recommended MetadataURI ProtocolOpen

HTTP/HTTPS should not be used for token metadata because the domain and web server owner can change token metadata at will to dramatically affect token value. See https://docs.openzeppelin.com/contracts/4.x/erc721. The function doesn't verify if the supplied `_baseURI` is a valid IPFS location. The function doesn't verify if the supplied `_baseURI` is a valid IPFS location.

LowPotential Divide by ZeroOpen

Performing division by zero would raise an error and revert the transaction. ```solidity=48 ethValue = (gSnap.spSnap.evalValue * spAmount) / gSnap.info.spETH.totalSupply(); ``` --- ```solidity=53 spAmount = (gSnap.info.spETH.totalSupply() * ethValue) / gSnap.spSnap.evalValue; ```

LowPotential Out-of-Gas ExceptionOpen

When a loop allows an arbitrary number of iterations or accesses state variables in its body, the function may run out of gas and revert the transaction. ```solidity=60 while (start < stop) { ``` Function `ERC721QueryableUpgradeable.tokensOfOwnerIn` contains a loop and its loop condition depends on parameters: `start`, `stop`.

Show 3 more
LowThird-Party Dependency UsageOpen

The contract serves as the underlying entity to interact with one or more third-party protocols. The scope of the audit treats third-party entities as black boxes and assumes their functional correctness. However, in the real world, third parties can be compromised and this may lead to lost or stolen assets. In addition, upgrades of third parties can possibly create severe impacts, such as increasing fees of third parties, migrating to new LP pools, etc. ```solidity=12 import { IweETH } from "../vendor/etherfi.sol"; ``` - The contract `SpectrumCoreUtils` interacts with the third-party contract with `etherfi` interface via `assetEvaluator`. ```solidity=13 import { IeETH, IweETH, ILiquidityPool, ILiquifier } from "../vendor/etherfi.sol"; import { IstETH, IwstETH } from "../vendor/lido.sol"; ``` - The contract `SpectrumHubUtils` interacts with the third-party contract with `etherfi` interface via `actionForStake`. - The contract `SpectrumHubUtils` interacts with the third-party contract with `lido` interface via `actionForStake`. ```solidity=7 import { IKromaBridge } from "../../eco-libs/kroma/interfaces.sol"; ``` - The contract `SpectrumHubLogic` interacts with the third-party contract with `IKromaBridge` interface via `info.bridge`.

LowUnprotected Upgradeable ContractOpen

The `SelectorRoleControlUpgradeable` contract does not protect their initializers. An attacker can call the initializer and assume ownership of the logic contract, whereby she can perform privileged operations that trick unsuspecting users into believing that she is the owner of the upgradeable contract.

LowUnused Return ValueOpen

The return value `resultAmount` is declared but never used in the function body.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (41)

  • contracts/token/ERC20/EcoERC4626Upgradeable.sol
  • contracts/token/NFT/NFT_Typed.sol
  • contracts/ERC165.sol
  • contracts/proxy/transparent.sol
  • contracts/token/NFT/NFT_Mintable.sol
  • contracts/spectrum/hub/SpectrumHubUtils.sol
  • contracts/access/CallOrder.sol
  • contracts/token/ERC721/ERC721PausableUpgradeable.sol
  • contracts/token/ERC1155/EcoERC1155URIControl.sol
  • contracts/token/NFT/SBT.sol
  • contracts/token/ERC20/ERC20MintableUpgradeable.sol
  • contracts/spectrum/hub/SpectrumHubLogic.sol
  • contracts/proxy/admin.sol
  • contracts/token/ERC20/ERC20RebasedUpgradeable.sol
  • contracts/types.sol
  • contracts/access/SelectorRoleControlUpgradeable.sol
  • contracts/token/ERC1155/EcoERC1155Upgradeable.sol
  • contracts/spectrum/core/SpectrumCoreLogic.sol
  • contracts/spectrum/core/SpectrumCoreUtils.sol
  • contracts/token/ERC721/ERC721SoulBoundUpgradeable.sol
  • contracts/access/EcoOwnable.sol
  • contracts/token/ERC20/ERC20L2BridgedUpgradeable.sol
  • contracts/token/ERC20/WETH.sol
  • contracts/spectrum/core/SpectrumCoreEntry.sol
  • contracts/token/ERC721/ERC721SequencialMintUpbradeable.sol
  • contracts/spectrum/hub/SpectrumHubState.sol
  • contracts/spectrum/hub/SpectrumHubEntry.sol
  • contracts/token/ERC20/EcoERC20Upgradeable.sol
  • contracts/spectrum/core/SpectrumCore.sol
  • contracts/token/ERC721/ERC721QueryableUpgradeable.sol
  • contracts/token/ERC20/EcoERC20Rebased.sol
  • contracts/rate.sol
  • contracts/token/ERC1155/ERC1155MintableUpgradeable.sol
  • contracts/spectrum/hub/SpectrumHub.sol
  • contracts/access/SlotOrder.sol
  • contracts/utils/BasisPointRateMath.sol
  • contracts/spectrum/core/SpectrumCoreState.sol
  • contracts/token/ERC721/ERC721TypedUpgradeable.sol
  • contracts/spectrum/SpectrumETH.sol
  • contracts/token/ERC20/ERC20MetadataUpgradeable.sol
  • contracts/token/ERC1155/ERC1155PausableUpgradeable.sol

Part of Kroma’s security record

Kroma
Audits3 audits by 1 firmLast audit Dec 2024, by CertiK.
Critical findingsNo open critical findingsAcross 3 reports.
Open Kroma’s security record

Security firm

CertiK

1,044 projects reviewed · 1,375 reports · latest May 2025

See CertiK’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us