Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix BYLOSports Wemix3.0 Mainnet - Retainer 30) on 28 Jun 2023: 14 findings, 0 critical; 3 marked fixed, 11 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 | 1 |
| Medium | 0 | 0 | 0 |
| Low | 9 | 0 | 2 |
In the contract `RoleManager` the role `role` has authority over the following function: - renounceRole() Any compromise to the `role` account may allow the hacker to take advantage of this authority and renounce corresponding privileges to functions within other contracts. ----------- In the contract `RoleManager` the role `adminRole` has authority over the following functions: - setRoleAdmin() - grantRole() - revokeRole() - renounceRole() Any compromise to the `adminRole` accounts may allow the hacker to take advantage of this authority and grant associated role to any account, revoke the role from any account, and renounce the role. ----------- In the contract `ExecuteManager` the role `setterRole` has authority over the following functions: - changeExecutability() - changeExecutabilityBelongContract() Any compromise to the `setterRole` accounts may allow the hacker to take advantage of this authority and modify important variables. ----------- In the contract `BYLOSports` the role `executeManager` has authority over the following functions: - enter() - reward() Any compromise to the `executeManager` account may allow the hacker to take advantage of this authority and pause or unpause the `enter()` and `reward()` functions. ----------- In the contract `BYLOSports` the role `defaultOwner` has authority over the following functions: - withdrawCharge() - changeValidator() - setVault() - setCoolTime() Any compromise to the `defaultOwner` account may allow the hacker to take advantage of this authority and set important variables, withdraw tokens from the contract, and transfer tokens from `vault`. ----------- In the contract `BYLOSports` the role `validator` has authority to provide signatures, enabling users to interact with the following functions: - enter() - settle() - reward() Any compromise to the `validator` account may allow the hacker to take advantage of this authority and withdraw tokens from this contract and the `vault` address.
In the contract `GameToken`, the role `navigator` has the authority to mint an arbitrary amount of tokens to an arbitrary address. Any compromise to the `navigator` account may allow a hacker to take advantage of this authority and mint a huge amount of tokens to themselves. The hacker could sell those tokens and cause the token price to drop.
The comments for the `withdrawCharge()` function indicate its purpose is for the owner to "get remain reward" from winning events. However, in practice, this function withdraws the betting amount, not the reward. Additionally, it can be utilized to withdraw tokens from losing events as well. ```solidity=189 /** * @dev External function to withdraw * Withdraws the amount of the event ID from which the reward was not received by user to another address * @param to address of get remain reward * @param eventID ID of user don't received event */ function withdrawCharge( address to, bytes32 eventID ) external onlyOwner { require(betInfo[eventID].isSettled, "BYLOSports: event is not settled yet"); require(!betInfo[eventID].taken, "BYLOSports: user already received"); require(betInfo[eventID].amount > 0, "BYLOSports: event non-existence"); betInfo[eventID].taken = true; require(_token.transfer(to, betInfo[eventID].amount), "BYLOSports: withdraw error"); } ```
There should always be events emitted in the sensitive functions that are controlled by centralization roles.
The `_removeListElement()` function within the contract is designed to remove an account from a specific role's list. However, the function is not correctly removing the index from the `_registIndex` mapping.
Addresses are not validated before assignment or external calls, potentially allowing the use of zero addresses and leading to unexpected behavior or vulnerabilities. If critical roles are assigned to a zero address, it could result in permanent loss of those roles. ```solidity=80 _validator = validator; ``` - `validator` is not zero-checked before being used. --- ```solidity=18 navigator = navigator_; ``` - `navigator_` is not zero-checked before being used.
Signed messages are not properly verified with the current chain ID, thus allowing attackers to perform replay attacks across chains. Hardcoded or cached chain ID values are also vulnerable since a hard fork may occur and change the chain ID in the future.
The `settle()` function is utilized for settling events, determining the winners and losers. However, that there might be an inconsistency in this function, specifically with the `totalReward` parameter. This parameter represents the total reward amount to be distributed among winners, yet the individual reward for each event is not considered within the function. This could lead to a discrepancy where the `totalReward` does not accurately represent the actual reward amount.
In the existing design, users place bets by transferring tokens into this contract and also claim their rewards from the contract. However, there might be two potential risks. Specifically, if the contract's balance is insufficient, users may not be able to claim their rewards. Furthermore, if the amount of the bet is larger than the rewards, the excess tokens could potentially be locked within the contract.
The `settle()` function in the current implementation may require a transfer of tokens from the vault to this contract. If the balance in the vault is not sufficient to cover this transfer, the `settle()` function could potentially revert, which would prevent the correct settlement of events.
The `_registIndex` mapping records the index of an element in the `_roleList[_role]` array. However, if the index is 0, it does not distinguish whether the element exists in the `_roleList[_role]` array. This is due to the default behavior of Solidity mappings, where querying a non-existent key returns a zero value. As a result, for accounts that do not exist in `_roleList[_role]`, the value of `_registIndex[_role][_account]` is also 0.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (4)
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