CertiK reviewed Cubiswap (CubiSwap-Audit) on 15 Sep 2023: 12 findings, 0 critical; 6 acknowledged, 6 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 | 2 | 0 |
| Low | 6 | 0 | 0 |
Performing integer division before multiplication truncates the low bits, losing the precision of calculation. ```solidity=166 uint256 cubiReward = multiplier.mul(cubiPerBlock).mul(pool.allocPoint).div(totalAllocPoint); ``` ```solidity=167 accCubiPerShare = accCubiPerShare.add(cubiReward.mul(1e12).div(lpSupply)); ``` --- ```solidity=192 uint256 cubiReward = multiplier.mul(cubiPerBlock).mul(pool.allocPoint).div(totalAllocPoint); ``` ```solidity=195 pool.accCubiPerShare = pool.accCubiPerShare.add(cubiReward.mul(1e12).div(lpSupply)); ```
When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction. Reference: https://thoreum-finance.medium.com/what-exploit-happened-today-for-gocerberus-and-garuda-also-for-lokum-ybear-piggy-caramelswap-3943ee23a39f ```solidity=214 pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); ``` - Transferring tokens by `_amount`. ```solidity=215 user.amount = user.amount.add(_amount); ``` - This function call executes the following operation. - In `SafeMath.add`, - `uint256 c = a + b;` - The `_amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees. --- ```solidity=233 pool.lpToken.safeTransfer(address(msg.sender), _amount); ``` - Transferring tokens by `_amount`. ```solidity=232 user.amount = user.amount.sub(_amount); ``` - This function call executes the following operation. - In `SafeMath.sub`, - `return a - b;` - The `_amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees.
There are some console.log arguments within the codebase, this seems to only be used for development purposes and is not useful for users.
Signed messages are not properly verified with the current chain ID, thus allowing attackers to perform replay attacks across chains. Hardcoded or cached chain ID values are also vulnerable since a hard fork may occur and change the chain ID in the future. ```solidity=98 abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ``` - Reading a state variable `DOMAIN_SEPARATOR`, which seems to be a cached chain ID value. - Encoding the cached chain ID value `DOMAIN_SEPARATOR`. ```solidity=104 address recoveredAddress = ecrecover(digest, v, r, s); ``` - Calling `ecrecover` with a hash that does not properly include the chain ID.
One or more logic contracts do not protect their initializers. An attacker can call the initializer and assume ownership of the logic contract, whereby she can perform privileged operations that trick unsuspecting users into believing that she is the owner of the upgradeable contract. ```solidity=22 contract MasterChef is OwnableUpgradeable { ``` - `MasterChef` is an upgradeable contract that does not protect its initializer. ```solidity=77 function initialize( ``` - `initialize` is an unprotected initializer function.
The owner of the contract `Cubitoken` can add users to whitelist utilizing function `addWhiteList`. Once a user is added to the whitelist, he cannot be removed.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (10)
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