CertiK reviewed King Finance (King Addendum) on 8 Feb 2023: 12 findings, 0 critical; all acknowledged, none fixed.
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 | 2 | 0 |
| Medium | 0 | 1 | 0 |
| Low | 0 | 9 | 0 |
In the contract `King` 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.  In the contract `King` the role `kingPassContract` has authority over the functions shown in the diagram below. Any compromise to the `kingPassContract` account may allow the hacker to take advantage of this authority and lock tokens to activate the KingPass contract. 
`100_000_000 * 10 ** 9` tokens were sent to the `owner()` when deploying the contract. This could be a centralization risk as the deployer can distribute tokens without obtaining the consensus of the community.
Contracts that authorize users using the `tx.origin` variable are typically vulnerable to phishing attacks which can trick users into performing authenticated actions on the vulnerable contract. There are multiple reasons why using `tx.origin` is not safe from the security perspective. Refer to : * [Solidity Documentation on `tx.origin`](https://docs.soliditylang.org/en/latest/security-considerations.html#tx-origin) * <https://github.com/ethereum/solidity/issues/683> ```solidity=453 require(userLastTradeData[tx.origin].lastBuyTime + 3 <= block.timestamp,"You cannot do multi-buy orders."); ```
Performing integer division before multiplication truncates the low bits, losing the precision of calculation. ```solidity=514 txFees = amount * (totalBuyFee * kingPassFeeDiscount / 1000) / 1000; ``` --- ```solidity=524 txFees = amount * (totalSellFee * kingPassFeeDiscount / 1000) / 1000; ```
There are many hardcode addresses in this codebase.
The variables `minimumWeiForTokenomics` do not have reasonable boundaries, so the owner can be given arbitrary values after deploying.
Addresses should be checked before assignment or external call to make sure they are not zero addresses. ```solidity=209 pancakeV2Pair = _pair; ``` - `_pair` is not zero-checked before being used. --- ```solidity=287 marketingAddress = marketing; ``` - `marketing` is not zero-checked before being used. --- ```solidity=288 devAddress = dev; ``` - `dev` is not zero-checked before being used. --- ```solidity=289 buybackAddress = buyback; ``` - `buyback` is not zero-checked before being used.
A sandwich attack may 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 front running (before the transaction being attacked) a transaction to purchase one of the assets and make profits by back running (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: - `swapExactTokensForETHSupportingFeeOnTransferTokens()`
In `constructor()`, the `marketingAddress`, `devAddress`, and `buybackAddress` are excluded from fees, but in the function `setFeesAddress()`, the new `marketingAddress`, `devAddress`, and `buybackAddress` are not excluded from fees and the old ones are not included in fees.
In `constructor()`, the `pancakeV2Pair` is added to `automatedMarketMakerPairs`, but in the function `updatePancakeV2Router()`, the new `pancakeV2Pair` is not added to the `automatedMarketMakerPairs` and the old one is not removed from the `automatedMarketMakerPairs`.
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=65 IPancakeV2Router02 public pancakeV2Router; ``` - The contract `King` interacts with third party contract with `IPancakeV2Router02` interface via `pancakeV2Router`. --- ```solidity=87 address public kingPassContract; ``` - The contract `King` interacts with third party contract with `IKingPass` interface via `kingPassContract`.
It appears from the comment on line 435 that vested users can only buy, not transfer or sell. However, the `trade_type` is always 0, and line 439 always checks that the user is a vested user. This means that once `from` is a vested user, they cannot buy from the pair.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (1)
1,044 projects reviewed · 1,375 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