CertiK reviewed Superbots on 31 Mar 2023: 25 findings, 0 critical; 15 marked fixed, 10 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 | 4 | 0 | 1 |
| Medium | 0 | 0 | 3 |
| Low | 6 | 0 | 11 |
In the contract `MasterSuperVault` 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 users' assets may suffer loss. 
In the contract `Vault` the role `strategist` has authority over the functions shown in the diagram below. The `strategist` is specified by the `addrGenerator` when the vault is generated. The `addrGenerator` is specified by the owner of the vault factory. Any compromise to the `strategist` account may allow the hacker to take advantage of this authority and users' assets may suffer loss. 
Flash loans are a way to borrow large amounts of money for a certain fee. The requirement is that the loans need to be returned within the same transaction in a block. If not, the transaction will be reverted. An attacker can use the borrowed money as the initial funds for an exploit to enlarge the profit and/or manipulate the token price in the decentralized exchanges. We find that the contracts `MasterSuperVault` and `Vault` use `UniswapRouterV2(pancakeRouter).getAmountsOut()` which relies on price calculations that are based on-chain, meaning that they would be susceptible to flash-loan attacks by manipulating the price of given pairs to the attacker's benefit and getting more share tokens. The issue VAU-02 describes the situation when flash loan attacks can happen on `Vault.poolSize()` function. The `MasterSuperVault.poolSize()` can always be attacked by flash loan.
The function `deposit()` will transfer the `capitalToken` from the depositor, but directly call the function `depositQuote()` in the contract `VaultV2` to transfer `quoteToken` without swapping the `capitalToken` to the `quoteToken`. Similarly, the function `withdraw()` will call the function `withdrawQuote()` in the contract `VaultV2` to get the `quoteToken`, but directly transfer the `capitalToken` to the withdrawer without swapping the `quoteToken` back to the `capitalToken`. These two functions will fail because of the missing swap logic.
The SuperBots protocol is acting as an investment project, where the users deposit different tokens into the different `vaults`. Then the `strategist` and `whiteListed user` of each `vaults` will swap between two given tokens `quoteToken` and `baseToken`. The users will get a number of share tokens based on the deposit amount, total shares, vault balance, and get the corresponding amount of tokens according to the share amount. In the contract `MasterSuperVault`, the users will invest `capitalToken` and the protocol will divide the investment fund into 5 equal portions and invest into 5 vaults. The user gets a different share token and can use it to withdraw the investment principle and profit. And then, there are some questions: 1. The only investment strategy of the contract `Vault` is swapping between `quoteToken` and `baseToken` in two different platforms `UniswapRouterV2` or `IOneInchAggregationRouterV4`. The swapping amount is always the total balance. Plus that the protocol will also charge deposit, withdraw, trade and perf(profit) fees. Why do the users not use the platform `UniswapRouterV2` or `IOneInchAggregationRouterV4` directly for token swap? 2. In the contract `Vault`, there are two kinds of tokens: `quoteToken` and `baseToken`. When the value of `position` is 0, `quoteToken` is used and the user deposited `baseToken` will be swapped to the `quoteToken`. When the value of `position` is 1, `baseToken` is used and the user deposited `quoteToken` will be swapped to the `baseToken`. Thus, although the users can choose which token to invest in, they cannot control which token they will get in the `withdraw()` function. The users will get `quoteToken` when `position` is 0 and `baseToken` when `position` is 1. This difference between invest and harvest tokens may be against the users' intention. In addition, the function `buy()` and `sell` can just inverse the current `Vault` by changing the `position` value and swapping all the `quoteToken/baseToken` to `baseToken/quoteToken`. The contract `MasterSuperVault` may provide a better way, in which the user will invest `capitalToken` and harvest `capitalToken`. 3. The above-mentioned `capitalToken` `quoteToken` and `baseToken` are unknown. Thus, their implementation is uncertain and may not support the current functionality well. In version 2, most of the swap operations use Chainlink as a price reference to set a maximum slippage. The profit is also accumulated by token swapping with the `0x Aggregator` instead of the `One Inch Aggregator`. Also, the current `_activeVaults` can be updated and the investment assets at old vaults will be distributed equally to the new `_activeVaults`.
In the contract `Vault` and `MasterSuperVault`, each function may swap tokens multiple times and charges fees. Also, some of the fee charging functions like `takeTradingFees()`, `takePerfFees()`, `takePerfFeesFromBaseToken()` may also perform token swap. Some of the tokens are swapped and then burned out. This will cost lots of gas and may have gas waste.
The variables `pctDeposit`, `pctWithdraw`, `pctTradUpbots`, `pctPerfAlgoDev`, `pctPerfPartners` do not have reasonable boundaries, so they can be given arbitrarily values after deploying.
A sandwich attack might happen when an attacker observes a transaction swapping tokens or adding liquidity without setting restrictions on slippage or minimum output amount. The attacker can manipulate the exchange rate by frontrunning (before the transaction is attacked) a transaction to purchase one of the assets and make profits by back running (after the transaction is attacked) a transaction to sell the asset. The following functions are called without setting restrictions on slippage or minimum output amount, so transactions triggering these functions are vulnerable to sandwich attacks, especially when the input amount is large: - `_swapPancakeswap()` in the contract `MasterSuperVault` and `Vault`, which will call the `UniswapRouterV2(pancakeRouter).swapExactTokensForTokens()` function.
The contract is serving as the underlying entity to interact with one or more third party protocols. The scope of the audit treats third party entities as black boxes and assume 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, such as increasing fees of third parties, migrating to new LP pools, etc. ```solidity address public constant pancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E; ``` - The contracts `MasterSuperVault` and `Vault` interact with third party contract with `UniswapRouterV2` interface via `pancakeRouter`. --- ```solidity address public constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c; ``` - The contracts `MasterSuperVault` and `Vault` interact with third party contract with `wbnb` token via `wbnb`. --- ```solidity address public constant ubxt = 0xBbEB90cFb6FAFa1F69AA130B7341089AbeEF5811; ``` - The contracts `MasterSuperVault` and `Vault` interact with third party contract with `IERC20` interface via `ubxt`. --- ```solidity address public oneInchRouterAddr; ``` - The contract `Vault` interacts with third party contract with `IOneInchAggregationRouterV4` interface via `oneInchRouterAddr`. --- - The contract `VaultV2` interacts with third party contract `UniswapRouterV2`, `0x aggregator`, `Chainlink`, etc.
The tokens `capitalToken`, `quoteToken` and `baseToken` are initialized in the functions `MasterSuperVault.constructor()` function and `VaultFactory.generateVault()`. Thus, the correctness of the `token` address and the actual token implementations are all uncertain.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (11)
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