Part of CertiK’s retainer series
CertiK reviewed WEMIX (WeMix - Nile Contract Audit) on 8 Feb 2023: 58 findings, 5 critical; 43 marked fixed, 15 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 | 5 |
| High | 7 | 0 | 8 |
| Medium | 2 | 0 | 18 |
| Low | 6 | 0 | 12 |
In the contract `Furnace`, the role `Editor` has authority over the functions - changeDAORouter() - changeBuyProbability() - changeBuyAmount() - changeUnit() Any compromise to the `Editor` account may allow the hacker to take advantage of this authority and - change the address of DAORouter - change buy probability - change the buy amount - change unit In the contract `NILEComponent`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and change the address of FundRouter. In the contract `ContractFactory`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and deploy DAO/Governance token. In the contract `Payment`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and init `SpellRegistry`, `Station`, `Furnace`, `Governance`, and `Treasury` addresses. In the contract `PteRegistry`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and register/change the address of Pte. In the contract `SpellRegistry`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and add/remove/change the address of Spell. In the contract `EditorRole`, any compromise to the `_owner` account may allow the hacker to take advantage of this authority and add/remove the address of the Editor. In the contract `MakerRole`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and add/remove the address of the Marker. In the contract `RouterRole`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and add/remove the address of the Router. In the contract `SystemRole`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and add/remove the address of the System. In the contract `DAORouter`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and init `SpellRegistry`, `Station`, `Furnace`, `StakingPool`, `Governance`, `WemixFi`, `WemixFiRouter`, `PteRegistry`, `Payment` and `Trust` addresses. In the contract `FundRouter`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and init `SpellRegistry`, `Station`, `Furnace`, `Verify`, `ReOpen`, `Treasury`, `Payment` and `Trust` addresses. In the contract `FundRouter`, any compromise to the `Pte` account may allow the hacker to take advantage of this authority and deposit funds. In the contract `FundRouter`, any compromise to the `System` account may allow the hacker to take advantage of this authority and purchase DAO tokens. In the contract `ReOpen`, any compromise to the `Maker` account may allow the hacker to take advantage of this authority and check the success or failure after DAO the recruitment fund ends. In the contract `ReOpen`, any compromise to the `_owner` account may allow the hacker to take advantage of this authority and change the denominator. In the contract `Station`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and init `StakingPool`, `PteRegistry`, `Treasury`, and `Governance` addresses. In the contract `Station`, any compromise to the `Maker` account may allow the hacker to take advantage of this authority and - create a new DAO - check the success or failure after DAO recruitment end - change the currency type In the contract `Station`, any compromise to the `_owner` account may allow the hacker to take advantage of this authority and change the unit. In the contract `Station`, any compromise to the `Editor` account may allow the hacker to take advantage of this authority and change the `Router` address. In the contract `UniswapV2Factory`, any compromise to the `FeeToSetter` account may allow the hacker to take advantage of this authority and change the `FeeTo`/`FeeToSetter` address.
[Governance] and [StakingPool] are upgradeable contracts, the owner can upgrade the contract 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.
There's currently no time lag enforced between the creation of an agenda and the start of the voting period. A user can create an agenda and vote on the agenda in the same block. This creates the opportunity for double voting, in which user Alice creates an agenda, immediately vote on it, and then transfer all her governance token to an affiliated user Bob in the same block. Bob can then vote on the same agenda using the governance token received, because Bob's token balance at the time the agenda is created is the same as Alice's original governance token balance.
The `GovernanceToken` inherits the `ERC20Votes` contract, in which the voting power is moved after token transfers. The `DAORouter` contract calculates each user's voting power based on the `getVotes(user)` function of the `GovernanceToken`, which retrieves the voting power in the most recent checkpoints. Therefore, it is possible for a user to use flash loan to borrow `GovernanceToken`, and call `createAgenda()`, and then return the flash loan. By doing so, the user can circumvent the minimum threshold to create an agenda in the `require()` statement below: ```soliidty=179 require(quorumRatio <= (gUserVote * denominator) / gTotalVote , "DAORouter(GV): User does not have permission to create agenda"); ``` Additionally, the user can also call `vote()` right after calling `createAgenda()` and before returning the flash loan, in order to manipulate the voting outcome.
The comment says `//lock transfer user to user and user to staking pool`. But in the actual code, token/vote can be transferred from user to user if `_isAllowedDelegate` is `false`. Thus token/vote transfer can be done among any EOA. For example, user Bob can create agendas, if Bob transfers tokens to Alice, then Alice has access to create agendas.
The function `isSameVote()` returns `true` if the user does not vote or revote. If a user calls the function `vote()` multiple times with the same answer, then the check of on line 217 passes. The votes of the user and the total votes will keep increasing via the function `_vote()`. So the user can keep voting until the agenda is passed. ```solidity=374 function _vote(uint daoId, uint agendaId, address user, VoteType opinion, uint num) private { Agenda memory proposal = _agendas[daoId][agendaId]; uint voteStatus = uint(proposal.status); VoteStatus storage board = _agendas[daoId][agendaId].board[voteStatus]; board.total += num; board.voteBox[uint(opinion)] += num; VoteInfo storage voteInfo = _voters[user][daoId][agendaId][voteStatus]; voteInfo.vote = opinion; voteInfo.num = voteInfo.num + num; emit Voted(daoId, agendaId, opinion, num); } ```
This contract is used when additional recruitment is made by DAOs already generated through the Station Contract. Additional recruitment starts only through the agenda proposed by governance, and the subsequent recruitment flow is the same as when initially recruited by Station. But there is no function to receive DAO tokens for the users who enter the reopen recruitment.
The `ranChar` and `ranNum` in vrf are not verified at all against vrf parameters. So they can be manipulated with arbitrary values to bypass the probability check.
If the first token in token collection has a zero balance, the code `i -= 1;` will underflow and cause 'liquidate()' to revert unintendedly.
In the function `_cancel()`, the `totalEnterAmount` decreases the user's amount, and the `enterCount` decreases by 1. However, the function `_refund()` only reduces the user's amount and does not update `enterCount`. The function `_reOpenRefund()` in the contract `ReOpen` has the same issue.
If the value of `totalSupply` is 0, the following two division operations will fail due to the divide by 0 error, which ultimately make the invocation to `burn()` function fail. ```solidity=149 amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution ```
When transferring standard ERC20 deflationary tokens, the input amount may not be equal to the received amount due to the charged transaction fee. As a result, an inconsistency in the amount will occur and the transaction may fail due to the validation checks.
The `isContract()` function can not be used to decide whether an address is EOA because when it returns false, the address can either be EOA or contract in construction. See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol
The project assumes that the Pte would deposit fund and distribute revenue via the `deposit()` function. However, the Pte does not have to call the `deposit()` function, or it can deposit an amount that does not represent the business revenue generated. There does not appear to be any collateral required from the Pte either, potentially allowing the Pte that has received funds from the protocol to run away with it without any consequences.
The code base contains external function calls with unknown implementation, such as the below. The scope of the audit treats contracts that are out of scope, unknown implementation of interfaces, and other dependencies as black boxes and assumes their functional correctness. However, in the real world, these out of scope contracts can be compromised, potentially causing major vulnerability for the project. ```solidity=275 require(IVRF(_vrfVerify).verify(_publicKey, _proof, _seed), "FundRouter: invalid VRF"); ```
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (47)
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