Wemix Retainer 87 NightCrow

CertiKFiles named in the report

Audit

Part of CertiK’s retainer series

CertiK reviewed WEMIX (Wemix Retainer 87 NightCrow) on 2 Feb 2024: 8 findings, 0 critical; 4 marked fixed, 4 open.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings8

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

SeverityOpenAcknowledgedFixed
Critical000
High100
Medium000
Low304
HighCentralization RisksOpen

In the contract `NightCrowBase` the role `setterRole` and the owner has authority over the function `setRoleManager()`. Any compromise to the `setterRole` account may allow the hacker to take advantage of this authority and change the address of `roleManager`. In the contract `NightCrowUnaBase` the role `setterRole` and the owner has authority over the function `setNightCrowEcho()`. Any compromise to the `setterRole` account may allow the hacker to take advantage of this authority and change the address of `nightCrowEcho`. In the contract `NightCrowFT` the role `minterRole` and the owner has authority over the function `mint()`. Any compromise to the `minterRole` account may allow the hacker to take advantage of this authority and mint any amount of tokens to any address. In the contract `NightCrowNFT` the role `validatorRole` has authority or can provide signatures for the following functions: - `mintItemByValidator()`, to mint an NFT token - `setServerSelf()`, to set the server of an NFT token Any compromise to the `validatorRole` account may allow the hacker to take advantage of this authority. In the contract `NightCrowNFT` the role `minterRole` and the owner have authority or can provide signatures for the following functions: - `mint()`, to mint an NFT token - `mintAuto()`, to mint an NFT token Any compromise to these accounts may allow the hacker to take advantage of this authority. In the contract `NightCrowEcho` the role `executorRole` has authority over the function `echo()`. Any compromise to the `executorRole` account may allow the hacker to take advantage of this authority and emit an event from the una-game-engine to collect the exchange information of the items and tokens. In the contract `Una721` the owner and the role `minterRole` have authority over the following functions: - `mint()`, to mint `tokenId` and transfers it to `to` address - `mintAuto()`, to mint `generateId()` and transfer it to `to` address Any compromise to the owner and the `minterRole` accounts may allow the hacker to take advantage of this authority. In the contract `NightCrowFTExchanger` the role `setterRole` has authority over the following functions: - `setRecipientRole()`, to change the address of `recipientRole` which will receive game item for all - `registFunctionSelector()`, to set the `_functionSelectors`. Any compromise to the `setterRole` account may allow the hacker to take advantage of this authority. In the contract `UnaNFTCrossMinter` the role `minterRole` has authority or can provide signatures for the functions `mintCross()` and `mintCrossByValidator()`. Any compromise to the `minterRole` account may allow the hacker to take advantage of this authority. In the contract `UnaNFTCrossMinter` the roles `setterRole` and the owner have authority over the following functions: - `setRoleManager()`, to set `roleManager` - `setUnaBridge()`, to set `unaBridge` - `setUnaMetaHash()`, to set `unaMetaHash` - `setWrappedCoin()`, to set `wrappedCoin` - `setLINK()`, to set `link` Any compromise to these roles may allow the hacker to take advantage of this authority. In the contract `ExchangePolicy` the role `EDITOR` has authority over the following functions: - `updatePolicy()`, to update the period and change remaining token amount per user and total remaining token amount if the registered period has passed. - `setLastUpdatedBlock()`, to record the latest block number at which the contract was updated. In the contract `ExchangePolicy` the role `SETTER` has authority over the following functions: - `setExchangePolicy()`, to register the initial token exchange information. - `setDeadlineGap()`, to update deadline gap, that is the period for which user requests are considered valid on a per-chain basis. - `changeRoleManager()`, to change the `RoleManager` contract. Any compromise to the `EDITOR` and `SETTER` accounts may allow the hacker to take advantage of this authority. In the contract `GamePolicy` the role `EDITOR` has authority over the following function: - `updatePolicy()`, to update core policy In the contract `GamePolicy` the role `SETTER` has authority over the following functions: - `setPolicy()`, to register the policy contract name. - `setCheckFuncSig()`, to register the view function signatures to validate the requests for each policy. - `setUpdateFuncSig()`, to register the function signatures that need to be updated after the execution of requests for each policy. - `changeRoleManager()`, to change the `RoleManager` contract. Any compromise to the `EDITOR` and `SETTER` accounts may allow the hacker to take advantage of this authority. In the contract `PricePolicy` the role `SETTER` has authority over the following functions: - `setLimitPrice()`, to registers the price to be used as the criterion for determining whether it is a valid price. - `setPriceOracle()`, to register tokens's oracle contract. - `changeRoleManager()`, to change the `RoleManager` contra

