CertiK reviewed Snapmuse (Snapmuse.io - Addendum) on 13 May 2024: 28 findings, 0 critical; 19 marked fixed, 9 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 | 2 | 0 | 4 |
| Medium | 1 | 0 | 2 |
| Low | 6 | 0 | 13 |
In the contract `CrossMintContext` the role `owner` has authority over the functions shown below: - `updateCrossMintFlag()`: Set the `CrossMint` role to a given address. - `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 a hacker to take advantage of this authority and set a new arbitrary `CrossMint` and mint a infite amount of `ERC1155`. --- In the contract `BaseSnapmuse1155` the role `owner` has authority over the functions shown below: **Minting/Token Transer Related** * `ownerMint()`: Mint an arbitrary amount to a given address. * `withdrawRevenue()` : Withdraw the revenue for a given address (SMX), receiver signature required. * `withdrawRevenueUSD()`: Withdraw the revenue for a given address (USD), receiver signature required. * `reimburseMintingPass()`: Reimburse a mintingpass for a given address in (SMX), receiver signature required. * `reimburseUSDMintingPass()`: Reimburse a mintingpass for a given address in (USD), receiver signature **not** required. * `withdraw()` : Withdraw the balance of the native token of the contract. * `withdrawOtherTokens()` : Withdraw any token held by the contract, including the usd token for token purchase. **Others** * `depositUserRevenue()`: Deposit revenue for a given address. **Note: the token transfer will be processed separately.** * `setTokenPrice()`: Set the token price (USD). **Note: the token price will affect the buying payment and also the reimbursement payment.** * `setMaxMintAmountPerWallet()`: Set the maximum amount for the minting number to an addresss. * `setSnapmuseTreasuryWalletAddress()`: Set the treasury wallet address (to receive the USD fees). * `setPayToken()`: Set the SMX contract address. * `setParityAddress()`: Set the parity contract address. * `setURI`: Set new base uri. * `cancelMintingPass()` : Cancel the minting, the function related to minting and withdrawing revenue will be blocked, and reimburse is enabled. * `completeDrop()`: Complete the minting, mint will be disabled and the minting pass can be converted to the creator pass. * `convertMintingPassesToCreatorPass()`: Converts minting pass to creator pass. * `renounceOwnership()`: Renounce the ownership of the 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 a hacker to take advantage of this authority and withdraw all the tokens of the contract or withdraw the revenue belonging to users. And `BaseSnapmuse1155` is inherited from `CrossMintContext`, all priority role capabilities reserved. --- In the contract `BaseSnapmuse1155` the role `CrossMint` has authority over the functions shown below: **Minting/Token Transfer Related** - `crossMint()` : Mint an arbitrary amount to a given address. - `crossMintUsdc()` : Mint an ERC1155 by transferring the correct USDC amount. Any compromise to the `owner` account may allow a hacker to take advantage of this authority and permits to mint an infinite amount of ERC1155. --- The contract `SnapmuseCreatorPass` is **inherited** from contract `BaseSnapmuse1155`. Beyond the privileged functions mentioned above, the role `owner` has extra authority over the functions below: - `mintAirDrop()` : Mint the airdrop to a batch of addresses. - `pause()`: Pause the contract for balance changing. - `unpause()`: Unpause the contract for balance changing. Any compromise to the `owner` account may allow a hacker to take advantage of this authority and permits to mint an infinite amount of addresses. --- In the contract `SnapmuseTokenVesting` the role `owner` has authority over the functions shown below: - `createVestingSchedule()` : Create a vesting. - `revoke()` : Revokes the vesting schedule for given identifier. - `withdraw()` : Withdraw the specified amount. - `withdrawOtherTokens()` : Withdraw stuck ERC-20 tokens. - `release()` : Release vested amount of tokens. - `renounceOwnership()`: Renounce the ownership of contract to leave the contract without an owner. - `transferOwnership()`: Transfers ownership of the contract to a new account. - `revertRevoke()`: Setting `vestingSchedule.revocable` to false, added in commit [8671b44a3e1cb27f6286a6ecf6e3a02bc2f9f7b3](https://gitlab.com/snapmuse-io/snapmuse-solidity/-/commit/8671b44a3e1cb27f6286a6ecf6e3a02bc2f9f7b3) Any compromise to the `owner` account may allow a hacker to take advantage of this authority and create malicious vesting or revoke legitimate vesting. Note: Comparing with the [latest commit](https://gitlab.com/snapmuse-io/snapmuse-solidity/-/commit/8f1655b2e137d464debbe709920ff9a6044ce80c), the function `revertRevoke` is **not** included in the deployed version [0xAbeef6B1A37865f1F7E1ff2d3c94D409dcC09df2](https://bscscan.com/address/0xAbeef6B1A37865f1F7E1ff2d3c94D409dcC09df2) ---
Updated with commit [8671b44a3e1cb27f6286a6ecf6e3a02bc2f9f7b3](https://gitlab.com/snapmuse-io/snapmuse-solidity/-/commit/8671b44a3e1cb27f6286a6ecf6e3a02bc2f9f7b3), all(`500_000_000 * 10 ** decimals()`) has been minted to the `mainSnapmuseOperationAddress`. This could be a centralization risk as the accounts mentioned above can distribute tokens without obtaining the consensus of the community. Any compromise to the accounts that hold undistributed tokens may allow the attacker to steal and sell tokens on the market, resulting in severe damage to the project.
The function `_withdrawRevenue()` is design to a user to withdraw the pending revenue from the protocol using a signature mechanism based on EIP712. However, due to an incorrect implementation, an attacker can replay a previous signature to get more rewards than expected. ```solidity=218 function _withdrawRevenue( address owner, ISnapmuseParityService.SnapmuseParity calldata _parityData, bytes memory _paritySignature ) internal override { require( parityService.verifySnapmuseParity(_parityData, _paritySignature), "SnapmuseCreatorPass: Invalid Parity signature" ); ... ``` This is because the current implementation in `verifySnapmuseParity` doesn't use a nonce mechanism to prevent signature replay. This can lead to security issues (describe below in the scenarios part). ```solidity=32 bytes32 hashedStruct = _hashTypedDataV4( keccak256( abi.encode( SNAPMUSE_PARITY_SIGNATURE, data.timestamp, data.parity ) ) ); ``` As a result, all withdraw revenue and reimburse minting pass methods are affected.
The `RATE_EXTENSION` is set to $10^{20}$. However, the SMX_DECIMAL is set to 8. ```solidity=4 uint8 constant SMX_DECIMAL = 8; //parity uint256 constant RATE_EXTENSION = 10 ** 20; ``` The value of `_parityData.parity` has to be at important between $10^{6}$ and $10^{12}$ depending from the `_totalAmount` to avoid mathematical truncation. ```solidity=249 uint256 smxAmount = (_totalAmount * _parityData.parity) / RATE_EXTENSION; ```
When the `vestingCliffCompensation` feature is active, the `_computeReleasableAmount` function calculates the amount that can be released from a vesting schedule in two main steps: 1. It computes the amount vested during the cliff period as a ratio of `cliffPeriod` to `completedPeriod`. 2. It calculates the amount vested after the cliff period using the ratio of `totalPeriod` to `completedPeriod`. However, there are a few concerns with the current implementation, which we want to confirm with team to prevent inconsistencies in the distribution plan. 1. The amount vested during the cliff period is distributed over time, aligning with the vesting schedule rather than being released one time with full amount at the cliff's end. 2. The current method for calculating `completedPeriod` may underestimate the actual period because it rounds down both `totalPeriod` and `cliffPeriod`. This rounding can lead to a shorter `completedPeriod` than expected. For instance, if both `totalPeriod` and `cliffPeriod` are calculated as 5 but are based on rounding down, the actual `completedPeriod` could be calculated as 4 instead of 5, which affects the distribution plan. 3. The way `afterCliffVested` is calculated may not accurately reflect the remaining amount to be distributed. The calculation uses a proportion of the total period and completed period applied to the total amount, potentially leading to discrepancies in the distributed amount, especially with smaller remainders not being accounted for properly.
The `depositRevenue` will deposit increase `totalClaimableUSD`, which will be used to calculate revenue that the user can claim. However, it is not guaranteed that the user can claim the token since the token deposit process is not part of the current codebase. The same concern also holds for `depositUserRevenue`. Similarily, the refund also relies on the external deposit (both USD and SMX) to the contract.
In contract `BaseSnapmuse1155`, the function `crossMint`, `crossMintUsdc` and `ownerMint` are being used to issue new tokens: ```solidity=108 function crossMint(address to, uint256 quantity) public payable onlyCrossMint { _ownerMint(quantity, to); } function crossMintUsdc(address to, uint256 quantity) public onlyCrossMint { uint256 priceAmount = tokenPrice * quantity; usdContract.transferFrom(msg.sender, address(this), priceAmount); usdContract.transfer(snapmuseTreasuryWalletAddress, priceAmount); _ownerMint(quantity, to); } function ownerMint(uint256 _mintAmount, address _mintTarget) external onlyOwner { _ownerMint(_mintAmount, _mintTarget); } ``` All three functions will invoke `_ownerMint` function to minting `SNAPMUSE_MINTING_PASS_ID` and record user's purchase in `_userTotalPaidMintingPasses` and `mintingPassMap`. The concern is `_userTotalPaidMintingPasses` will be used to evaluate the amount of SMX or USDC to reimburse: - `_reimburseMintingPass`: return SMX token to SMX token - `_reimburseUSDMintingPass`: return USD(C) to user However, there's a discrepancy because both `crossMint` and `ownerMint` **does not** require a token deposit. And while `crossMintUsdc` does involve a deposit as part of the transaction, it immediately transfers the USD(C) to the `snapmuseTreasuryWalletAddress`, thus leaving no SMX or USD(C) tokens stored within the contract. Also, the owner or cross-minter-issued tokens can participate in the **reimbursement**.
Some stable coin contract like [USDT](https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7#code) is not compatible with the Openzeppelin ERC20 template, for example, it will not return bool value when transfer operation finished, which may cause the require statement always revert. ```solidity=213 usdContract.transfer(owner, _totalAmount) ``` **[Note]**: Since the `_usdContract` is unknown during the auditing and is a third-party dependency, the team should be careful with this issue. Similarly, the `smxContract` should also be carefully set.
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. The contract `TokenVesting` interacts with a third-party contracts with `IERC20` interface via `_token`, and the current logic may need to adjusted if it is variant ERC20 token, for example, deflationary tokens. ```solidity=39 IERC20 immutable private _token; ``` Similarly, in `BaseSnapmuse1155` contract: ```solidity=30 IERC20 private smxContract; IERC20 private usdContract; ```
The report names a repository or files. Open the report to see its scope.
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