Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix Retainer 103 KLEVA Omni) on 2 Apr 2024: 23 findings, 0 critical; 14 marked fixed, 9 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 2 | 0 | 3 |
| Medium | 1 | 0 | 2 |
| Low | 6 | 0 | 9 |
In the contract `KlevaDistributor` the role `_keeper` has authority over the functions shown in the diagram below. Any compromise to the `_keeper` account may allow the hacker to take advantage of this authority and set `beforeKlevaPerSec`, `nextKlevaPerSec`, `nextKlevaPerSecAt`, `feeRate`, create a new pool and update the `allocPoint` for pool.  In the contract `KlevaDistributor` the role `_notifier` has authority over the functions shown in the diagram below. Any compromise to the `_notifier` account may allow the hacker to take advantage of this authority and add user's share and remove user's share.  In the contract `KlevaDistributor` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set `klevaConfig` address and `maxKlevaPerSec`.  In the contract `KlevaDistributor` the role `_userorkeeper` has authority over the functions shown in the diagram below. Any compromise to the `_userorkeeper` account may allow the hacker to take advantage of this authority and claim rewards.  In the contract `KlevaLocker` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set `klevaConfig` address and withdraw the balances of any account.  In the contract `KlevaToken` the role `_minterrole` and `klevaDistributor` has authority over the functions shown in the diagram below. Any compromise to the `_minterrole` account may allow the hacker to take advantage of this authority and mint tokens for any address and burn tokens from any address.  In the contract `KlevaToken` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set `klevaConfig` address, set name and symbol of token and pause/unpause the contract.  In the contract `Dashboard` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set `klevaConfig` address.  In the contract `FeeBox` the role `_keeper` has authority over the functions shown in the diagram below. Any compromise to the `_keeper` account may allow the hacker to take advantage of this authority and distribute fees and set fee receiver list.  In the contract `FeeBox` the role `_notifier` has authority over the functions shown in the diagram below. Any compromise to the `_notifier` account may allow the hacker to take advantage of this authority and transfer fee tokens to this contract.  In the contract `FeeBox` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set `klevaConfig` address.  In the contract `KlevaConfig` the role `_keeper` has authority over the functions shown in the diagram below. Any compromise to the `_keeper` account may allow the hacker to take advantage of this authority and sync all contract's address. ` which is used to set fee percent. It is possible to set the total fee up to 100%. ```solidity=121 function setFeeRate(uint256 feeRate_) external onlyKeeper { require(feeRate_ <= 1e4, "KlevaDistributor: Invalid feeRate"); harvestAll(); feeRate = feeRate_; emit DevFeeRateSet(feeRate); } ``` ```solidity=196 function setProtocolFeeRate(uint256 pid_, uint256 protocolFeeRate_) external onlyKeeper { require(isValid(pid_), "EarnRouter: Invalid pid"); require(protocolFeeRate_ <= 1e4, "EarnRouter: Invalid protocolFeeRate"); _updateShare(pid_); _poolInfos[pid_].protocolFeeRate = protocolFeeRate_; emit ProtocolFeeRateSet(pid_, protocolFeeRate_); } ```
Not all `IERC20` implementations `revert` when there's a failure in `approve`. The function signature has a `boolean` return value and they indicate errors that way instead. By not checking the return value, operations that should have been marked as failed may potentially go through without actually approving anything.
The function `addPoolName()` only checks whether `poolName` has a pool ID. This means the keeper can set a different pool name for the same pool ID, and the pool ID can be set to any value, including a non-existent ID. ```solidity=173 function addPoolName(string calldata poolName_, uint256 pid_) external onlyKeeper { require(poolNameToId[poolName_] == 0, "EarnRouter: poolName already has pid"); poolNameToId[poolName_] = pid_; emit PoolNameAdded(pid_, poolName_); } ```
According to the KlevaConfig contract, the owner can set a new `_klevaDistributor`. However, there might be claimable rewards not harvested and shares not migrated from the old `_klevaDistributor`. It's better to have complete migration logic before changing the config of `_klevaDistributor`.
In the contract `KlevaLocker`, users can transfer `klevaToken` tokens to this contract and increase other accounts' balances. If the keeper adds a `KlevaLocker` pool, users deposit 100 `klevaToken` tokens to this pool, and `earnRouter`'s balance is 100. Another user calls the function `depositBehalf()` to increase `earnRouter`'s balance to 150. Therefore, the user can see 150 withdrawable from the function `getEarnPoolUserInfo()`, but they only withdraw 100, leading to confusion.
The contract is serving as the underlying entity to interact with one or more third party protocols including `ICToken`, `IKurrencyEarn`,`IKurrencyPriceCalculator`. 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. --- - The contract `WemixfiEarnImpl` interacts with third party contract with `ICToken` interface via `target_`. ```solidity baseToken_ = ICToken(target_).underlying(); ICToken(target_).mint(depositAmount_); ``` --- - The contract `KurrencyEarnImpl` interacts with third party contract with `IKurrencyEarn` interface via `target_`. ```solidity baseToken_ = IKurrencyEarn(target_).WCD(); IKurrencyEarn(target_).stake(depositAmount_); ``` --- - The contract `Dashboard` interacts with third party contract with `IKurrencyPriceCalculator` interface via `kurrencyPriceCalculator`. ```solidity (uint256 lastData, ) = IKurrencyPriceCalculator(kurrencyPriceCalculator).references( klevaToken ); ```
`delegatecall` is an operation that allows a contract to call another contract's function while using the calling contract's storage and context. `selfdestruct` is an operation that destroys the current contract. The usage of these functions in the implementation contract might allow the attacker to either destroy the implementation contract or exploit other vulnerabilities from the misuse of `delegatecall`. However, the external address `implementation_` used in the `_delegate()` function is specified by the `onlyOwner` function `setImplementation()`, hence the possibility of the abovementioned exploit is much lower unless the owner role is compromised.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (43)
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’s auditsSomething 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