MAP Protocol has 2 public audit reports from CertiK; the latest is CertiK, 5 Jan 2023; 5 critical findings, all marked fixed by the firms.
Last updated . It holds audits and findings, contracts and incidents up to Nov 2026. Trustblock does not review code.
Newest first
| Report | Security firm | Date | Scope | Critical findings | Findings | Source |
|---|---|---|---|---|---|---|
| Map Protocol | Security firm: CertiK | Date: | Scope: Files listed | 4 critical findings, fixed | Findings: 4 critical · 7 high · 5 medium · 57 low 67 fixed · 3 acknowledged · 3 open | skynet.certik.com ↗ |
| Map Protocol - Near | Security firm: CertiK | Date: | Scope: —Not recorded; see the report | 1 critical finding, fixed | Findings: 1 critical · 2 high · 3 medium · 38 low 40 fixed · 4 open | skynet.certik.com ↗ |
117 findings in 2 reports: 107 fixed, 3 acknowledged (the team chose not to change the code), 7 open.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 5 |
| High | 2 | 3 | 4 |
| Medium | 0 | 0 | 8 |
| Low | 5 | 0 | 90 |
The following issues highlight the various privileged roles that have significant control over operations and transfer of funds. #### LightNode.sol *Owner* In the contract `LightNode.sol` (mapclients/eth/contracts/LightNode.sol) the role `_owner` has authority over the function: - `function changeAdmin(address _admin) public` Any compromise to the `_owner` account may allow the hacker to take advantage of this authority to update the `_admin` role used for contract upgrades. *Admin* `LightNode.sol` is an upgradeable contract where the `_admin` role can upgrade the contract without the community's consent. If an attacker compromises the account, he/she can change the implementation of the contract and drain tokens from the contract.
Report ↗The following issues highlight the various privileged roles that have significant control over operations and transfer of funds. #### MapVaultToken.sol In the contract `MAPVaultToken`, the role `manager` has authority over the following function: - `function stakingTo(uint amount, address to)` #### TokenRegister.sol In the contract `TokenRegister`, the role `manager` has authority over the following functions: - `function regToken(uint256 sourceChain, bytes memory sourceMapToken, bytes memory mapToken) external` - `function regTokenSource(bytes memory sourceToken, bytes memory sourceMapToken) external` Any compromise to the `manager` account may allow a hacker to take advantage of this authority to: - Register an arbitrary token relationship. - Overwrite existing token relation with malicious data. #### MAPCrossChainServiceRelay.sol *wToken* In the contract `MAPCrossChainServiceRelay` the role `wToken` has authority over the function: - `function receive() external payable` Any compromise to the `wToken` contract may allow the hacker to take advantage of this authority and influence transfers into `MAPCrossChainServiceRelay`. *Manager* In the contract `MapCrossChainService` the role `manager` has authority over the function: - `function setVaultBalance(uint256 tochain, address token, uint256 amount) external` - `function setTokenRegister(address _register) external` - `function setLightClientManager(address _managerAddress) external` - `function setBridageAddress(uint256 _chainId, bytes memory _addr) external` - `function setIdTable(uint256 _chainId, uint256 _id) external` - `function setNearHash(bytes32 _hash) external` - `function setPause() external` - `function setUnpause() external` - `function setTokenOtherChainDecimals(bytes memory selfToken, uint256 chainId, uint256 decimals) external` - `function setFeeCenter(address fee) external` - `function addAuthToken(address[] memory token) external` - `function removeAuthToken(address[] memory token) external` - `function withdraw(address token, address payable receiver, uint256 amount) public` Any compromise to the `manager` account may allow the hacker to take advantage of this authority to: - Update token vault balances. - Pause/unpause cross chain service. - Set and update global registers including the `tokenRegister`, `lightClientManager`, `bridgeAddress`, `ChainIdTable`, `nearTransferOut`, `tokenOtherChainDecimals`, `feeCenter`, & `authToken`. - Withdraw tokens to a predetermined wallet address. #### MAPCrossChainService.sol In the contract `MapCrossChainService` the role `manager` has authority over the function: - `function setPause() external` - `function setUnpause() external` - `function addAuthToken(address[] memory token) external` - `function removeAuthToken(address[] memory token) external` - `function setBridge(address _bridge, uint256 _num) public` - `function setCanBridgeToken(address token, uint chainId, bool canBridge) public` - `function withdraw(address token, address payable receiver, uint256 amount) public` Any compromise to the `manager` account may allow the hacker to take advantage of this authority to: - Pause/unpause cross chain service. - Control register of `authToken`. - Setting and controlling access to token bridges. - Withdraw tokens to a predetermined wallet address. #### FeeCenter.sol In the contract `FeeCenter`, the role `manager` has authority over the following functions: - `function setChainTokenGasFee(uint to, address token, uint lowest, uint highest,uint proportion) external` - `function setTokenVault(address token,address tVault) external` - `function setDistributeRate(uint id, address to, uint rate) external` Any compromise to the `manager` account may allow a hacker to take advantage of this authority to: - Update the token fee in different chains. - Set the vault address of a token. - Set distribute rate. **[Update, 11/29/2022]**: In the commit [`057e54b2a633f82717e918b9ee44c7da1ea02b1c`](https://github.com/mapprotocol/map-contracts/tree/057e54b2a633f82717e918b9ee44c7da1ea02b1c), there are other functions introduced that the role `manager` has authority over. #### MapVaultToken.sol In the contract `MAPVaultToken`, the role `manager` has authority over the following function: - `function stakingTo(uint amount, address to) external` - `function addFee(uint amount) external` - `function withdraw(uint amount, address to) external` Any compromise to the `manager` account may allow a hacker to take advantage of this authority to stake correspond tokens, add correspond tokens as fees and withdraw correspond tokens to any account with Vtoken.
Report ↗The following issues highlight the various privileged roles that have significant control over operations and transfer of funds. #### LightNode.sol *Owner* In the contract `LightNode.sol` (lightclients/near/contracts/LightNode.sol) the role `_owner` has authority over the functions: - `function trigglePause(bool flag) public` - `function initWithValidators(bytes memory data)` - `function initWithBlock(bytes memory data)` - `function changeAdmin(address _admin) public` Any compromise to the `_owner` account may allow the hacker to take advantage of this authority to set administrative accounts, validators, and proof producers. *Admin* The `_admin` role is able to upgrade the contract without the community's consent. If an attacker compromises the account, he/she can change the implementation of the contract and drain tokens from the contract.
Report ↗In the contract `MCSToken` located in `mcs/near/mcs-token/src/lib.rs`, the accounts `controller` and `owner` have authority over the following functions: - `mint`: mint new tokens; - `burn`: burn tokens; - `set_metadata`: set fungible token metadata; - `set_owner`: set a new `owner`; - `set_controller`: set a new `controller`; - `upgrade_self`: upgrade contract code. --- In the contract `AdminControlled` located in `mcs/near/admin-controlled/src/macros.rs`, the account of contract itself has authority over the following functions: - set_paused(): Update mask with all paused events. --- In the contract `MapCrossChainService` located in `mcs/near/map-cross-chain-service/src/lib.rs`, the account pointed at the `owner` property has authority over the following functions: - `set_metadata`: Get the record information( validators, threshold and epoch) for the specified epoch. - `add_native_to_chain`: Add target chain for native token. - `remove_native_to_chain`: Remove target chain for native token. - `add_fungible_token_to_chain`: Allow the fungible token to be transferred to the target chain. - `remove_fungible_token_to_chain`: Remove the target chain id from the allow list of the fungible token. - `add_mcs_token_to_chain`: Allow the MCS token to be transferred to the target chain. - `remove_mcs_token_to_chain`: Remove the target chain id from the allow list of the MCS token. - `set_chain_type`: Set the type of a chain to bridge. - `set_owner`: Replace the current `owner`. - `set_map_light_client`: Set the account that works as on-chain light client. - `set_near_chain_id`: Set the chain ID for the Near end of the bridge. - `set_map_chain_id`: Set the chain ID for the Map Relay Chain end of the bridge. - `set_map_relay_address`: Set the address of the Map contracts on the Map Relay Chain. - `upgrade_self`: Upgrade the `MapCrossChainService` contract code. Any compromise to the privileged accounts may allow an hacker to take advantage of it and to, including but not limited to: - arbitrarily add or remove bridged token - mint token - pause pending transfers - replace the on-chain light client with a malicious one Besides, the deployer of the `MapCrossChainService` contract will have full access key over the `MapCrossChainService` contract and the `MCSToken` contracts deployed by calling the `deploy_mcs_token()` function. So the deployer has the ability to delete those two kinds of contracts and transfer the Near out of them to any other accounts.
Report ↗Smart contracts on the Near blockchain are deployed in accounts backed by regular key pairs. So, the overall security of a smart contract is related to the correct usage and custodial of such a key pair. On the Near side of Map Protocol both `MapLightClient` and `MapCrossChainService` fill a paramount role for the system correct behavior. `MapCrossChainService` locks funds that are transferred from Near to the other mapped blockchain and mints and burn token from external chain that are bridged to Near. `MapLightClient` provides the source of truth for the `MapCrossChainService` to verify facts and event happened on the Map Relay Chain. As a result, any compromise to the `MapCrossChainService` or `MapLightClient` contract's accounts may allow a hacker to take advantage of this authority and arbitrary mint that are supposed to not exist or unlock funds that should remain under the contract custodial.
Report ↗When 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. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee) to the target contract, only 90 tokens actually arrived in the contract.
Report ↗**mcs/evm/contracts/MAPCrossChainServiceRelay.sol** ```solidity function _transferInOtherChain(transferOutEvent memory outEvent, uint256 outAmount, bytes memory toChainToken) internal checkOrder(outEvent.order_id) nonReentrant whenNotPaused { //... uint256 outMap = getToChainAmount(mapToken, outEvent.to_chain, selfChainId, outAmount); uint256 feeMap = getChainFee(outEvent.to_chain, mapTokenAddress, outMap); uint256 fee = getToChainAmount(mapToken, selfChainId, outEvent.to_chain, feeMap); outAmount = outAmount.sub(fee); if (checkAuthToken(mapTokenAddress)) { IMAPToken(mapTokenAddress).mint(address(this), outMap); IMAPToken(mapTokenAddress).burn(outMap.sub(feeMap)); } //... } ``` In the function `_transferInOtherChain()`, if `mapTokenAddress` is an `AuthToken`, the function `mint()` of `IMAPToken` will be called first to increase the balance of the contract, followed by the function `burn()` to decrease the balance of the contract. If it only mints the difference in the number of tokens to the contract, the `burn()` function could be removed.
Report ↗There is the risk that problems will arise because of RLP encoding compatibility issues. Recursive Length Prefix (RLP) serialization is used extensively in Ethereum's execution clients. RLP standardizes the transfer of data between nodes in a space-efficient format. The purpose of RLP is to encode arbitrarily nested arrays of binary data. RLP is the primary encoding method used to serialize objects in Ethereum's execution layer. The main purpose of RLP is to encode structures. The current RLP encoder and decoder are not in compliance with Ethereum RLP guidelines (https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp#definition) and implementations.
Report ↗The cross-chain program `Messenger` listens for events emitted on the source chain and builds a proof for the respective event. Then it transmits the message of the event and receipt proof to the destination chain. However assume the following: 1. Alice on Ethereum transfers token A to herself on Near where there is not enough token A. 2. The `Messenger` submits the receipt proof by calling the `transfer_in()` function defined on Near. 3. Within the `transfer_in()` function, a failure appears. 4. The error message is reported by calling the `report_transfer_in_fail()` function. The `Messenger` would catch that error message. However Alice's tokens are locked on Ethereum.
Report ↗The implementation of `MCSToken` contract wraps the `FungibleToken` struct from the `near_contract_standards` library. `FungibleToken` implements the `near_contract_standards::StorageManagement` that let any user to fund an `account_id` paying its staking storage deposit. If `account_id` already exists the deposited amount is refunded to the `env::predecessor_account_id()` that invoked `storage_deposit`. When an amount of `MCSToken` needs to be minted because of a transfer incoming into the Near side of the bridge, the `MapCrossChainService` contract issues a `Promise` to call the `MCSToken::mint` function, attaching a deposit for the staking storage, whose amount is configured in `MapCrossChainService::mcs_storage_transfer_in_required`. Problem resides in the fact that if the account that should benefit the minted amount already exists on the `MCSToken` instance, the refund is payed to the `env::predecessor_account_id()`, so to the `MapCrossChainService` contract. However, no functionality is provided to let the `transfer_in` caller redeem the unused deposit. Since *Messengers* are in charge of notifying cross-chain assets movements, this issue can unwillingly drain their resources moving NEAR token from them to the `MapCrossChainService` contract. In a practical example:\ let's assume that Alice wants to transfer to Bob an amount of "TokenA" from the Map Relay Chain to the Near blockchain and that "TokenA" is mapped on Near as an `MCSToken`. Bob already owns some "TokenA" so he is already registered in the `MCSToken` contract.\ Alice locks `MCS` tokens on the Map Relay Chain. One of the available *Messengers* will relay the event to the `MapCrossChainService` contract on the Near side, calling the `transfer_in` function. Within the `process_transfer_in()` function, an amount of `MCS` tokens will be minted to Bob by calling the `mint()` function of `MCSToken` contract along with the attached deposit `self.mcs_storage_transfer_in_required` which is paid by the *Messenger*. Such a deposit will be refunded to the `MapCrossChainService` contract because Bob is already registered. However, the refunded deposit for `Messenger` does not include the refunded storage deposit from the `MCSToken` contract. In fact, `self.mcs_storage_transfer_in_required` is already subtracted from `ret_deposit` before the `finish_transfer_in()` function is called. Eventually, *Messengers* will see their funds moved to the `MapCrossChainService` contract without a real justification.
Report ↗The reports name a repository or files. Open a report to see its scope.
Trustblock holds 2 public audit reports for MAP Protocol, dated 28 Nov 2022 to 5 Jan 2023. The latest is by CertiK (“Map Protocol”).
CertiK wrote the 2 reports Trustblock holds for MAP Protocol.
10 findings are still open or acknowledged in the firms’ reports: 5 high, 5 low (7 open, 3 acknowledged). Of 5 critical findings: all marked fixed by the firms. Statuses are the security firms’ own.
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