Part of CertiK’s retainer series
CertiK reviewed WEMIX (Wemix Retainer 37 (PPP, PlayBridgeV3 )) on 11 Aug 2023: 21 findings, 1 critical; 13 marked fixed, 8 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 | 1 |
| High | 3 | 0 | 0 |
| Medium | 1 | 0 | 2 |
| Low | 4 | 0 | 10 |
In the contract `WemixBridgeStorageV2` 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 the bridge contract to a malicious implementation through `setBridgeAddress`. - Withdraw tokens and coins locked in the bridge. Since the bridge will transfer locked assets to the `WemixBridgeStorageV2` contract, these privileged functions allow the attacker to rug pull locked asset in the bridge. 
In the contract `WemixBridgeV3` the role `_editor` has authority over the functions shown in the diagram below. Any compromise to the `_editor` account may allow the hacker to take advantage of this authority and - lock/unlock token - change the fee rate to Owner percentage - update the address of bridge storage contract. **The current architecture of the system leverages a bridge storage contract where all internal state variables are stored and tracked. It is important to note that any incorrect settings or misconfigurations in this contract could lead to catastrophic system failure.** **Misconfiguration or improper manipulation of storage contract can result in a full shutdown of all bridge services, halting the system's functionality and lock of users' asset.**  In the contract `WemixBridgeV3` 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 - pause/unpause the contract - add supported tokens to bridge - remove supported tokens from the bridge - withdraw tokens/coins from the bridge - approve `recipient Role` to use the tokens in bridge  In the contract `WemixBridgeV3` the role `_sender` has authority over the functions shown in the diagram below. Any compromise to the `_sender` account may allow the hacker to take advantage of this authority and submit incorrect or forged bridge enter payloads.  **Please note the current bridge implementation relies on the `validator` role to validate parameters of the event(Enter request) from the other side of the bridge. If the validator role get compromised, the attacker can submit arbitrary enter request and drain the asset stored in the bridge.** In the contract `WemixBridgeV3` the role `recipient` has max approval of the bridge contract for all ERC-20 tokens supported. This allows the recipient to not only receive the transferred assets (in `_payCost`) as intended, but also to transfer any leftover ERC-20 token balance to their own address.
In this project, many contracts, such as `UniversalRouter` and `WemixBridgeV3`, extend `AccessContractRegistry.sol` and rely on `ContractRegistry` to provide the contract address references. In the contract `AccessContractRegistry` 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 `contractRegistry` to a malicious implementation.  In the contract `ContractRegistry` 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 incorrect `contractsAddress` record. 
Upon reviewing the existing implementation of `reqAddLiquidity()`, it was observed that the incorporated require checks only confirm the validity of one input token, not both. ```solidity=266 require(addLiqReq.tokens[0] == address(0) || addLiqReq.tokens[1] == address(0) || addLiqReq.tokens[0].isContract() || addLiqReq.tokens[1].isContract(), "PPPRequest: invalid tokens"); ``` To illustrate, if a user inputs a token pair into the `reqAddLiquidity` function, where `tokens[0]` is a valid token and `tokens[1]` is not a valid token contract address (EOA address for example), the function will execute successfully without revert, triggering a ReqAddLiquidity event. As an auditor, we lack insight into the backend server's management of the `ReqAddLiquidity` event and the corresponding PPP request. As a result, we advise seeking confirmation from the development team to ensure that the case highlighted above does not pose potential security risks. Possible vulnerabilities could include bypassing safety checks or initiating incorrect `AddLiquidity` operations on the requested chain.
In PPP contracts, `tx.origin` is used to check if the `***Info.User` is the transaction sender. As mentioned in finding `PPP-01`, the external function `addLiquidity` and `removeLiquidity` do not allow direct calls and can only be called by the `UniversalRouter` or the `Sender` role. Therefore, we recommend the team move the `user` check to the `UniversalRouter` and use the `msg.sender` to verify the user. ```solidity=124 require(addLiqInfo.user == tx.origin || ISenderRoleV2(CA(PPPConfigs.senderRole)).isSender(tx.origin, pppService), "PPPLiquidity: not valid sender"); ``` `tx.origin` check has been deprecated after EIP-3074. EIP3074 introduces two EVM instructions AUTH and AUTHCALL. The first sets a context variable authorized based on an ECDSA signature. The second sends a call as the authorized. This essentially delegates control of the EOA to [a] smart contract. This means there will be a way for smart contracts to send transactions in the context of an Externally Owned Account, thus bypassing this check. **Also tx.origin is widely discourage as there are possible phishing attempts.** For a contract, the `tx.origin` is not transparent. In a simple call chain A->B->C->D, inside D msg.sender will be C, and tx.origin will be A. If the origin is really desired in D, then each of the functions in the contracts B, C, D could take an extra parameter to propagate the origin: A would pass its address (this) to B, B would pass the value to C, and C would pass it to D. `tx.origin` based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract. Hence it's not recommended to use `tx.origin` for authorization in solidity documentation. Refer to: https://docs.soliditylang.org/en/v0.6.12/security-considerations.html#tx-origin
The require check in L125 and L126 requires fund to be transferred from the `UniversalRouter` to the PPP contract, which means only the call from the `UniversalRouter` will be processed. Any direct call of `addLiqudity` will revert. ```solidity=125 require(IERC20(addLiqInfo.swapTokens[0]).transferFrom(CA(PPPConfigs.universalRouter), address(this), addLiqInfo.amounts[0]), "PPPLiquidity: fail to transfer token to router"); require(IERC20(addLiqInfo.swapTokens[1]).transferFrom(CA(PPPConfigs.universalRouter), address(this), addLiqInfo.amounts[1]), "PPPLiquidity: fail to transfer token to router"); ``` Same cases also apply to `removeLiquidity`, `reqSwapIn`, `reqSwapOut`, `reqAddLiquidity`, `reqZapIn`, `swapIn` , `swapOut`, `zapIn` and `zapOut`
Solidity version >=0.8.0 includes checked arithmetic operations and underflow/overflow by default, making SafeMath redundant.
The linked functions are equivalent to the compiler-generated getter functions for the respective variables.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (52)
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