BKOKFi has 2 public audit reports from CertiK; the latest is CertiK, 13 Nov 2024; no critical findings reported. It also holds 2 deployed contracts on 1 chain.
Last updated . It holds audits and findings, contracts and incidents up to Nov 2026. Trustblock does not review code.
Statuses are the security firms’ own
13 findings are still open or acknowledged in the firms’ reports: 1 high, 3 medium, 9 low (all open).
Potential Sandwich Attacks
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Potential Front-run on Permit Call to cause DOS
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Incorrect Fee Calculation Prevents ETH Withdrawal
BKOK · CertiK · 29 Sep 2024 · Report ↗
Potential Concerns Due to Auto Pair Burning Mecha
BKOK · CertiK · 29 Sep 2024 · Report ↗
Emit Mistakenly
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Inaccessible Functions
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Missing Error Messages
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Potential Reentrancy Attack
BKOKLPLock · CertiK · 13 Nov 2024 · Report ↗
Confirmation of Withdrawable ETH Calculation
BKOK · CertiK · 29 Sep 2024 · Report ↗
Missing Input Validation
BKOK · CertiK · 29 Sep 2024 · Report ↗
Newest first
| Report | Security firm | Date | Scope | Critical findings | Findings | Source |
|---|---|---|---|---|---|---|
| BKOKLPLock | Security firm: CertiK | Date: | Scope: 1 address on BNB Chain | None open | Findings: 2 high · 1 medium · 4 low 1 fixed · 6 open | Original removed |
| BKOK | Security firm: CertiK | Date: | Scope: 1 address on BNB Chain | None open | Findings: 2 high · 2 medium · 6 low 3 fixed · 7 open | Original removed |
Statuses are the security firm’s own, from each report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 1 | 0 | 3 |
| Medium | 3 | 0 | 0 |
| Low | 9 | 0 | 1 |
The current design of the `BKOKLPLock` contract lacks a staking period, enabling users to stake and withdraw `LP` tokens at any time. This allows an attacker to monitor the mempool, add liquidity, and stake a substantial amount of `LP` tokens just before an account distributes dividends via the `distributeTokenDividends()` function. By paying a higher gas fee, they can prioritize their transaction, immediately withdraw, and remove liquidity following the dividend distribution. Due to the absence of a staking period, the attacker can execute this operation within a single block, claiming the majority of the dividend. Flashloans can be used to maximize profit. ```solidity function _stake(uint value) private { uint256 balance = dividend.balanceOf(_msgSender()); lpToken.transferFrom(_msgSender(), address(this), value); balance += value; dividend.setBalance(_msgSender(), balance); } function stake(uint value) external { require(value > 0); _stake(value); } ... function withdraw(uint value) external { uint256 balance = dividend.balanceOf(_msgSender()); if (value == 0) { value = balance; } require(balance >= value && value > 0, "value > 0"); balance -= value; dividend.setBalance(_msgSender(), balance); lpToken.transfer(_msgSender(), value); } function distributeTokenDividends() external payable { require(msg.value > 0); try dividend.distributeTokenDividends{value: msg.value}() {} catch { payable(_msgSender()).transfer(msg.value); } try dividend.process(gasForProcessing) {} catch {} } ```
Open the reportContracts interfacing with ERC20 tokens may implement a feature in the `stakePermit()` function where users provide signatures to approve `lpToken` transfers, subsequently invoking the `permit()` function to finalize the approval. However, the contract fails to address the possibility of transaction front-running, where an unauthorized party could preemptively execute the `permit()` function before the intended transaction is processed. If malicious actors observe this process, they can preemptively execute the `permit()` function with the user's signature and nonce. This unauthorized front-running as a griefing attack not only consumes the nonce, rendering the legitimate user's intended transaction invalid but also can lead to a targeted Denial of Service (DOS) for the affected function, as the user's approval process is effectively disrupted. ```solidity function stakePermit( uint value, uint deadline, uint8 v, bytes32 r, bytes32 s ) external { require(value > 0); //Approve lpToken.permit(_msgSender(), address(this), value, deadline, v, r, s); _stake(value); } ```
Open the reportThe `BKOK` token contract contains a logic flaw in the `_transfer` function's fee calculation logic, which inadvertently restricts ETH withdrawals to only those accounts that are excluded from fees. This issue arises from an incorrect computation of the fee, leading to the fee exceeding the transfer amount and causing the transaction to revert due to underflow. The fee is calculated using the formula `(amount * feeBase) / feeTotal`. ```solidity=170 if (!isExcludeFee(from)) { @> uint256 fee = (amount * feeBase) / feeTotal; super._transfer(from, address(this), fee); amount -= fee; } ``` In the contract, the `feeBase` is equal to 10000, and the `feeTotal` is 1500, so the calculated `fee` equates to `(amount * 10000) / 1500 ≈ 6.6667 * amount`. Subtracting a fee larger than the `amount` leads to an underflow, causing the transaction to revert in the whole transaction.
Open the reportIn the `BKOK` token contract, two types of trading pairs exist: `WBNB-BKOK` and `USDT-BKOK`. Selling operations within either pair can trigger an automatic burning of `BKOK` tokens from the `WBNB-BKOK` pair. The tokens burned are transferred to the contract itself, potentially initiating subsequent swap operations. Notably, these burn and swap activities are confined to the `WBNB-BKOK` pool. Thus, when `BKOK` tokens are sold in the `USDT-BKOK` pool, it impacts the price in the `WBNB-BKOK` pool as well. This strategy appears designed to stabilize the prices across various BKOK pools. ```solidity=115 if (_autoPair[to]) { autoBurnUniswapPair(); if (!swapIng) { swapIng = true; swapTokenForFee(); swapIng = false; } } ``` ```solidity=315 function autoBurnUniswapPair() internal { if (block.timestamp - lastLpBurnTime > lpBurnFrequency) { burnPair(pairETH); lastLpBurnTime = block.timestamp; } } function burnPair(address _pair) internal returns (bool) { uint256 liquidityPairBalance = balanceOf(_pair); uint256 amountToBurn = (liquidityPairBalance * percentForLPBurn) / percentDiv; if (amountToBurn > 0) { super._transfer(_pair, address(this), amountToBurn); IPancakePair(_pair).sync(); emit AutoNukeLP( liquidityPairBalance, amountToBurn, block.timestamp ); return true; } return false; } } ``` However, it's important to note that selling in the `WBNB-BKOK` pool does not affect the `USDT-BKOK` pool's price. We have some concerns for the auto pair burning mechanism: 1. **Arbitrage Trade**: Should the `BKOK` price in the `WBNB-BKOK` pool be substantially lower compared to its price in the `USD-BKOK` pool, an opportunity for arbitrage trading arises. 2. **Potential Loss for Liquidity Providers**: During the process of auto burning and swapping, the reserves of `WBNB-BKOK` could decrease, resulting in a loss for liquidity providers. We would like to confirm whether the design was intentional.
Open the reportIf the low level `call()` at Line 285 is failed and returns false, the if-clause at Line 289~294 will handle the failure situation. Although the value of `withdrawnDividends[user]` is updated again at Line 290, the event with wrong value at Line 283 has been emitted already. ```solidity=277 function _withdrawDividendOfUser(address user) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user); if (_withdrawableDividend > 0) { withdrawnDividends[user] = withdrawnDividends[user].add( _withdrawableDividend ); emit DividendWithdrawn(user, _withdrawableDividend); (bool success, ) = payable(user).call{value: _withdrawableDividend}( new bytes(0) ); if (!success) { withdrawnDividends[user] = withdrawnDividends[user].sub( _withdrawableDividend ); return 0; } return _withdrawableDividend; } return 0; } ```
Open the reportThe `BKOKLPLock` contract, the owner of the `BABTOKENDividendTracker` contract, does not provide entry points to invoke the `excludeFromDividends()` and `updateClaimWait()` functions. As a result, these functions within the `BABTOKENDividendTracker` contract become inaccessible and therefore unusable. ```solidity function excludeFromDividends(address account) external onlyOwner { if (!excludedFromDividends[account]) { excludedFromDividends[account] = true; _setBalance(account, 0); tokenHoldersMap.remove(account); emit ExcludeFromDividends(account); } } function updateClaimWait(uint256 newClaimWait) external onlyOwner { require( newClaimWait >= 3600 && newClaimWait <= 86400, "Dividend_Tracker: claimWait must be updated to between 1 and 24 hours" ); require( newClaimWait != claimWait, "Dividend_Tracker: Cannot update claimWait to same value" ); emit ClaimWaitUpdated(newClaimWait, claimWait); claimWait = newClaimWait; } ```
Open the report`require()` statements should include a descriptive message that explains the unmet condition, aiding in the easy identification of the problem.
Open the reportThe `call()` method can lead to reentrancy issues. Since `call()` is a low-level function, it does not automatically handle control flow returns, which may allow an attacker to re-enter your contract during its execution. When using `call()`, it's important to be cautious of reentrancy attacks by employing strategies like the checks-effects-interactions pattern or using mutex locks (such as ReentrancyGuard) to protect your contract.
Open the reportThe `withdrawETH` function in the `BKOK` contract uses a specific formula to calculate the amount of withdrawable ETH based on the proportion of the tokens being transferred relative to the total adjusted token supply. This adjusted supply is computed as the total supply minus the tokens held by the dead address and the tokens in both the WBNB-BKOK and USD-BKOK liquidity pairs, adjusted further by adding the amount being transferred. ```solidity=175 uint256 outETH = getWithdrawOut(amount); super._transfer(from, address(0xdead), amount); ``` The logic here is first to calculate the amount of ETH corresponding to the input tokens (`amount`) and then transfer the `amount` of BKOK tokens to a dead address, effectively removing them from circulation. The `getWithdrawOut` function uses the formula: ```solidity (uint256 amountIn * address(this).balance) / (totalSupply() - balanceOf(address(0xdead)) - balanceOf(pairETH) - balanceOf(pairUSDT) + amountIn) ``` Here, `amountIn` is the amount of BKOK tokens that the user wants to withdraw as ETH. The calculation slightly disadvantages the user by providing less ETH than might be expected from a straightforward proportional withdrawal based on the tokens' current position in the supply metrics. This occurs because the formula anticipates the transfer of tokens to the dead address before it actually happens, impacting the amount of ETH received. This looks reasonable from the `getWithdrawOut` function as it may consider divide by zero error. We ant to confirm whether the current implementation is intended.
Open the reportIn the `multiTransfer()` function, multiple amounts are transferred to multiple addresses within a single function call. Therefore, the elements of the `addrs` and `amounts` arrays must correspond one-to-one, and their lengths must match.
Open the reportWe would like to confirm whether these designs align with the intended functionality: - In the `BKOK` contract, it is noted that the contract accumulates transfer fees and periodic auto burning from `BNB-BKOK` pair and converts them into native coins (BNB), which are then deposited into the contract. According to the on-chain configuration, 20% of this ETH is allocated to a marketing address, 30% is designated for burning, and the remaining 50% stays within the contract. It is noted that only accounts that are exempt from fees have the capability to withdraw these BNB. - Based on the on-chain status of the `BKOK` contract, once the owner renounces their permissions, the `addLiquidity` function can no longer be executed. This implies that unless users actively add liquidity, the liquidity of the pair contract will not increase. If most users only trade one type of token within the pair, this could lead to significant price fluctuations for that token, adversely affecting normal transactions.
Open the reportA sandwich attack can occur when an attacker notices a transaction involving token swaps or liquidity additions that lacks slippage restrictions or minimum output amount settings. The attacker can exploit this by frontrunning the transaction to purchase one of the assets, thereby manipulating the exchange rate, and then backrunning the transaction to sell the asset for a profit. The referenced functions are invoked without setting slippage restrictions or minimum output amounts, making transactions that trigger these functions particularly vulnerable to sandwich attacks, especially when large input amounts are involved.
Open the reportThe low-level `call` function returns the status of the call as first variable in the returned tuple. The status of the `call` is not asserted to be `true`, which would treat the low-level call as a success even when it reverted. ```solidity=44 function _safeTransferETH(address to, uint value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); if (success) {} } ```
Open the report| Address | Chain | Source code |
|---|---|---|
| 0x9cc4…3f200x9cc484ded7a7851a03f05a03e8d19eb5f5a73f20 | Chain: BNB Chain | Source code: Verified source |
| 0x8001…7ad10x8001beca8399202dc4db0f470101a8ae11287ad1 | Chain: BNB Chain | Source code: Verified source |
Trustblock holds 2 public audit reports for BKOKFi, dated 29 Sep 2024 to 13 Nov 2024. The latest is by CertiK (“BKOKLPLock”).
CertiK wrote the 2 reports Trustblock holds for BKOKFi.
13 findings are still open or acknowledged in the firms’ reports: 1 high, 3 medium, 9 low (all open). No critical finding is reported. Statuses are the security firms’ own.
Is this your project? Show this record on your own website. The label states what the record holds, links to this page and updates by itself. It is free and needs no sign-in.
Automatic: the three strongest facts of this project’s own record (its last audit and two more), highlighted. They update with the record. Picking a fact turns Automatic off.
<head><script src="https://widget.trustblock.run/project-widget.min.js" defer></script></head><body><divdata-tb-project-widgetdata-tb-project-slug="bkok"></div></body>
Paste the code where the label should appear. It uses no API credit and updates by itself.
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