Download audit report
This document outlines the security review conducted by Nethermind Security for Summon. The audit focused on the new split payment functionality of the PaymentRouterNative smart contract. The multisig wallet functionality was removed in favor of direct fee recipient management. Additionally, funds are now sent to the admin caller instead of the multisig for emergency withdrawals.
The audited code comprises 273 lines of code written in the Solidity language. The audit focuses on the new split payment functionality for the PaymentRouterNative smart contract.
The audit was performed using (a) manual analysis of the codebase, (b) automated analysis tools, and (c) creation of test cases.
| Audit assessment | |
| Audit Type | Security Review |
| Initial Report | January 31, 2025 |
| Final Report | February 6, 2025 |
| Repository | contracts-monorepo |
| Commit | 9f9a1ca733 |
| Final Commit | 9c76d8a476 |
| Documentation | PR description |
| Documentation Assessment | Medium |
| Test Suite Assessment | Medium |
Findings by severity
| # | Contract | LoC | Comments | Ratio | Blank | Total |
| 1 | contracts/payments/PaymentRouterNative.sol | 273 | 153 | 56.0% | 51 | 477 |
| Total | 273 | 153 | 56.0% | 51 | 477 |
| # | Finding | Severity | Update |
| 1 | The removeFeeRecipient(...) function doesn’t remove recipient from feeRecipientAddresses | Medium | Fixed |
| 2 | Unused variable totalPercentage | Best Practices | Unresolved |
The participants of PaymentRouterNative contract are outlined below.
The PaymentRouterNative contract manages payments for in-game collectibles within the Summon ecosystem. It allows for configuring payment IDs, each with a configurable price and associated metadata URI. The contract supports role-based access control, enabling different levels of permissions for managing payment configurations and performing critical operations, such as updating prices and URIs, pausing/unpausing payment IDs, and handling the fee recipients. Authorized backend services sign messages to verify that a user can purchase specific in-game collectibles. Users can then call the pay(...) function to complete the transaction using the Game7 native tokens. Payments are securely routed to fee recipients. As a result, only authorized actions, validated by the signed messages, are executed within the system. The contract includes emergency withdrawal functionality to rescue any stuck funds from the contract.
The Fee Recipients receive their corresponding pro rata amount from the payment received in the pay(...) function by their respective assigned percentages. The setFeeRecipient(...) function is used to set a Fee Recipient and its percentage, whereas the removeFeeRecipient(...) function is used to remove a Fee Recipient. The pay(...) function will revert if the total percentage allocated to fee recipients does not precisely equal 100 percent.
The risk rating methodology used by Nethermind Security follows the principles established by the OWASP Foundation. The severity of each finding is determined by two factors: Likelihood and Impact.
Likelihood measures how likely the finding is to be uncovered and exploited by an attacker. This factor will be one of the following values:
When defining the likelihood of a finding, other factors are also considered. These can include but are not limited to motive, opportunity, exploit accessibility, ease of discovery, and ease of exploit.
Impact is a measure of the damage that may be caused if an attacker exploits the finding. This factor will be one of the following values:
When defining the impact of a finding, other factors are also considered. These can include but are not limited to data and state integrity, loss of availability, financial loss, and reputation damage. After defining the likelihood and impact of an issue, the severity is determined according to the table below.
| Impact / Likelihood | Low | Medium | High |
| High | Medium | High | Critical |
| Medium | Low | Medium | High |
| Low | Info / Best Practices | Low | Medium |
| Undetermined | Undetermined | Undetermined | Undetermined |
To address issues that do not fit a High, Medium or Low severity, Nethermind Security also uses three more finding severities: Informational, Best Practices, and Undetermined.
removeFeeRecipient(...) function doesn’t remove recipient from feeRecipientAddresses| File | Fix commit | Type | Status |
contracts/payments/PaymentRouterNative.sol | PR #184 | Medium | Fixed |
The setFeeRecipient(...) and batchSetFeeRecipients(...) functions push recipient to feeRecipientAddresses array if active field is false for that recipient. When the removeFeeRecipient(...) function is called, it simply sets the active field to false and percentage field to 0 but doesn’t remove the recipient from feeRecipientAddresses array as seen below:
function removeFeeRecipient(address recipient) external onlyRole(MANAGER_ROLE) {
// @audit should remove feeRecipient to avoid duplication and double counting of percentages.
if (!feeRecipients[recipient].active) revert FeeRecipientDoesNotExist();
feeRecipients[recipient].active = false;
feeRecipients[recipient].percentage = 0;
emit FeeRecipientRemoved(recipient);
}Therefore, if a recipient was removed and added again, then feeRecipientAddresses would contain duplicate entries. As a result, getTotalFeePercentage(...) and getFeeRecipients(...) function would return duplicated entries.
Given the pay(...) function loops through feeRecipientAddresses array, it will transfer multiple times to the same recipient as it contains duplicated entries.
Recommendation
Consider removing the recipient from the feeRecipientAddresses.
Resolution
totalPercentage| File | Fix commit | Type | Status |
contracts/payments/PaymentRouterNative.sol | — | Best Practices | Unresolved |
The variable totalPercentage is not used anywhere in setFeeRecipient(...) function as seen below:
function setFeeRecipient(
address recipient,
uint256 percentage
) external onlyRole(MANAGER_ROLE) {
// ...
uint256 totalPercentage = getTotalFeePercentage();
if (!feeRecipients[recipient].active) {
totalPercentage += percentage;
} else {
totalPercentage = totalPercentage - feeRecipients[recipient].percentage + percentage;
}
// ...
}Recommendation
Consider removing the variable totalPercentage or add a condition to make sure that it’s not greater than HUNDRED_PERCENT.
Resolution
Acknowledged
Software documentation refers to the written or visual information that describes the functionality, architecture, design, and implementation of software. It provides a comprehensive overview of the software system and helps users, developers, and stakeholders understand how the software works, how to use it, and how to maintain it. Software documentation can take different forms, such as user manuals, system manuals, technical specifications, requirements documents, design documents, and code comments. Software documentation is critical in software development, enabling effective communication between developers, testers, users, and other stakeholders. It helps to ensure that everyone involved in the development process has a shared understanding of the software system and its functionality. Moreover, software documentation can improve software maintenance by providing a clear and complete understanding of the software system, making it easier for developers to maintain, modify, and update the software over time. Smart contracts can use various types of software documentation. Some of the most common types include:
These types of documentation are essential for smart contract development and maintenance. They help ensure that the contract is properly designed, implemented, and tested, and they provide a reference for developers who need to modify or maintain the contract in the future.
The audit scope was limited to the PaymentRouterNative.sol contract which was part of summon-contracts project. Therefore, the following test output is an extraction of tests output strictly related to the PaymentRouterNative contract and other test outputs are ignored.
As auditors, we recommend that any changes or updates made to the audited codebase undergo a re-audit or security review to address potential vulnerabilities or risks introduced by the modifications. By conducting a re-audit or security review of the modified codebase, you can significantly enhance the overall security of your system and reduce the likelihood of exploitation. However, we do not possess the authority or right to impose obligations or restrictions on our clients regarding codebase updates, modifications, or subsequent audits. Accordingly, the decision to seek a re-audit or security review lies solely with you.
This report is based on the scope of materials and documentation provided by you to Nethermind in order that Nethermind could conduct the security review outlined in 1. Executive Summary and 2. Audited Files. The results set out in this report may not be complete nor inclusive of all vulnerabilities. Nethermind has provided the review and this report on an as-is, where-is, and as-available basis. You agree that your access and/or use, including but not limited to any associated services, products, protocols, platforms, content, and materials, will be at your sole risk. Blockchain technology remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond the programming language, or other programming aspects that could present security risks. This report does not indicate the endorsement of any particular project or team, nor guarantee its security. No third party should rely on this report in any way, including for the purpose of making any decisions to buy or sell a product, service or any other asset. To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this report, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Nethermind does not warrant, endorse, guarantee, or assume responsibility for any product or service advertised or offered by a third party through the product, any open source or third-party software, code, libraries, materials, or information linked to, called by, referenced by or accessible through the report, its content, and the related services and products, any hyperlinked websites, any websites or mobile applications appearing on any advertising, and Nethermind will not be a party to or in any way be responsible for monitoring any transaction between you and any third-party providers of products or services. As with the purchase or use of a product or service through any medium or in any environment, you should use your best judgment and exercise caution where appropriate. FOR AVOIDANCE OF DOUBT, THE REPORT, ITS CONTENT, ACCESS, AND/OR USAGE THEREOF, INCLUDING ANY ASSOCIATED SERVICES OR MATERIALS, SHALL NOT BE CONSIDERED OR RELIED UPON AS ANY FORM OF FINANCIAL, INVESTMENT, TAX, LEGAL, REGULATORY, OR OTHER ADVICE.
The Leading Engineers of Blockchain Infrastructure