LowCross chain exchange dependencyOpen

The logic to ensure the cross-chain transaction atomicity is not implemented in the contract but in the offchain server host by the owner. "Tokens are distributed to the chain forming the unagi (ex. WEMIX3.0, KROMA, Polygon...) and can be exchanged for game items in the offchain through the NightCrowFTExchange contract. The inspection required for the exchange(exchange limit, exchange cycle inspection, etc.) is inspected through db information on our separate server before the transaction occurs, and another server reads the events of the NightCrowEcho contract that occur during the exchange transaction and updates the Policy contract or db." The scope of the audit treats the above-mentioned application entities as black boxes and assumes their functional correctness. However, in the real world, 3rd parties can be compromised, which may lead to lost or stolen assets. Suppose the cross-chain transaction atomicity is not guaranteed properly. In that case, the user deposits tokens into the source chain, but not be able to redeem the correct token amount from the target chain.

LowMinting Conflict between `mintAuto()` and `mint()Open

In the `Una721` contract, the `mintAuto()` function is intended for auto-incremented token minting, generating a new `tokenId` based on `code + _lastId`. However, the `mint()` function allows a minter with the appropriate role to mint tokens with any specified `tokenId`, including those that would be auto-generated by `mintAuto()`. This overlap creates a scenario where a token minted through `mint()` with a specific `tokenId` can prevent `mintAuto()` from minting subsequent tokens, as `mintAuto()` relies on a sequential `tokenId` generation mechanism and minting a token with existing token id would be reverted. ```solidity=241 function _mintAuto( address to, string calldata _tokenURI ) internal virtual nonRisk(this.mintAuto.selector, to) { _lastId++; uint tokenId = generateId(_lastId); _mint(to, tokenId, _tokenURI); } ``` ```solidity=209 function generateId(uint id) public view returns (uint tokenId) { require(id < unit, "Una721: mint count is over"); tokenId = code + id; } ``` ```solidity=55 function mint( address to, uint tokenId, string calldata _tokenURI ) public virtual override onlyMinter nonRisk(this.mint.selector, to) { _mint(to, tokenId, _tokenURI); } ```

LowOut of Scope DependencyOpen

The contracts import several out-of-scope contracts **IPriceOracle**,**ICorePolicy**,**IContractRegistry**,**Converter**,**IRoleManager**,**IRecipientRole**. The scope of the audit treats out-of-scope contracts as black boxes and assumes their functional correctness. However, in the real world, out-of-scope contracts can be compromised and this may lead to lost or stolen assets. ```solidity interface IPriceOracle { function getTwapPriceBySymbol(string memory symbol) external view returns (uint); } ``` ```solidity ICorePolicy(contractRegistry .contractsAddress(_policies[0])).setLastUpdatedBlock(chainId, blockNumber); ``` ```solidity IContractRegistry public contractRegistry; ``` ```solidity using Converter for string; ``` ```solidity return IRoleManager(roleManager).hasRole(role, addr); ``` ```solidity abstract contract NightCrowUnaBase is NightCrowBase, VerifyKey { ``` ```solidity bool isRegistered = recipientRole.isRegistered(tokenAddr, _data.service); ``` This audit treats out-of-scope dependencies as black boxes and assumes their functional correctness.

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

  • projects/UnaCore/contracts/token/Una721/Una721.sol
  • projects/NightCrow/contracts/base/NightCrowBase.sol
  • projects/NightCrow/contracts/util/INightCrowFTExchanger.sol
  • projects/NightCrow/contracts/policy/option/PricePolicy.sol
  • projects/NightCrow/contracts/token/nft/base/NightCrowNFT.sol
  • projects/NightCrow/contracts/policy/GamePolicy.sol
  • projects/NightCrow/contracts/policy/core/CapManager.sol
  • projects/NightCrow/contracts/policy/core/ExchangePolicy.sol
  • projects/NightCrow/contracts/util/INightCrowEcho.sol
  • projects/UnaCore/contracts/util/IUnaNFTCrossMinter.sol
  • projects/NightCrow/contracts/base/NightCrowUnaBase.sol
  • projects/NightCrow/contracts/token/ft/base/NightCrowFT.sol
  • projects/NightCrow/contracts/policy/option/IPricePolicy.sol
  • projects/NightCrow/contracts/token/ft/base/INightCrowFT.sol
  • projects/NightCrow/contracts/token/nft/base/INightCrowNFT.sol
  • projects/NightCrow/contracts/util/NightCrowEcho.sol
  • projects/UnaCore/contracts/util/UnaNFTCrossMinter.sol
  • projects/NightCrow/contracts/util/NightCrowFTExchanger.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