CertiK reviewed BKOKFi (BKOKLPLock) on 13 Nov 2024: 7 findings, 0 critical; 1 marked fixed, 6 open.
The original report was removed from its address (seen 14 Oct 2026).
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 1 | 0 | 1 |
| Medium | 1 | 0 | 0 |
| Low | 4 | 0 | 0 |
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 {} } ```
Contracts 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); } ```
If 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; } ```
The `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; } ```
`require()` statements should include a descriptive message that explains the unmet condition, aiding in the easy identification of the problem.
The `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.
| Address | Chain | Source code |
|---|---|---|
| 0x8001…7ad10x8001beca8399202dc4db0f470101a8ae11287ad1 | 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