Wemix Lending(Retainer #6)

CertiKFiles named in the report

Audit

Part of CertiK’s retainer series

CertiK reviewed WEMIX (Wemix Lending(Retainer #6)) on 9 Feb 2023: 27 findings, 0 critical; 21 marked fixed, 6 open.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings27

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

SeverityOpenAcknowledgedFixed
Critical000
High301
Medium102
Low2018
HighCentralization Related RisksOpen

In the contract `CToken` the role `ServiceAdmin` has authority over the functions - initializeCToken() - setProtocolSeizeShareMantissa() - setReserveFactor() - setInterestRateModel() Any compromise to the `ServiceAdmin` account may allow the hacker to take advantage of this authority and - initialize the money market - set the share of seized collateral that is added to reserves - sets a new reserve factor for the protocol - updates the interest rate model In the contract `CToken` the role `MasterAdmin` has authority over the functions - setController() - setControllerView() - setTransactionHelper() - reduceReservesFresh() Any compromise to the `MasterAdmin` account may allow the hacker to take advantage of this authority and - set the controller contract address - set the controller view contract address - set the transaction helper contract address - reduces reserves by transferring to admin In the contract `Controller` the role `MasterAdmin` has authority over the functions - setControllerView() - setMasterAdmin() - setServiceAdmin() Any compromise to the `MasterAdmin` account may allow the hacker to take advantage of this authority and - set the controller view contract address - set master admin address - set service admin address In the contract `Controller` the role `ServiceAdmin` has authority over the functions - setIncentiveToken() - supportMarket() - setLiquidationIncentive() - setMarketBorrowCaps() - setPriceOracle() - setIsUnsecuredBorrower() - setCloseFactor() - setCollateralFactor() - setMintPaused() - setBorrowPaused() - setSeizePaused() - setTransferPaused() - setOraclePaused() - setIncentiveTokenSpeed() Any compromise to the `ServiceAdmin` account may allow the hacker to take advantage of this authority and - set `INCENTIVE_TOKEN_ADDRESS` - add the market to the markets mapping and set it as listed - set liquidation incentive - set the given borrow caps for the given cToken markets - set the price oracle - add/remove an unsecured borrower to the `isUnsecuredBorrower` map - set the `closeFactor` used to calculate the maximum `repayAmount` when liquidating borrows - set the `collateralFactor` used to calculate the most one can borrow against their collateral in this market - set `isMintPaused` - set `isBorrowPaused` - set `isSeizePaused` - set `isTransferPaused` - set `isOraclePaused` - set incentive token speed of markets and initialize the money market In the contract `InterestRateModel` the role `MasterAdmin` has authority over the functions - updateJumpRateModel() - setMasterAdmin() - setServiceAdmin() Any compromise to the `MasterAdmin` account may allow the hacker to take advantage of this authority and - update the parameters of the interest rate model - set master admin address - set service admin address In the contract `DataCollector` the role `owner` has authority over the functions - setEpochPeriod() - setAggregator() - setQuorum() - addFeeder() Any compromise to the `owner` account may allow the hacker to take advantage of this authority and - set epoch period - set aggregator address - set quorum - add feeder address In the contract `DataCollector` the role `feeder` has authority over the functions - storeData() - setFeederPublicKey() Any compromise to the `feeder` account may allow the hacker to take advantage of this authority and - store data - set the public key for `feeder` own account In the contract `DataCollector` the role `aggregator` has authority over the functions - addData() - setAggregatorPublicKey() Any compromise to the `aggregator` account may allow the hacker to take advantage of this authority and - add the aggregated data of the latest epoch - set the public key of the aggregator In the contract `PriceOracle` the role `admin` has authority over the functions - setGuardians() - setWhiteList() - deleteWhiteList() Any compromise to the `admin` account may allow the hacker to take advantage of this authority and - set guardian addresses - add a new address to the whitelist - remove an address from the whitelist In the contract `PriceOracle` the role `guardian` has authority over the functions - setPrice() Any compromise to the `guardian` account may allow the hacker to take advantage of this authority and - set price for assets In the contract `WemixfiLendingOracle` the role `MasterAdmin` has authority over the functions - setOracle() - setMasterAdmin() - removeOracle() Any compromise to the `MasterAdmin` account may allow the hacker to take advantage of this authority and - set a new price oracle for an asset - transfer the `MasterAdmin` role to a new account - remove the price oracle of an asset

HighCentralized Control of Contract UpgradeOpen

The owner can upgrade the upgradeable contracts without the community's commitment. If an attacker compromises the account, he can change the implementation of the contract and drain tokens from the contract.

HighUnsecured Borrowers Can Borrow Assets Without LimOpen

The `borrowAllowed()` function checks if the account should be allowed to borrow the underlying asset of a specified market. However, it does not perform the check for unsecured borrowers in the `isUnsecuredBorrower` map, thus allowing them to borrow an unlimited amount of assets without any collateral. Furthermore, if an unsecured borrower account is compromised, all assets in the market could be drained.

MediumPotential Reentrancy AttackOpen

The following codes in the function `redeemFresh()/borrowFresh()` do not meet the Checks-Effects-Interactions pattern. ```solidity=391 vars.actualBorrowAmount = doTransferOut(borrower, borrowAmount); vars.borrowPrincipalNew; accountBorrows[borrower].principal = vars.accountBorrowsNew; accountBorrows[borrower].interestIndex = borrowIndex; totalBorrows = vars.totalBorrowsNew; vars.borrowPrincipalNew = borrowPrincipal[borrower] + vars.actualBorrowAmount; borrowPrincipal[borrower] = vars.borrowPrincipalNew; ``` It only has a reentrancy lock as there is no lock at the Controller level, only the CToken level. If the `CToken` is an ERC777/ERC677 protocol, the reentrancy can happen in function levels of an ERC777/ERC677-based contract, i.e. multiple function calls that are triggered by the hook mechanism of ERC777/ERC677. This issue is possible to happen with all compound forks, but Compound is not affected as they do not list tokens with callback functionality.

LowFunction `setMasterAdmin` not remove old master aOpen

The `setMasterAdmin()` function transfers the master admin role to a new account and grants it the service admin role. The previous master admin, on the other hand, is not removed from the `isServiceAdmin` map and still retains the service admin role.

LowThird-Party DependenciesOpen

The contract is serving as the underlying entity to interact with third-party `feeders` and `aggregator`. 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 manipulated prices and lost assets.

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 (24)

  • src/oracle/PriceOracle.sol
  • src/lending/InterestRateModel.sol
  • src/MultiSigWallet.sol
  • src/lending/Maximillion.sol
  • src/lending/IERC20.sol
  • src/oracle/WemixfiLendingOracle.sol
  • src/lending/TransactionHelper.sol
  • src/lending/CEther.sol
  • src/oracle/common/IDataCollector.sol
  • src/lending/CToken.sol
  • src/lending/ControllerInterface.sol
  • src/Donkey.sol
  • src/lending/Error.sol
  • src/views/WemixfiLendingView.sol
  • src/lending/CErc20.sol
  • src/common/upgradeable/Initializable.sol
  • src/lending/CTokenInterface.sol
  • src/views/ControllerView.sol
  • src/oracle/common/DataCollector.sol
  • src/common/ExponentialNoError.sol
  • src/lending/ControllerStorage.sol
  • src/views/WemixfiLendingViewInterface.sol
  • src/common/upgradeable/AddressUpgradeable.sol
  • src/lending/Controller.sol

Part of WEMIX’s security record

WEMIX
Audits75 audits by 1 firmLast audit Feb 2025, by CertiK.
Critical findingsNo open critical findingsAcross the 75 reports, 17 critical findings were reported. Each is marked fixed by the firm that reported it.
Open WEMIX’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 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