SquidGrow has 16 public audit reports from CertiK and Hacken; the latest is Hacken, 13 Sep 2024; 1 critical finding, marked fixed by the firm. It also holds 9 deployed contracts on 2 chains.
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
106 findings are still open or acknowledged in the firms’ reports: 16 high, 12 medium, 78 low (97 open, 9 acknowledged).
Centralization Related Risks
SquidGrow - V3 Contract · CertiK · 3 Sep 2024 · Report ↗
Initial Token Distribution
SquidGrow - V3 Contract · CertiK · 3 Sep 2024 · Report ↗
Centralization Related Risks
Knox LP Locker V2 · CertiK · 28 Aug 2024 · Report ↗
Centralization Risks in LPLock.sol and vesting.so
Knox Locker · CertiK · 15 Jun 2024 · Report ↗
Centralization Related Risks
SGS - DEX · CertiK · 14 Feb 2024 · Report ↗
Legacy Issues In SGSRouter01
SGS - DEX · CertiK · 14 Feb 2024 · Report ↗
Centralization Related Risks
Inkubate - Launchpad · CertiK · 9 Jan 2024 · Report ↗
Centralized Control of Contract Upgrade
Inkubate - Launchpad · CertiK · 9 Jan 2024 · Report ↗
Centralization Risks in `SquidGrow.sol`
Old SquidGrow Token Contract · CertiK · 27 Oct 2023 · Report ↗
Centralized Risk in `addLiquidity`
Old SquidGrow Token Contract · CertiK · 27 Oct 2023 · Report ↗
Newest first
16 audit reports, 14 in CertiK’s series. 1 other security report listed, not counted
| Report | Security firm | Date | Scope | Critical findings | Findings | Source |
|---|---|---|---|---|---|---|
| SquidGrow / KnoxLocker V2 | Security firm: Hacken | Date: | Scope: 1 address on Ethereum | None open | Findings: 2 medium · 1 low 3 fixed | hacken.io ↗ |
| SquidGrow - V3 Contract | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 2 high · 1 medium · 3 low 2 fixed · 4 open | skynet.certik.com ↗ |
| SquidGrow V3 Contract | Security firm: Hacken | Date: | Scope: 1 address on Ethereum | None open | Findings: None listed | hacken.io ↗ |
| Knox LP Locker V2 | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 1 high · 2 medium · 9 low 7 fixed · 5 acknowledged | skynet.certik.com ↗ |
| SilentSwap 2nd Audit Part II | Security firm: CertiK | Date: | Scope: —Not recorded; see the report | None open | Findings: 1 medium 1 open | skynet.certik.com ↗ |
| SilentSwap - Privacy Cross Chain Aggregator Phase | Security firm: CertiK | Date: | Scope: —Not recorded; see the report | None open | Findings: 1 medium · 6 low 7 open | skynet.certik.com ↗ |
| Knox Locker | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 1 high · 2 medium · 15 low 11 fixed · 2 acknowledged · 5 open | skynet.certik.com ↗ |
| SGS - DEX | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 2 high · 13 low 15 open | skynet.certik.com ↗ |
| Inkubate - Marketplace | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 6 medium · 14 low 20 open | skynet.certik.com ↗ |
| Inkubate - Launchpad | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 3 high · 7 medium · 8 low 16 fixed · 2 open | skynet.certik.com ↗ |
| Old SquidGrow Token Contract | Security firm: CertiK | Date: | Scope: 2 addresses on Ethereum and BNB Chain | None open | Findings: 3 high · 1 medium · 19 low 23 open | skynet.certik.com ↗ |
| SquidGrow Bridge | Security firm: CertiK | Date: | Scope: 2 addresses on Ethereum and BNB Chain | None open | Findings: 2 high · 1 low 3 open | skynet.certik.com ↗ |
| SGS Pentest Penetration test of off-chain systemsNot counted as an audit report | Security firm: CertiK | Date: | Scope: —Not recorded; see the report | None open | Findings: 2 low 2 fixed | skynet.certik.com ↗ |
| Squidgrow - ILO | Security firm: CertiK | Date: | Scope: Files listed | 1 critical finding, fixed | Findings: 1 critical · 2 high · 5 medium · 17 low 21 fixed · 4 open | skynet.certik.com ↗ |
| Old SquidGrow Bridge | Security firm: CertiK | Date: | Scope: 2 addresses on Ethereum and BNB Chain | None open | Findings: 1 high · 2 medium · 2 low 2 fixed · 2 acknowledged · 1 open | skynet.certik.com ↗ |
| SquidGrow - Staking | Security firm: CertiK | Date: | Scope: Files listed | None open | Findings: 3 high · 19 low 13 fixed · 9 open | skynet.certik.com ↗ |
| SGS Token Registry | Security firm: CertiK | Date: | Scope: 2 addresses on Ethereum and BNB Chain | None open | Findings: 3 low 3 open | skynet.certik.com ↗ |
Statuses are the security firm’s own, from each report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 1 |
| High | 13 | 3 | 4 |
| Medium | 9 | 3 | 18 |
| Low | 75 | 3 | 54 |
In the contract `SquidGrow` the role `DEFAULT_ADMIN_ROLE` has authority over the functions shown as below. Any compromise to the `DEFAULT_ADMIN_ROLE` account may allow the hacker to take advantage of this authority and do the following things: - `enableTrading()`, maliciously enable trade and set trade start time. - `pause()`, maliciously pause token transfer. - `addToWhitelist()`, add any invalid account into white list. - `removeFromWhitelist()`, remove valid account from white list. - `grantRole()`, grant key role to malicious account and add into white list. - `revokeRole()`, maliciously revoke key role of valid account and remove from white list. - `renounceRole`, maliciously renounce `DEFAULT_ADMIN_ROLE` role. - `emergencyWithdrawOtherToken()`, maliciously withdraw any ERC20 tokens. - `emergencyWithdrawEth()`, maliciously withdraw ETH. 
Open the reportAll of the `SQGROW` tokens, `1_000_000_000 * 10e9`, are minted to the contract deployer. This is a centralization risk because the deployer can distribute tokens without obtaining the consensus of the community. Any compromise to these addresses may allow a hacker to steal and sell tokens on the market, resulting in severe damage to the project.
Open the reportIn the contract `SGSPair` the role `factory` has authority over the functions shown in the diagram below.  - `initialize(address _token0, address _token1)`: Initializes the contract with the given token addresses. This function is restricted to being called by the current `factory`. Any compromise to the `factory` account may allow the hacker to take advantage of this authority, update the sensitive settings, and execute sensitive functions of the project. ----- In the contract `SGSFactory` the role `feeToSetter` has authority over the functions shown in the diagram below.  - `setFeeTo(address _feeTo)`: Sets the address to which trading fees will be directed. This function is restricted to being called by the current `feeToSetter`. - `setFeeToSetter(address _feeToSetter)`: Updates the address that has the authority to set the feeTo address. This function is restricted to being called by the current `feeToSetter`. Any compromise to the `feeToSetter` account may allow the hacker to take advantage of this authority, update the sensitive settings, and execute sensitive functions of the project.
Open the reportThere is an issue inside the `SGSRouter01` contract: `SGSRouter01.sol` implements the function `_swap` which doesn't support tokens that take fee on transfer. Functions that call `_swap` might revert, including: - `swapExactTokensForTokens` - `swapTokensForExactTokens` - `swapExactETHForTokens` - `swapTokensForExactETH` - `swapExactTokensForETH` - `swapETHForExactTokens` Assuming a scenario for the function `swapExactTokensForTokens`: 1) Alice attempts to swap 1 `aToken` for some `bToken`, `aToken` takes 20% fee on transfer. The liquidity pool has 5 `aToken` and 20 `bToken`. 2) The function `getAmountsOut()` will be used to determine the amount of `bToken` that can be swapped for 1 `aToken`. Based on the calculation, 1 `aToken` can be exchanged for approximately 3.325 `bToken`. 4) Liquidity pool receives 0.8 `aToken` (fee deducted) and optimistically transfers 3.325 `bToken` to Alice. Liquidity Pool now has 5.8 `aToken` and 16.675 `bToken`. 5) The new `K` will approximately be $(5.8*1000-0.8*3)*(16.675*1000) \approx 96,674,980$ which is smaller than the original K $(5*20)*1000^2=100,000,000$ calculated by the reserves. 6) The transaction reverts due to `K` validation failure.
Open the report### ERC721A #### `_creator` or `_owner` In the contract `ERC721A` the role `_creator` including `creator` and `owner` accounts add has authority over the functions shown in the diagram and list below. * setMaxMintAmount() - Set the max mint amount. * setMaxWalletAmount() - Set the max wallet amount. * setBaseUri() - Set the bas uri of this token. * changeStartTime() - Change the start time of minting. * changeEndTime() - Change the end time of minting. * enableWhitelistMode() - Enable or disable the whitelist mode. * forceFinishMinting() - Forge to set the minting process to be finished. * changeMaxTotalSupply() - Change the max total supply. * setPriceForWhitelist() - Set the minting price for whitelist users. * setWhitelistRoot() - Set the merkle root hash for the whitelist users. * adminMint()- Mint NFT without any payment. Any compromise to the `_creator` role may allow the hacker to take advantage of this authority, set the configurations, and mint NFT in unexpected ways. #### `_owner` In the contract `ERC721A` the role `_owner` has authority over the functions shown in the diagram and list below. * setBaseInfo() - Set the base info for the token, including max supply, mint price, platform fee and so on. * setPlatformFeeRate() - Set the platform fee rate charged during minting. The `ERC721A` contract inherits `Ownable` contract from Openzeppelin, the role `_owner` also has authority over the functions from its parent contract list below. * `renounceOwnership()` - Renounce the ownership of contract to leave the contract without an owner * `transferOwnership()` - Transfers ownership of the contract to a new account Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set the base info, mint NFTs, and manage the ownership. ----- ### LaunchPad #### `_collectionOwner` In the contract `LaunchPad` the role `_collectionOwner` has authority over the functions shown in the diagram and list below. * setCollectionBaseUri() - Set the bas uri of this token. * changeStartTime() - Change the start time of minting. * changeEndTime() - Change the end time of minting. * enableWhitelistMode() - Enable or disable the whitelist mode. * setWhitelistRoot() - Set the merkle root hash for the whitelist users. * forceFinishMinting() - Forge to set the minting process to be finished. * changeMaxTotalSupply() - Change the max total supply. * setPriceForWhitelist() - Set the minting price for whitelist users. Any compromise to the `_collectionOwner` account may allow the hacker to take advantage of this authority and set the configurations in unexpected ways. #### `_owner` In the contract `LaunchPad` the role `_owner` has authority over the functions shown in the diagram and list below. * pause() - Pause the contract. * unpause() - Resume the contract. * setBlacklistedUser() - Set some users in the blacklist or not. * setPlatformFeeRate() - Set the platform fee rate. * withdraw() - Withdraw the native token or ERC20 tokens from the contract. The `LaunchPad` contract inherits `OwnableUpgradeable` contract from Openzeppelin, the role `_owner` also has authority over the functions from its parent contract list below. * `renounceOwnership()` - Renounce the ownership of contract to leave the contract without an owner * `transferOwnership()` - Transfers ownership of the contract to a new account Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and set blacklist change platform fee rate, pause/unpause the contract and manage the ownership of the contract.
Open the reportIn the contract `LaunchPad`, the role `admin` has the authority to update the implementation contract behind the `LaunchPad` contract. Any compromise to the `admin` account may allow a hacker to take advantage of this authority and change the implementation contract which is pointed by proxy and therefore execute potential malicious functionality in the implementation contract.
Open the reportIn the contract `SquidGrow` the role `authorized` has authority over the following functions: - authorize() - unauthorize() - transferOwnership() - renounceOwnership() - setFeeExempt() - setisBot() - setisInternal() - setbotOn() - syncContractPair() - approvals() - setPairReceiver() - setstartSwap() - setSwapBackSettings() - setMaxes() - rescueBEP20() - setExemptAddress() - setDivisors() - setStructure() - setInternalAddresses() Any compromise to the `authorized` account may allow the hacker to take advantage of this authority and - remove all funds (BNB, LP tokens, SquidGrow, etc) from the contract through functions `approvals()`, `rescueBEP20()`, and `syncContractPair()`; - set the `liquidity_receiver` to an address they control through `setPairReceiver()`; - authorize multiple addresses they control, set unintended internal addresses, and exempt addresses; - set their controlled address to be exempt from fees while exchanging large amounts of the token; - set addresses which are not bots to `isBot` status, causing addresses to be subject to larger fees; - set addresses they control to `isInternal` status so they can exceed the `maxWallet` value; - update the divisors, fees, maxes, and threshold value to the disadvantage of the user;
Open the reportThe `addLiquidity()` function calls the `router.addLiquidityETH` function with the `to` address specified as `liquidity_receiver` for acquiring the generated LP tokens from the `SquidGrow-BNB` pool. As a result, over time the `liquidity_reciever` address will accumulate a significant portion of LP tokens. If the `liquidity_receiver` is an EOA (Externally Owned Account), mishandling of its private key can have devastating consequences to the project as a whole. ```solidity router.addLiquidityETH{value: BNBAmount}( address(this), tokenAmount, 0, 0, liquidity_receiver, block.timestamp ); ```
Open the reportAll `SquidGrow` is sent to the `owner` address when deploying the contract. This could be a centralization risk as the `owner` can distribute tokens without obtaining the consensus of the community.
Open the reportIn `SquidGrowBridge`'s parent contracts, the role `_owner` has authority over the following functions: - forceResumeReceive(): resume the message flow in blocking mode and clear the stored payload. - setConfig(): set the configuration of the LayerZero messaging library of the specified version. - setMinDstGas(): set the minimal fees. - setPayloadSizeLimit(): set `payloadSizeLimit`. - setPrecrime(): set `precrime`. - setReceiveVersion(): set the `lzReceive()` LayerZero messaging library version. - setSendVersion(): set the `send()` LayerZero messaging library version. - setTrustedRemote(): set the trusted path for the cross-chain communication. - setTrustedRemoteAddress(): set the trusted remote address. - setUseCustomAdapterParams(): set the `useCustomAdapterParams`. - transferOwnership(): transfer the ownership. - renounceOwnership(): renounce the ownership. Any compromise to the `_owner` account may allow a hacker to take advantage of this authority and disrupt the bridge's normal functioning.
Open the reportThe contracts `SquidGrowBridge` on Ethereum and BSC serve as a cross-chain bridge, which lets users move assets between the two blockchains. Users can lock tokens in the bridge contract on one blockchain, enabling a corresponding amount of tokens to be unlocked from the bridge contract on the other blockchain. Through the `emergencyWithdraw()` function, the `_owner` can transfer out all ERC20 tokens, including SquidGrow Token, from the bridge contracts. Any compromise to the `_owner` account may allow a hacker to take advantage of this authority and withdraw all tokens. As a result, users who deposit tokens on the source blockchain might be unable to withdraw them on the destination blockchain because of the insufficient balance in the bridge contract. ```solidity=1997 function emergencyWithdraw(address token) external onlyOwner { IERC20(token).safeTransfer(msg.sender, IERC20(token).balanceOf(address(this))); emit EmergencyWithdraw(token, IERC20(token).balanceOf(address(this))); } ```
Open the reportIn the contract `SquidGrowILO` 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 and - remove all BNB, `squidgrowToken`, or any other token from the contract; - reset the `merkleRoot` to a value which makes all previously whitelisted user's `merkleProof` invalid for either the contributions or airdrop; - update the truth value of `claimable` and `status` to prevent collection of `squidGrowToken` through contributions or airdrop; - update `maxContribution` to a lower value after users have begun purchasing, restricting some users from purchasing more `squidgrowToken`; - update `discount` and `bonusForTradeIn` to values that represent more than 100% of the original value, and use this remove all `squidgrowToken` from the contract via multiple accounts they own; - update the `tokenPrice` to a larger or smaller value, either making it easier or more difficult to exchange BNB for `squidgrowToken`; 
Open the reportIn the contract `Ownable` 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 and renounce ownership after misconfiguring privileged settings.  In the contract `SquidGrowStaking` 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 and - whitelist an NFT they have sole access to and use to gain rewards from the contract; - remove tokens sent accidentally by the user without staking vis function `recoverUnsupportedToken()` and keep for themselves; - remove user access to functionality such as NFT staking and reward harvesting; - blacklist users to prevent access to their rewards; - set the fee address to an account they control and collect fees as high as 10%; - add a staking token they have sole access to and set the `_allocPoint` to a large value in order to drain the rewards from the contract; - update the `boostAPRPerNft` to an extremely large value or to be 0 in order to manipulate rewards; **Note**: Functions `updateSquidStakingPoolId()` and `changeSquidgrowAddress()` were added to the file post-audit. It is imperative that these functions are called in combination with other functions in the correct order. If the `_owner` account is compromised, a hacker may - use function `changeSquidgrowAddress()` to trap rewards and previous `SquidGrow` stakes in the contract; - use function `updateSquidStakingPoolId()` to prevent reward boosts or distribute reward boosts in an unintended manner. 
Open the reportIn `main.tf` file of the `terraform-provision-scripts` module, the configuration of the `provider "kubernetes"` contains the attribute of `load_config_file`. This attribute is removed since version `2.0.0`. If the version used is greater than `2.0.0`, the error will prompt: ```bash Unexpected attribute: An attribute named "load_config_file" is not expected here. ``` Reference: * https://registry.terraform.io/providers/hashicorp/kubernetes/1.13.4/docs * https://registry.terraform.io/providers/hashicorp/kubernetes/2.0.0/docs * https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs
Open the reportThe swap function can take an unusually long time to complete. In the cryptocurrency ecosystem, where asset prices can fluctuate wildly within short periods, this delay can significantly impact the estimated value of a swap. The longer execution time might cause the final swap value to differ markedly from the initially quoted value, leading to potential losses for the user.
Open the reportThe function `validateOfferItemApprovalAndBalance()` verifies that for an ERC1155/ERC20/Native itemType, the offerer's balance exceeds the minBalance. According to the progress of order fulfillment, the final transferred amount of offered items is calculated linearly based on the time elapsed since the order became active. It's noted that the buyer may purchase any quantity between the `startAmount` and `endAmount`. Yet, the offerer's balance must surpass the `maxBalance`, not just the `minBalance`. This is to prevent a scenario where a buyer opts for the maximum amount, but the offerer doesn't have enough balance, leading to a failed transaction. See the function `_locateCurrentAmount` below which is used to derive the current amount of a given item based on the current price: --- File: contracts/lib/AmountDeriver.sol ```solidity=42 function _locateCurrentAmount( uint256 startAmount, uint256 endAmount, uint256 startTime, uint256 endTime, bool roundUp ) internal view returns (uint256 amount) { // Only modify end amount if it doesn't already equal start amount. .... uint256 duration; uint256 elapsed; uint256 remaining; // Skip underflow checks as startTime <= block.timestamp < endTime. unchecked { // Derive the duration for the order and place it on the stack. duration = endTime - startTime; // Derive time elapsed since the order started & place on stack. elapsed = block.timestamp - startTime; // Derive time remaining until order expires and place on stack. remaining = duration - elapsed; } // Aggregate new amounts weighted by time with rounding factor. uint256 totalBeforeDivision = ((startAmount * remaining) + (endAmount * elapsed)); // Use assembly to combine operations and skip divide-by-zero check. assembly { // Multiply by iszero(iszero(totalBeforeDivision)) to ensure // amount is set to zero if totalBeforeDivision is zero, // as intermediate overflow can occur if it is zero. amount := mul( iszero(iszero(totalBeforeDivision)), // Subtract 1 from the numerator and add 1 to the result if // roundUp is true to get the proper rounding direction. // Division is performed with no zero check as duration // cannot be zero as long as startTime < endTime. add( div(sub(totalBeforeDivision, roundUp), duration), roundUp ) ) } // Return the current amount. return amount; .... } ```
Open the reportIn the function `FulfillmentGeneratorLib.consumeMaximumItemsAndGetFulfillment()`, the linked *if* blocks update variables from `offerItems` and `considerationItems` that are not used in the logic of the function. The specific role and impact of these *if* blocks are ambiguous as decreasing operations within the block could theoretically serve as checks — potentially triggering a function failure implicitly in some scenarios. This raises questions about the intended functionality of this block, as some changes made to the input structs do not influence the function's output and are not accompanied by explicit error handling or messaging. ---- In addition to the primary issue in the `FulfillmentGeneratorLib.consumeMaximumItemsAndGetFulfillment()` function, it is important to note that the function `FulfillmentGeneratorLib.getMaxInclusionConsumeMethod()` relies on the output of `FulfillmentGeneratorLib.consumeMaximumItemsAndGetFulfillment()`. The issue not only affects the direct caller but also cascades to other parts of the system where this function is used, potentially leading to widespread inaccuracies or logic flaws.
Open the reportIn the function `FulfillmentGeneratorLib.consumeMinimumItemsAndGetFulfillment()`, the *if* block: ```solidity=725 if (offerItem.amount < considerationItem.amount) { offerItems.totalAmount -= offerItem.amount; considerationItems.totalAmount -= offerItem.amount; considerationItem.amount -= offerItem.amount; offerItem.amount = 0; } else { offerItems.totalAmount -= considerationItem.amount; considerationItems.totalAmount -= considerationItem.amount; offerItem.amount -= considerationItem.amount; considerationItem.amount = 0; } ``` modifies the input parameter structs but does not alter the return values, which are generated earlier in the function. The specific role and impact of this *if* block is ambiguous as decreasing operations within the block could theoretically serve as checks — potentially triggering a function failure implicitly in some scenarios. This raises questions about the intended functionality of this block, as the changes made to the input structs do not influence the function's output and are not accompanied by explicit error handling or messaging. ---- In addition to the primary issue in the `FulfillmentGeneratorLib.consumeMinimumItemsAndGetFulfillment()` function, it is important to note that the function `FulfillmentGeneratorLib.getMaxInclusionConsumeMethod()` relies on the output of `FulfillmentGeneratorLib.consumeMinimumItemsAndGetFulfillment()`. The issue not only affects the direct callers but also cascades to other parts of the system where this function is used, potentially leading to widespread inaccuracies or logic flaws.
Open the reportIn the function `FulfillmentGeneratorLib.consumeRandomItemsAndGetFulfillment()`, the *if* block: ```solidity=992 if (totalOfferAmount > totalConsiderationAmount) { uint256 remainingAmount = (totalOfferAmount - totalConsiderationAmount); // add back excess to first offer item offerItems.items[consumableOfferIndices[0]].amount += ( remainingAmount ); offerItems.totalAmount -= totalConsiderationAmount; considerationItems.totalAmount -= totalConsiderationAmount; } else { uint256 remainingAmount = (totalConsiderationAmount - totalOfferAmount); // add back excess to first consideration item considerationItems .items[consumableConsiderationIndices[0]] .amount += remainingAmount; offerItems.totalAmount -= totalOfferAmount; considerationItems.totalAmount -= totalOfferAmount; } ``` modifies the input parameter structs but does not alter the return values, which are generated earlier in the function. The specific role and impact of this *if* block are ambiguous. While decreasing operations within the block could theoretically serve as checks — potentially triggering a function failure implicitly in some scenarios — other operations, such as incrementing `considerationItems .items[consumableConsiderationIndices[0]] .amount`, does not align with a checking mechanism. This discrepancy raises questions about the intended functionality of this block, as the changes made to the input structs do not influence the function's output and are not accompanied by explicit error handling or messaging. ----- In addition to the primary issue in the `FulfillmentGeneratorLib.consumeRandomItemsAndGetFulfillment()` function, it is important to note that the function `FulfillmentGeneratorLib.getMaxInclusionConsumeMethod()` relies on the output of `FulfillmentGeneratorLib.consumeRandomItemsAndGetFulfillment()`. The issue not only affects the direct callers but also cascades to other parts of the system where this function is used, potentially leading to widespread inaccuracies or logic flaws.
Open the reportIn the `FulfillmentLib.bundleByMatchable()` function, the initial operation: ```solidity=1786 ItemReferenceGroup[] memory groups = itemReferences .getUniqueFullHashes() .allocateItemReferenceGroup(); ``` generates the return object `groups`. The following *for* loop: ```solidity=1790 for (uint256 i = 0; i < itemReferences.length; ++i) { ItemReferenceLib.ItemReference memory itemReference = itemReferences[i]; for (uint256 j = 0; j < groups.length; ++j) { ItemReferenceGroup memory group = groups[j]; if (group.fullHash == itemReference.fullHash) { group.references[group.assigned++] = itemReference; break; } } } ``` seems intended to modify `groups`. However, it only alters local memory variables without affecting `groups`. As a result, the modifications within this loop do not contribute to the final returned value, rendering the loop functionally redundant and a potential source of gas wastage. ----- In addition to the primary issue in the `FulfillmentLib.bundleByMatchable()` function, it is important to note that other functions in the system: - `FulfillmentPrepLib.getDetails()` - `FulfillmentPrepLib.getFulfillAvailableDetailsFromReferences()` - `FulfillmentPrepLib.getMatchDetailsFromReferences()` rely on the output of `FulfillmentLib.bundleByMatchable()`. The issue not only affects the direct callers but also cascades to other parts of the system where these functions are used, potentially leading to widespread inaccuracies or logic flaws.
Open the reportIn the function `FulfillmentPrepLib.getFulfillmentMatchContext()`, the boolean variable `itemCategorySet` is initialized as `false` and is intended for use in conditional checks within the function. However, `itemCategorySet` is never modified after its initial declaration. This static usage renders any conditions that depend on `itemCategorySet` ineffective, as they do not dynamically reflect the state of the function's execution. Consequently, these conditional checks either represent a logical oversight, failing to capture the intended logic, or they contribute to unnecessary gas consumption by executing redundant code. ---- In addition to the primary issue, it is important to note that the function `MatchableItemReferenceGroupLib.getMatchDetails()` relies on the output of `FulfillmentPrepLib.getFulfillmentMatchContext()`. The issue not only affects the direct caller but also cascades to other parts of the system where this function is used, potentially leading to widespread inaccuracies or logic flaws.
Open the reportWhen `swapAndLiquify()` is called, `swapping` is set to true. The transaction will include a secondary call to function `transfer()`. Even though `swapping` is true, function `taxableEvent()` still allows for the possibility of taxes to be taken in the secondary transfer.
Open the reportThe `pause()` is designed to pause the `SquidGrow` token transfer only for one hour. So that if there is a liquidity injection using the SAM contract trading can be paused to avoid sandwich attacks. However, the trade can only be paused once within a 24-hour period, with a maximum pause duration of 1 hour. This leaves 23 hours during which trading remains active. During these 23 hours, if liquidity is injected using the SAM contract, there is still a risk of a sandwich attack. ```solidity=78 /** * @notice Pauses all token transfers for exactly one hour. * @dev Can only be called by an account with the DEFAULT_ADMIN_ROLE. This function can only be called once every 24 hours. */ function pause() external onlyRole(DEFAULT_ADMIN_ROLE) { if (block.timestamp < lastPauseTime + 24 hours) revert PauseAlreadyTriggered(); lastPauseTime = block.timestamp; tradingPausedUntil = block.timestamp + 1 hours; } ```
Open the reportThe comment for the `renounceRole()` function states that it allows users to renounce their granted roles. However, according to the code logic of the `renounceRole()` function, only accounts with the `DEFAULT_ADMIN_ROLE` can access the function to renounce this `DEFAULT_ADMIN_ROLE` role. ```solidity=172 /** * @dev Allows someone to renounce their `role` from `account`. Also removes the account from the whitelist. * Requirements: the caller must have ``role``'s admin role. * May emit a {RoleRevoked} event. */ function renounceRole() public virtual override onlyRole(DEFAULT_ADMIN_ROLE) { whitelisted[msg.sender] = false; _revokeRole(DEFAULT_ADMIN_ROLE, msg.sender); } ```
Open the reportThe Cross-Site WebSocket Hijacking involves a Cross-Site Request Forgery (CSRF) vulnerability on a WebSocket handshake. WebSockets are not constrained by the same-origin policy, allowing an attacker to initiate a WebSocket request from a malicious webpage targeting the `wss://` endpoint of the target URL. Since this request is a regular HTTPS request, browsers send cookies and HTTP-Authentication headers along, even cross-site. During testing, only the `quote` action could be executed because the backend performs multiple checks on the rest of the actions that prevent the exploitation of this vulnerability.
Open the reportThe codebase contains if statements with two or more subsequent branches have duplicated code. This redundancy increases code complexity and introduces unnecessary processing. - `packages/server/src/osmosis/osmosis-concentrated-liquidity-pool.ts:82,86,90` ```typescript=80 if(e_quote instanceof Error) { // ignore not enough liquidity errors if(/[nN]ot enough (quoted|ticks|liquidity)/.test(e_quote.message)) { return 0n; } // ignore spot price errors else if(/[sS]pot price can't be/.test(e_quote.message)) { return 0n; } // negative fee charge else if(/[fF]ee charge should be non-negative/.test(e_quote.message)) { return 0n; } ``` - `packages/server/src/shade/shade-stableswap-pool.ts:64,67,70` ```typescript=61 if(e_calculate instanceof Error) { const s_msg = e_calculate.message; if(/slippage/.test(s_msg)) { return YG_ZERO; } else if(/[tT]rade size must be positive/.test(s_msg)) { return YG_ZERO; } else if(/price impact/.test(s_msg)) { return YG_ZERO; } } ```
Open the report**Dependency/Library** Important operations within the application, such as address/wallet generation, transaction signing, and broadcasting transactions to the blockchain, is implemented by calling functions in third-party dependencies listed below. The scope of the penetration test treats out-of-scope libraries as black boxes and assumes their functional correctness. However, in the real world, out-of-scope libraries can contain vulnerabilities, and this may lead to lost or stolen assets. - @blake.regalia/belt - @solar-republic/* - @axelar-network/axelarjs-sdk - @shadeprotocol/shadejs - @osmosis-labs/* - @0xsquid/sdk **On-chain Smart Contract** To swap tokens, the application interacts with Axelar's and CCTP Smart Contracts, and differents Cosmos applications.
Open the reportSilentSwap application is designed with a focus on maintaining user privacy during token swaps. However, the web application sends both the source and destination addresses to the backend. The centralization of these data could pose a privacy risk for the user. Specifically, due to the sender address. The sender address is used by SilentSwap in the `enforce_aml_blacklist()` function. This function checks the address against the Chainanalysis blacklist and it is called from the `engage()` function in `packages/server/src/flow/engage.ts:82` ```typescript export async function engage(k_user: User, g_req: EngageRequest): Promise<EngageResponse> { ... // validate the send from address if(s_addr_send_from) { // check AML blacklist await enforce_aml_blacklist(g_req.sendFrom=getAddress(s_addr_send_from)); } ... ``` The sender address is also used to obtain the swap route from the Squid SDK in `packages/server/src/flow/engage-axelar.ts:110`. ```typescript const gc_squid: GetRoute = { fromChain: n_evm_chain_id, fromAddress: s_addr_send_from? getAddress(s_addr_send_from): S_ADDR_EVM_PHONY, fromToken: s_addr_token_source, toChain: si_cosmos_chain, toAddress: sa_reducer, toToken: k_token.denom, fromAmount: g_source.amount, slippage: X_SLIPPAGE_SQUID_PCT, enableExpress: true, }; ``` However, the `fromAddress` parameter is not used in some test files in the Squid repository. For example: - https://github.com/0xsquid/squid-sdk/blob/9ed0d84f12fec1b982721e873b1d39e439e9503b/src/scripts/utils.ts:110 During the tests it was not possible to test the SDK since an `integrationId` is required. In the same file, the sender address is also used at line 444. ```typescript const y_transferred = y_receipt.logs.map(y_log => yi_erc20.parseLog(y_log)) .find(y_desc => 'Transfer' === y_desc?.name && s_addr_send_from === y_desc.args['from']); ``` Although SilentSwap does not store the source address on its server, it could be recorded in server logs, either on SilentSwap's servers or on Squid's servers. This centralization and potential logging of sensitive information could compromise user privacy, although it has been classified as an informative finding since no active storage is performed.
Open the reportThe function `Event.returnValue()` is deprecated. - `packages/client/src/screens/OrderTracking.svelte:112` ```typescript const f_on_unload = (d_event: Event) => { d_event.preventDefault(); d_event.returnValue = true; }; ``` For more information: - https://developer.mozilla.org/en-US/docs/Web/API/Event/returnValue
Open the reportThe result of the "npm audit" command run against repository shows that the application is using outdated libraries with known vulnerabilities. Server package:  Client package:  Shared package: 
Open the reportThe different fees in LPLock.sol are not correlated with each other and they could add up to more than 100% (even using different tokens), while it should be guaranteed that the fees are bound to a reasonable amount as a sum.
Open the reportReading, initializing, and modifying storage variables cost more gas than operating local variables, and this gas cost can significantly increase when these operations are performed inside a loop. Reference: https://docs.soliditylang.org/en/latest/introduction-to-smart-contracts.html#storage-memory-and-the-stack ```solidity=468 NONCE++; ```
Open the reportThere should always be events emitted in the sensitive functions that are controlled by centralization roles.
Open the reportThe contracts `KnoxLpLocker` and `KnoxTokenLocker` inherit functionalities from the `Ownable` contract such as the `transferOwnership()` that allows setting the new `owner` without guaranteeing the designated account is able to actuate transactions on-chain. A similar approach should be adopted for the `transferLockOwnership` function of both `vesting` and `LPLock` contracts in which the ownership of the lock is transferred to a `newOwner. If the `newOwner` cannot actuate transactions on-chain, the lock will be stuck forever.
Open the reportThe smart contract does not check or store the return value of an external call in a local or state variable, which may introduce vulnerabilities due to the unhandled outcome. ```solidity=164 feeWhitelist.add(_user); ``` --- ```solidity=166 feeWhitelist.remove(_user); ``` --- ```solidity=289 lockedTokens.add(_lpToken); ``` --- ```solidity=293 user.lockedTokens.add(_lpToken); ``` --- ```solidity=364 users[msg.sender].lockedTokens.remove(_lpToken); ``` --- ```solidity=470 user.lockedTokens.add(_lpToken); ``` --- ```solidity=479 users[msg.sender].lockedTokens.remove(_lpToken); ``` --- ```solidity=512 users[msg.sender].lockedTokens.remove(_lpToken); ``` --- ```solidity=517 migrator.migrate(_lpToken, _amount, userLock.unlockDate, msg.sender); ``` --- ```solidity=338 TOKEN_WHITELISTERS.add(_user); ``` --- ```solidity=340 TOKEN_WHITELISTERS.remove(_user); ``` --- ```solidity=358 ZERO_FEE_WHITELIST.add(_token); ``` --- ```solidity=369 ZERO_FEE_WHITELIST.add(_token); ``` --- ```solidity=371 ZERO_FEE_WHITELIST.remove(_token); ``` --- ```solidity=454 IUnlockCondition(lock_param.condition).unlockTokens(); ``` --- ```solidity=460 TOKENS.add(_token); ``` --- ```solidity=465 user.lockedTokens.add(_token); ``` --- ```solidity=665 newOwner.lockedTokens.add(transferredLock.tokenAddress); ```
Open the reportWhen transferring standard ERC20 deflationary tokens, the input amount may not be equal to the received amount due to the charged transaction fee. As a result, an inconsistency in the amount will occur and the transaction may fail due to the validation checks.
Open the reportOne or more parameters with `memory` data location are never modified in their functions and those functions are never called internally within the contract. Thus, their data location can be changed to `calldata` to avoid the gas consumption copying from calldata to memory. ```solidity=479 function getAmountsOut( ``` `getAmountsOut` has memory location parameters: `path`. --- ```solidity=146 function getAmountsIn( ``` `getAmountsIn` has memory location parameters: `path`.
Open the reportThe functions `approve()`, `permit()` and `transfer()/transferFrom()` allows zero address as destination address. Then if users transfer funds to zero address by mistake, the funds can not be transferred out and are locked up forever. See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.2/contracts/token/ERC20/ERC20.sol
Open the reportThere should always be events emitted in the sensitive functions that are controlled by centralization roles.
Open the reportAddresses should be checked before assigning to make sure they are not zero addresses.
Open the reportAddresses are not validated before assignment or external calls, potentially allowing the use of zero addresses and leading to unexpected behavior or vulnerabilities. For example, transferring tokens to a zero address can result in a permanent loss of those tokens. ```solidity=19 feeToSetter = _feeToSetter; ``` - `_feeToSetter` is not zero-checked before being used. --- ```solidity=45 feeTo = _feeTo; ``` - `_feeTo` is not zero-checked before being used. --- ```solidity=50 feeToSetter = _feeToSetter; ``` - `_feeToSetter` is not zero-checked before being used. --- ```solidity=69 token0 = _token0; ``` - `_token0` is not zero-checked before being used. --- ```solidity=70 token1 = _token1; ``` - `_token1` is not zero-checked before being used.
Open the reportThe `to` parameter in the following functions is missing a check that it is not `address(0)`: 1. **`_transfer()` Function:** Without the `address(0)` check, tokens can be inadvertently transferred to the zero address. Since there's no way to retrieve tokens sent to this address, they would be lost forever, reducing the effective circulating supply while not adjusting the `totalSupply`. 2. **`_mint()` Function:** In the absence of this check, tokens could be minted directly to the zero address. This would increase the `totalSupply` counter without adding to the effective circulating supply, creating a discrepancy between the two. 3. **`_burn()` Function:** If tokens are burnt from the zero address without a corresponding mint having taken place, it could lead to the `totalSupply` being reduced more than the actual tokens being burnt, again leading to a discrepancy between the `totalSupply` and the effective circulating supply.
Open the reportPerforming division by zero would raise an error and revert the transaction. ```solidity=124 liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); ``` The expression `amount0.mul(_totalSupply) / _reserve0` may divide by zero. Its divisor has has estimated interval [0, 5192296858534827628530496329220095]. --- ```solidity=145 amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution ``` The expression `liquidity.mul(balance0) / _totalSupply` may divide by zero. Its divisor has has estimated interval [-115792089237316195423570985008687907853269984665640564039457584007913129639935, pinf]. --- ```solidity=146 amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution ``` The expression `liquidity.mul(balance1) / _totalSupply` may divide by zero. Its divisor has has estimated interval [-115792089237316195423570985008687907853269984665640564039457584007913129639935, pinf]. --- ```solidity=86 amountIn = (numerator / denominator).add(1); ``` The expression `numerator / denominator` may divide by zero. Its divisor has has estimated interval [ninf, pinf]. --- ```solidity=19 z = x / uint224(y); ``` The expression `x / uint224(y)` may divide by zero. Its divisor has has estimated interval [0, 5192296858534827628530496329220095].
Open the reportThe 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=20 address public token0; ``` - The contract `SGSPair` interacts with third party contract with `IERC20` interface via `token0`. --- ```solidity=21 address public token1; ``` - The contract `SGSPair` interacts with third party contract with `IERC20` interface via `token1`. --- ```solidity=160 address to, ``` - The function `SGSPair.swap` interacts with third party contract with `ISGSCallee` interface via `to`.
Open the reportThe return values of the `transfer()` and `transferFrom()` calls in the smart contract are not checked. Some ERC-20 tokens' transfer functions return no values, while others return a bool value, they should be handled with care. If a function returns `false` instead of reverting upon failure, an unchecked failed transfer could be mistakenly considered successful in the contract. ```solidity=137 ISGSPair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair ``` --- ```solidity=110 ISGSPair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair ```
Open the reportThe contract has unlocked compiler version. An unlocked compiler version in the source code of the contract permits the user to compile it at or above a particular version. This, in turn, leads to differences in the generated bytecode between compilations due to different compiler versions. This can lead to an ambiguity when debugging as compiler specific bugs may occur in the codebase that would be hard to identify over a span of multiple compiler versions rather than a specific one.
Open the reportThe smart contract does not check or store the return value of an external call in a local or state variable, which may introduce vulnerabilities due to the unhandled outcome. ```solidity=44 ISGSFactory(factory).createPair(tokenA, tokenB); ``` --- ```solidity=139 (address token0, ) = SGSLibrary.sortTokens(tokenA, tokenB); ``` --- ```solidity=253 (address token0, ) = SGSLibrary.sortTokens(input, output); ``` --- ```solidity=375 (address token0, ) = SGSLibrary.sortTokens(input, output); ``` --- ```solidity=381 (uint256 reserve0, uint256 reserve1, ) = pair.getReserves(); ``` --- ```solidity=41 ISGSFactory(factory).createPair(tokenA, tokenB); ``` --- ```solidity=112 (address token0,) = SGSLibrary.sortTokens(tokenA, tokenB); ``` --- ```solidity=173 (address token0,) = SGSLibrary.sortTokens(input, output); ``` --- ```solidity=47 (uint256 reserve0, uint256 reserve1, ) = ISGSPair(pairFor(factory, tokenA, tokenB)).getReserves(); ```
Open the report```solidity=19 address public factory; ``` The `factory` variable assigned in the constructor of the `PancakePair` contract 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.
Open the reportThe code contains `TODO` comments. Those comments were not considered during the audit.
Open the reportIn the `validateOfferItemApprovalAndBalance()` function, for native `itemType`, the offerer's native token balance is checked. However, rather than using the real-time `address.balance`, the balance is taken from `orderParameters.offerer.balance`, which is provided as a parameter. This approach can lead to inaccuracies due to human error or subsequent balance changes.
Open the reportOne or more parameters with `memory` data location are never modified in their functions and those functions are never called internally within the contract. Thus, their data location can be changed to `calldata` to avoid the gas consumption copying from calldata to memory. ```solidity=58 function getFulfillAvailableExecutions( ``` `getFulfillAvailableExecutions` has memory location parameters: `fulfillmentDetails`, `offerFulfillments`, `considerationFulfillments`, `orderDetails`. --- ```solidity=221 function getStandardExecutions( ``` `getStandardExecutions` has memory location parameters: `details`. --- ```solidity=382 function getBasicExecutions( ``` `getBasicExecutions` has memory location parameters: `details`. --- ```solidity=453 function createMirrorOrderParameters( ``` `createMirrorOrderParameters` has memory location parameters: `orderParameters`. --- ```solidity=118 function toOrderDetails( ``` `toOrderDetails` has memory location parameters: `order`, `orderHashes`, `unavailableReasons`. --- ```solidity=134 function toOrderDetails( ``` `toOrderDetails` has memory location parameters: `orders`, `resolvers`, `orderHashes`, `unavailableReasons`.
Open the reportThe smart contract contains low-level calls such as `.call()`, `.delegatecall()`, and `.staticcall()`. Since these calls bypass some of the automatic checks that Solidity provides, like function type checks, they can introduce vulnerabilities, logic errors, or unexpected behavior. ```solidity=10 (bool success, bytes memory res) = target.staticcall(callData); ``` --- ```solidity=30 (bool success, bytes memory res) = target.staticcall(callData); ``` --- ```solidity=51 (bool success, bytes memory res) = target.staticcall(callData); ``` --- ```solidity=63 (bool success, bytes memory res) = target.staticcall(callData); ```
Open the reportThe **item** is defined as a struct of memory type. When its internal attribute values change, they are not stored on the blockchain. Therefore, any changes to its attribute values are meaningless. In some cases, this may lead to severe consequences, such as incorrect recording of balance. ```solidity=732 item.amount = 0; ```
Open the reportWhen running `test` on the test folder, an error occurs: run `yarn test:ref` ``` bash 379 passing (1m) 14 pending 2 failing 1) Additional recipients off by one error allows skipping second consideration Bob attempts to fill the order without paying Carol "before all" hook for "Bob attempts to fulfill Alice's order with malicious calldata, but the transaction reverts": Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.7.0) (argument="considerationToken", value=undefined, code=INVALID_ARGUMENT, version=abi/5.7.0) at Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28) at Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20) at Logger.throwArgumentError (node_modules/@ethersproject/logger/src.ts/index.ts:285:21) at AddressCoder.Coder._throwError (node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts:68:16) at AddressCoder.encode (node_modules/@ethersproject/abi/src.ts/coders/address.ts:22:18) at /Users/liuhao/Downloads/Inkubate-Marketplace-59de56ca1e7427f0a68acc463604b75ebddfaa0c/node_modules/scuffed-abi/dist/ethers-overrides.js:304:19 at Array.forEach (<anonymous>) at pack (node_modules/scuffed-abi/dist/ethers-overrides.js:263:12) at TupleCoder.tuple_1.TupleCoder.encode (node_modules/scuffed-abi/dist/ethers-overrides.js:196:12) at /Users/liuhao/Downloads/Inkubate-Marketplace-59de56ca1e7427f0a68acc463604b75ebddfaa0c/node_modules/scuffed-abi/dist/ethers-overrides.js:282:19 2) Reverts (Inkubate v1.0-reference) Changing chainId Reverts on changed chainId: RangeError: Maximum call stack size exceeded ``` It seems that `considerationToken` wasn't passed to the proper address. run `forge test` ```bash Encountered 1 failing test in test/foundry/zone/PostFulfillmentCheck.t.sol:PostFulfillmentCheckTest [FAIL. Reason: Setup failed: failed to read from "/Users/liuhao/Downloads/Inkubate-Marketplace-59de56ca1e7427f0a68acc463604b75ebddfaa0c/optimized-out/ConduitController.sol/ConduitController.json": No such file or directory (os error 2)] setUp() (gas: 0) Encountered 1 failing test in test/foundry/zone/TestTransferValidationZoneFuzz.t.sol:TestTransferValidationZoneOffererTest [FAIL. Reason: Setup failed: failed to read from "/Users/liuhao/Downloads/Inkubate-Marketplace-59de56ca1e7427f0a68acc463604b75ebddfaa0c/optimized-out/ConduitController.sol/ConduitController.json": No such file or directory (os error 2)] setUp() (gas: 0) Encountered a total of 42 failing tests, 111 tests succeeded ``` It seems that the `ConduitController.json` file is missing.
Open the reportThe contract is serving as the underlying entity to interact with one or more out-of-scope protocols. The scope of the audit treats these as black boxes and assumes their functional correctness. ```solidity=76 ConduitControllerInterface internal immutable _CONDUIT_CONTROLLER; ``` - The contract `ConsiderationBase` interacts with third-party contract with `ConduitControllerInterface` interface via `_CONDUIT_CONTROLLER`. ```solidity=579 ConsiderationInterface inkubate = ConsiderationInterface(inkubateAddress); ``` - The contract `InkubateValidator` interacts with third-party contract with `ConsiderationInterface` interface via `inkubate`. ```solidity=76 CreatorFeeEngineInterface public immutable creatorFeeEngine; ``` - The contract `InkubateValidatorHelper` interacts with third-party contract with `CreatorFeeEngineInterface` interface via `creatorFeeEngine`. ```solidity=4 import { LibPRNG } from "solady/src/utils/LibPRNG.sol"; import { LibSort } from "solady/src/utils/LibSort.sol"; ``` - The protocol's library `helpers/sol/fulfillments/lib/FulfillmentLib.sol` uses functions from: - "solady/src/utils/LibPRNG.sol"; - "solady/src/utils/LibSort.sol"; - Assumptions made within the scope of this audit include: - `LibPRNG.sol` is a library for generating pseudorandom numbers; - `LibSort.sol` is a library for efficient sorting of memory arrays;
Open the reportPerforming division by zero would raise an error and revert the transaction. ```solidity=478 uint256 amount = uint256(order.denominator / order.numerator); ``` The expression `order.denominator / order.numerator` may divide by zero. Its divisor has has estimated interval [0, 1329227995784915872903807060280344575]. --- ```solidity=509 uint256 amount = uint256(order.denominator / order.numerator); ``` The expression `order.denominator / order.numerator` may divide by zero. Its divisor has has estimated interval [0, 1329227995784915872903807060280344575]. --- ```solidity=596 newValue = value - (diffToPrevMultiple / numerator); ``` The expression `diffToPrevMultiple / numerator` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=600 newValue = value + (diffToNextMultiple / numerator); ``` The expression `diffToNextMultiple / numerator` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=486 uint256 absoluteMax = type(uint256).max / overflowBottleneck; ``` The expression `type()(uint256).max / overflowBottleneck` may divide by zero. Its divisor has has estimated interval [-115792089237316195423570985008687907853269984665640564039457584007913129639935, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=487 uint256 fractionCompatibleMax = (absoluteMax / denominator) * ``` The expression `absoluteMax / denominator` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=491 newStartAmount = (newStartAmount / denominator) * denominator; ``` The expression `newStartAmount / denominator` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935]. --- ```solidity=495 newEndAmount = (newEndAmount / denominator) * denominator; ``` The expression `newEndAmount / denominator` may divide by zero. Its divisor has has estimated interval [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935].
Open the reportThe `InkubateValidatorHelper` contract is employed to validate the legitimacy of order information. Depending on the outcomes of various checks, it returns either an error or a warning. For instance, a warning is issued when the order's consideration has duplicate data. We want to understand the basis for the return of error or warning is what. ```solidity=1109 // Call to validateOrder reverted or returned invalid magic value errorsAndWarnings.addWarning(ZoneIssue.RejectedOrder.parseInt()); ``` In the provided code snippet, the `validateOrder()` function from the `ZoneParameters` is called. If this function call reverts or returns an invalid magic value, a warning is recorded in the `errorsAndWarnings`. The code is designed to treat a failed call to `validateOrder()`, whether due to non-existence or revert, as a warning rather than an error.
Open the reportIn the `validateOfferItemParameters()` function, when dealing with an `ERC721_WITH_CRITERIA` itemType, there is a specific check to ensure that the order type is a PARTIAL order, which is indicated by odd numbers, such as 1 or 3. On the contrary, when the itemType is `ERC1155_WITH_CRITERIA`, this check for the order type being PARTIAL is not performed. This inconsistency suggests that for `ERC1155_WITH_CRITERIA` items, the PARTIAL order type requirement is not enforced. ```solidity=760 if (offerItem.itemType == ItemType.ERC721) { // ERC721 type requires amounts to be 1 if (offerItem.startAmount != 1 || offerItem.endAmount != 1) { errorsAndWarnings.addError(ERC721Issue.AmountNotOne.parseInt()); } // Check the EIP165 token interface if (!checkInterface(offerItem.token, ERC721_INTERFACE_ID)) { errorsAndWarnings.addError(ERC721Issue.InvalidToken.parseInt()); } } else if (offerItem.itemType == ItemType.ERC721_WITH_CRITERIA) { // Check the EIP165 token interface if (!checkInterface(offerItem.token, ERC721_INTERFACE_ID)) { errorsAndWarnings.addError(ERC721Issue.InvalidToken.parseInt()); } if (offerItem.startAmount > 1 || offerItem.endAmount > 1) { // Require partial fill enabled. Even orderTypes are full if (uint8(orderParameters.orderType) % 2 == 0) { errorsAndWarnings.addError( ERC721Issue.CriteriaNotPartialFill.parseInt() ); } } } else if ( offerItem.itemType == ItemType.ERC1155 || offerItem.itemType == ItemType.ERC1155_WITH_CRITERIA ) { // Check the EIP165 token interface if (!checkInterface(offerItem.token, ERC1155_INTERFACE_ID)) { errorsAndWarnings.addError( ERC1155Issue.InvalidToken.parseInt() ); } ```
Open the reportThe linked code does not affect the functionality of the codebase and appears to be either remnants of test code or older functionality.
Open the reportThe linked import statements specified a redundant code path. ```solidity import { IssueParser, ... } from "../lib/InkubateValidatorTypes.sol"; ``` ----- instead of ```solidity import { IssueParser, ... } from "./InkubateValidatorTypes.sol"; ```
Open the reportSome state variables are not used in the codebase. This can lead to incomplete functionality or potential vulnerabilities if these variables are expected to be utilized. Variable `AMOUNT_SHL_OFFSET` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=15 uint256 private constant AMOUNT_SHL_OFFSET = 16; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `ORDER_INDEX_SHL_OFFSET` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=16 uint256 private constant ORDER_INDEX_SHL_OFFSET = 8; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `BYTE_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=17 uint256 private constant BYTE_MASK = 0xFF; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `AMOUNT_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=18 uint256 private constant AMOUNT_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `ORDER_INDEX_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=20 uint256 private constant ORDER_INDEX_MASK = 0xFF00; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `ITEM_INDEX_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=21 uint256 private constant ITEM_INDEX_MASK = 0xFF; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `NOT_AMOUNT_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=22 uint256 private constant NOT_AMOUNT_MASK = 0xFFFF; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `NOT_ORDER_INDEX_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=23 uint256 private constant NOT_ORDER_INDEX_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FF; ``` ```solidity=12 library MatchComponentType { ``` --- Variable `NOT_ITEM_INDEX_MASK` in `MatchComponentType` is never used in `MatchComponentType`. ```solidity=25 uint256 private constant NOT_ITEM_INDEX_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00; ``` ```solidity=12 library MatchComponentType { ```
Open the reportThe smart contract contains one or more values that are not used, which can lead to unnecessary complexity and reduced maintainability. ```solidity=95 let _result := _data ``` - The variable `_result__getRoot_asm_0_hashLevel` is never used after this assignment. --- ```solidity=204 let _result := _data ``` - The variable `_result__getProof_asm_0_hashLevel` is never used after this assignment.
Open the reportFunction `_transfer()` disallows an input `amount` to be zero. However, fees collected could be 100% of the `amount` value. In that case, `amountReceived` will be 0, and a user will have paid for a transaction in which the `recipient` gets nothing.
Open the reportOnce an account gains `isDistributor` status, it cannot be revoked.
Open the reportContract `SquidGrow` inherits abstract contract `Auth`. This contract specifies both an `owner` and uses a mapping `authorizations` to track privileged accounts. State variable `owner` and modifier `onlyOwner` are unused within the contract. As such, the cited functions and state variables are unneeded.
Open the reportPerforming integer division before multiplication truncates the low bits, losing the precision of calculation. ```solidity=278 uint256 feeAmount = amount.mul(getTotalFee(sender, recipient)).div(feeDenominator); ``` ```solidity=279 uint256 bAmount = feeAmount.mul(burnFee).div(totalFees); ``` --- ```solidity=355 uint256 acBNBa = acBNB.mul(_na).div(_da); ``` ```solidity=356 uint256 acBNBf = acBNBa.mul(25).div(100); ``` --- ```solidity=405 uint256 unitBalance= deltaBalance.div(denominator.sub(liquidity_divisor)); ``` ```solidity=406 uint256 BNBToAddLiquidityWith = unitBalance.mul(liquidity_divisor); ```
Open the reportThe approval function of the ERC20 standard possesses a well-known vulnerability whereby two consecutive approvals can be exploited to instead “reset” the approval by consuming the approval that is meant to be replaced with a new one.
Open the reportFunction `setstartSwap()` can be updated more than once, which updates the `startedTime` to `block.timestamp.add(_input)`. If this function is called after `startedTime` has passed the first time, then any user making a transfer in the same block as the update may be subject to the 99% transfer fee.
Open the reportFunction `getCirculatingSupply()` has the following formula: ```solidity return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(address(0))); ``` The `_totalSupply` already excludes the `balanceOf(address(0))`, and this value should not be subtracted away. Since tokens cannot be transferred to `address(0)` and since there is no burning mechanic which sends tokens tokens to `address(0)`, the inaccurate formula will show the correct value.
Open the reportThe conditional logic of the cited functions appears to allow for unforeseen fringe cases that may cause issues in the protocol. As set up, it is difficult to determine the meaning behind the checks made in each of the functions. Please clarify what each `if` condition is meant to determine in the functions cited. Additionally some of the logic appears to be counter to its intended use. For instance, function `checkBot()` may set either the `sender` or `recipient` as true in mapping `isBot` if the `msg.sender` is not the `tx.origin`. However, a recipient has no control over who sends tokens to them, and the `msg.sender` is never `tx.origin` when the `sender` is the `pair` address. If the `pair` address is updated to not be internal, then both the `pair` address and the `recipient` are set as bots. The `pair` being set as a bot may produce complications within the contract logic.
Open the reportThe transaction may be charged fees, so the max holding of the receiver should be the sum of the held tokens and the amount received from the transfer. The fees should not be included in the max holding. ```solidity=259 require((_balances[recipient].add(amount)) <= _maxWalletToken, "Exceeds maximum wallet amount.");} ``` - Max holding is checked. ```solidity=239 uint256 amountReceived = shouldTakeFee(sender, recipient) ? taketotalFee(sender, recipient, amount) : amount; ``` - Receiving amount is adjusted. ```solidity=240 _balances[recipient] = _balances[recipient].add(amountReceived); ``` - Balance is increased by the adjusted amount.
Open the reportSensitive functions controlled by privileged roles or which make important updates to the project should emit events.
Open the reportThe following checks should be made for input parameters. ### SquidGrow.sol - Function `setFeeExempt()` is missing a check that `_address` is not labeled as a bot. - Function `setisBot()` is missing a check that the `_address` is not `DEAD`. - Function `setisBot()` is missing a check that the `_address` is not exempt from fees. - Function `setPairReceiver()` is missing a check that `_address` is not `DEAD`. - Function `setDivisors()` is missing a check that the sum of the inputs is nonzero; if all values are set to 0, this will cause a revert in function `swapAndLiquify()`. - Function `setStructure()` is missing a check that the sum of `transferFee` and `totalFee` does not exceed 100% of the transfer amount.
Open the reportAddresses should be checked before assignment or external call to ensure `address(0)` is not used.
Open the reportThe use of 19 as the `_decimals` value may cause the token to be incompatible with some projects.
Open the reportWhen function `transferOwnership()` is called, the `owner` is changed to the new input `adr`, but the previous owner address remains in the `authorizations` mapping as `true`.
Open the reportState variables that never change should be declared as `constant` to save gas.
Open the reportThe linked `transfer()` invocation does not check the return value of the function call which should yield a `true` result in case of proper ERC-20 implementation.
Open the reportThe `SafeMath` library is used unnecessarily. With Solidity compiler versions 0.8.0 or newer, arithmetic operations will automatically revert in case of integer overflow or underflow.
Open the reportUse of Solidity's `transfer()` and `send()` functions for transferring Ether is not recommended, since some contracts may not be able to receive the funds. The cited functions forward only a fixed amount of gas (2300 specifically) and the receiving contracts may run out of gas before finishing the transfer. Also, EVM instructions' gas costs may increase in the future. Thus, some contracts that can receive now may stop working in the future due to the gas limitation.
Open the reportVariables 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. An advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they are not located in storage.
Open the reportA vast majority of the `SquidGrowBridge` contract is derived from [`OFTCore`](https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v1/OFTCore.sol) by "LayerZero." This falls outside the audit's scope. And the `SquidGrowBridge` contract relies on `lzEndpoint` for sending and receiving messages, which also falls outside the audit's scope. While our audit assumes the functional correctness of out-of-scope entities and treats them as black boxes, issues and privileged functions in `OFTCore` and `lzEndpoint` could impact the entire project. We are not responsible for any issue caused by them. ```solidity=1951 contract SquidGrowBridge is Ownable, OFTCore { ```
Open the reportBased on discussion with the team, the contract `SquidGrowILO` has two separate purposes: 1. On BSC, users are supposed to interact with function `depositTokensForAirdrop()` to deposit their currently existing `squidGrowToken` into the contract. This is the only functionality that the user should interact with on BSC. 2. On ETH, users are supposed to interact with the following functions: - `publicContribution()` - `whitelistContribution()` - `claimAirdrop()` On ETH, a user can call `claimAirdrop()` to collect an airdrop reserved for them of the ETH `squidGrowToken` based on a snapshot of their deposit in the contract on BSC. Otherwise, they can purchase an initial offering of the token using native ether through function `publicContribution()` or `whitelistContribution()`. With this in mind, if the current version of `SquidGrowILO` is deployed on either platform, each instance of the contract will contain functionality that does not pertain to its intended purpose on that platform. Including extra functionality in a contract allows for the possibility of interaction with that functionality, if the contract is improperly set up. To remove this possibility, we recommend creating two separate contracts which only contain the logic that is specific to the contract's purpose on each platform.
Open the reportFunction `setStatus()` does not check the state of bool `claimable` before being updated to `status` 1 or 2. Likewise, function `setClaimable()` does not check the `status` is 0 before allowing the variable to be updated to `true` If it is not the intention to allow users to purchase the `squidGrowToken` at the same time they can claim an airdrop, we recommend adding checks in each of these functions preventing the simultaneous activation of both. If the protocol allows for both to be activated at the same time by intention, then please confirm this is the case. --- Second, users can call function `depositTokensForAirdrop()` at any time, even when `claimable` is set to `true`. If `SGIOU` tokens are supposed to be acquired during a certain timeframe in order to be part of the airdrop, we recommend adding a mechanic that prevents users from using function `depositTokensForAirdrop()` after the timeframe is closed.
Open the reportAs a general practice, use of `abi.encodePacked` is discouraged, since it is susceptible to hash collisions in some instances where dynamically-sized inputs are used consecutively. While this is not the case in this instance, we also note that `abi.encodePacked` may be removed in future solidity versions (see this issue: [https://github.com/ethereum/solidity/issues/11593](https://github.com/ethereum/solidity/issues/11593)).
Open the reportIn the function `updateBridgeFee`, the state variable is checked that it is not larger than `MAX_BRIDGE_FEES`. Therefore the `_bridgeFee` can be arbitrarly set by the `governor` account. If _bridgeFee is set larger than `MAX_BRIDGE_FEES` then _bridgeFee can no longer be updated.
Open the reportThe `SquidGrowStaking` contract inherits `IERC721Receiver` and implements function `onERC721Received()` as follows: ```solidity=871 function onERC721Received( address, address, uint256, bytes calldata ) external pure override returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } ``` Any user who calls `safeTransferFrom()` on their own to send their token directly to the contract will have their token accepted by the `SquidGrowStaking` contract, but it will not be retrievable by the user, since they did not use `depositNft()` to send the NFT to the contract.
Open the reportEvents should be emitted in sensitive functions controlled by centralization roles.
Open the reportSensitive functions controlled by privileged roles or which make important updates to the project should emit events.
Open the reportThe following checks should be made for input parameters. ### SquidStaking - Function `add()` is missing a check that `_stakedToken` has not already been added to the `poolInfo` array. If the `_stakedToken` address is added more than once, this could cause volatile issues within the staking contract.
Open the reportAddresses should be checked before assignment or external call to ensure `address(0)` is not used.
Open the reportState variables that never change should be declared as `constant` to save gas.
Open the reportThe `SafeMath` library is used unnecessarily. With Solidity compiler versions 0.8.0 or newer, arithmetic operations will automatically revert in case of integer overflow or underflow.
Open the reportVariables 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. An advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they are not located in storage.
Open the reportWhen the same Token is added more than once in the function `addToken()`, the existing token data will be overwritten. The current implementation is relying on the operation correctness to avoid repeatedly adding the same pool, as the admin will only call the function.
Open the reportOne or more parameters with `memory` data location are never modified in their functions and those functions are never called internally within the contract. Thus, their data location can be changed to `calldata` to avoid the gas consumption copying from calldata to memory. ```solidity=25 function addToken(string memory names, address tokensAddress, uint256 id) public { ``` `addToken` has memory location parameters: `names`. --- ```solidity=32 function removeToken(string memory name) public { ``` `removeToken` has memory location parameters: `name`.
Open the reportAddresses should be checked before assignment or external call to make sure they are not zero addresses. ```solidity=59 owner = _owner; ``` - `_owner` is not zero-checked before being used.
Open the report| Address | Chain | Source code |
|---|---|---|
| 0x8847…c7650x88479186bac914e4313389a64881f5ed0153c765 | Chain: Ethereum | Source code: Verified source |
| 0x8847…c7650x88479186bac914e4313389a64881f5ed0153c765 | Chain: BNB Chain | Source code: Verified source |
| 0x44b9…2c6c0x44b9f1c5c9c233d8f21a4ef45b020037fedc2c6c | Chain: BNB Chain | Source code: Verified source |
| 0x44b9…2c6c0x44b9f1c5c9c233d8f21a4ef45b020037fedc2c6c | Chain: Ethereum | Source code: Verified source |
| 0xc3e4…48430xc3e4b224d2174edfd6a4360bee67e4cf8f674843 | Chain: BNB Chain | Source code: Verified source |
| 0xc3e4…48430xc3e4b224d2174edfd6a4360bee67e4cf8f674843 | Chain: Ethereum | Source code: Verified source |
| 0xb405…96ad0xb4056fe94dca4dcfcb6b9d830434d4abc98496ad | Chain: Ethereum | Source code: Verified source |
| 0xb405…96ad0xb4056fe94dca4dcfcb6b9d830434d4abc98496ad | Chain: BNB Chain | Source code: Verified source |
| 0xb72e…da980xb72e76ccf005313868db7b48070901a44629da98 | Chain: Ethereum | Source code: Verified source |
Trustblock holds 16 public audit reports for SquidGrow, dated 13 Apr 2023 to 13 Sep 2024. The latest is by Hacken (“SquidGrow / KnoxLocker V2”).
2 security firms wrote the reports Trustblock holds for SquidGrow: CertiK and Hacken.
106 findings are still open or acknowledged in the firms’ reports: 16 high, 12 medium, 78 low (97 open, 9 acknowledged). Of 1 critical finding: marked fixed by the firm. 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="squidgrow"></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