CertiK reviewed Drive Crypto on 21 Nov 2022: 18 findings, 0 critical; 1 marked fixed, 7 acknowledged, 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 | 0 | 4 | 0 |
| Medium | 0 | 3 | 1 |
| Low | 10 | 0 | 0 |
The variables `_maxTxAmount`, `_maxAccountAmount`, `_minAmountToAutoSwap`, and `minTokenHoldToStake` do not have reasonable boundaries, so they can be given arbitrary values after deploying.
The owner account can call the function `safeWithdraw()` to withdraw all ETHs. However, there is no `receive()` or `fallback()` function in the SwapHelper.sol, so this contract cannot receive native tokens.
The admin can call the function `enableToken()` to set the `pauseToken` to false, however, there is no function to set the `pauseToken` to true.
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 function `executeSwap()` rely 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.
The `for` loop within the function `multiTransfer()` takes unbounded arrays' lengths as the maximum iteration times. If the size of the array `users` grows large, iterating through the entire array could be an expensive operation. Even worse, it could exceed the gas limit per block.
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 being attacked) a transaction to purchase one of the assets and make profits by backrunning (after the transaction being 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: ```solidity=337 uint256 wbnbAmount = getAmountOut(totalAmount, reserve1, reserve0); swapToken(liquidityPair, reversed ? 0 : wbnbAmount, reversed ? wbnbAmount : 0, secondaryPairLocal); uint256 wbnbBalanceNew = getTokenBalanceOf(wbnbAddress, secondaryPairLocal); require(wbnbBalanceNew == wbnbBalanceBefore + wbnbAmount, "Wrong amount of swapped on WBNB"); ``` ```solidity=349 uint256 busdAmount = getAmountOut(amountOut, reserve1, reserve0); swapToken(secondaryPairLocal, reversed ? 0 : busdAmount, reversed ? busdAmount : 0, swapHelper); uint256 busdBalanceNew = getTokenBalanceOf(busdAddress, swapHelper); require(busdBalanceNew == busdBalanceBefore + busdAmount, "Wrong amount of swapped on BUSD"); amountOut = busdAmount; ```
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 assumes 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=19 address constant private WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c; // BSC WBNB address constant private BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56; // BSC BUSD ``` ```solidity=88 PancakeRouter router = PancakeRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E); // BSC ``` - The function `DriveCrypto.constructor` interacts with third party contract with `PancakeFactory` interface via `router`.
The return value of the transfer()/transferFrom() call is not checked. ```solidity=12 function safeTransfer(address token, address receiver, uint256 amount) external isWithdrawer { IERC20(token).transfer(receiver, amount); } ```
The return value of an external call is not stored in a local or state variable. ```solidity=11 function safeApprove(address token, address spender, uint256 amount) external isWithdrawer { IERC20(token).approve(spender, amount); } ``` --- ```solidity=11 function safeApprove(address token, address spender, uint256 amount) external onlyOwner { IERC20(token).approve(spender, amount); } ```
The linked variables assigned in the constructor can be declared as `immutable`. Immutable state variables can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they will not be stored in storage.
| Address | Chain | Source code |
|---|---|---|
| 0x61cc…de7d0x61ccf5351d63b36ae2f7f4d0f0f9a65989c1de7d | Chain: BNB Chain | Source code: Verified source |
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